Example #1
0
        public PRIZECommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser,HelpCommandHandler MyHelpCommandHandler, MySqlManager MyMySqlManager, Inventory MyInventory, TradeHandler MyTradeHandler, Stats MyStats, Logger MyLogger, ActorHandler MyActorHandler)
        {
            this.TheTCPWrapper = MyTCPWrapper;
            this.TheMessageParser = MyMessageParser;
            this.TheHelpCommandHandler = MyHelpCommandHandler;
            this.TheMySqlManager = MyMySqlManager;
            this.TheInventory = MyInventory;
            this.TheTradeHandler = MyTradeHandler;
            this.TheStats = MyStats;
            this.TheActorHandler = MyActorHandler;
            this.TheLogger = MyLogger;
            this.TheTCPWrapper.GotCommand += new TCPWrapper.GotCommandEventHandler(OnGotCommand);

            //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#inv",Settings.botid);

            //if (CommandIsDisabled == false)
            {
                if (Settings.IsTradeBot == true && TheMySqlManager.IGamble())
                {
                    TheHelpCommandHandler.AddCommand("#prize - show my prize list");
                    TheHelpCommandHandler.AddCommand("#prizes - null");
                }
                TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
                this.TheInventory.GotNewInventoryList += new Inventory.GotNewInventoryListEventHandler(OnGotNewInventoryList);
                this.TheMessageParser.Got_AbortTrade += new BasicCommunication.MessageParser.Got_AbortTrade_EventHandler(OnGotAbortTrade);
            }
        }
Example #2
0
 public void Init(Inventory.Slot slot)
 {
     this.slot = slot;
     GetComponent<Image> ().sprite = Resources.Load<Sprite> ("Texture/Item/"+slot.item.info.id);
     Transform count = transform.FindChild ("Count");
     count.GetComponent<Text> ().text = slot.count.ToString ();
 }
Example #3
0
 void Awake()
 {
     inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent<Inventory>();
     controller = gameObject.GetComponent("CharacterController") as CharacterController;
     animator = GetComponent<Animator>();
     canAttack = true;
 }
Example #4
0
	public override void invoke(Inventory invoker) {
		audioSource.Play();
		foreach (AbstractPowerSource source in AbstractPowerSource.powerSources) {
			if (Vector3.Distance(invoker.transform.position, source.transform.position) < range)
				source.disable(disableTime);
		}
	}
 private void OnQueryInventorySucceeded(string json)
 {
     if (queryInventorySucceededEvent != null) {
         Inventory inventory = new Inventory(json);
         queryInventorySucceededEvent(inventory);
     }
 }
Example #6
0
 public void Reset(ISettings settings, ILogicSettings logicSettings)
 {
     Client = new Client(Settings);
     LogicClient = new LogicClient(LogicSettings);
     Inventory = new Inventory(Client, LogicClient);
     Navigation = new Navigation(Client);
 }
Example #7
0
	void Start()
	{
		GameObject goItemManager = GameObject.FindGameObjectsWithTag("GameManager").FirstOrDefault( (go) => go.name == "Item Manager" );
		if( null == goItemManager )
			Debug.LogError( "Failed to find Item Manager game object");
		else
			m_Inventory = new Inventory( goItemManager.GetComponent<InventoryManager>() );

		m_Path = GetComponent<AIPath>();
		m_Seeker = GetComponent<Seeker>();

		// Find the start locator and set our position/orientation
		if( !string.IsNullOrEmpty( m_StartLocatorName ) )
		{
			GameObject[] locators = GameObject.FindGameObjectsWithTag( "Locator" );
			if( locators.Length > 0 )
			{
				GameObject startLocator = locators.FirstOrDefault( (i) => { return i.name == m_StartLocatorName; } );

				if( null != startLocator )
				{
					transform.position = startLocator.transform.position;
					transform.rotation = startLocator.transform.rotation;
				}
			}
		}
	}
Example #8
0
    private bool pressingButtonToSplit; //bool for pressing a item to split it

    #endregion Fields

    #region Methods

    //splitting the item now
    public void OnPointerDown(PointerEventData data)
    {
        inv = transform.parent.parent.parent.GetComponent<Inventory>();
        if (transform.parent.parent.parent.GetComponent<Hotbar>() == null && data.button == PointerEventData.InputButton.Left && pressingButtonToSplit && inv.stackable && (inv.ItemsInInventory.Count < (inv.height * inv.width))) //if you press leftclick and and keycode
        {
            ItemOnObject itemOnObject = GetComponent<ItemOnObject>();                                                   //we take the ItemOnObject script of the item in the slot

            if (itemOnObject.item.itemValue > 1)                                                                         //we split the item only when we have more than 1 in the stack
            {
                int splitPart = itemOnObject.item.itemValue;                                                           //we take the value and store it in there
                itemOnObject.item.itemValue = (int)itemOnObject.item.itemValue / 2;                                     //calculate the new value for the splitted item
                splitPart = splitPart - itemOnObject.item.itemValue;                                                   //take the different

                inv.addItemToInventory(itemOnObject.item.itemID, splitPart);                                            //and add a new item to the inventory
                inv.stackableSettings();

                if (GetComponent<ConsumeItem>().duplication != null)
                {
                    GameObject dup = GetComponent<ConsumeItem>().duplication;
                    dup.GetComponent<ItemOnObject>().item.itemValue = itemOnObject.item.itemValue;
                    dup.GetComponent<SplitItem>().inv.stackableSettings();
                }
                inv.updateItemList();

            }
        }
    }
        public override void OnTradeAddItem(Schema.Item schemaItem, Inventory.Item inventoryItem)
        {
            // USELESS DEBUG MESSAGES -------------------------------------------------------------------------------
            SendTradeMessage("Object AppID: {0}", inventoryItem.AppId);
            SendTradeMessage("Object ContextId: {0}", inventoryItem.ContextId);

            switch (inventoryItem.AppId)
            {
                case 440:
                    SendTradeMessage("TF2 Item Added.");
                    SendTradeMessage("Name: {0}", schemaItem.Name);
                    SendTradeMessage("Quality: {0}", inventoryItem.Quality);
                    SendTradeMessage("Level: {0}", inventoryItem.Level);
                    SendTradeMessage("Craftable: {0}", (inventoryItem.IsNotCraftable ? "No" : "Yes"));
                    break;

                case 753:
                    GenericInventory.ItemDescription tmpDescription = OtherSteamInventory.getDescription(inventoryItem.Id);
                    SendTradeMessage("Steam Inventory Item Added.");
                    SendTradeMessage("Type: {0}", tmpDescription.type);
                    SendTradeMessage("Marketable: {0}", (tmpDescription.marketable ? "Yes" : "No"));
                    break;

                default:
                    SendTradeMessage("Unknown item");
                    break;
            }
            // ------------------------------------------------------------------------------------------------------
        }
Example #10
0
 // Use this for initialization
 void Start()
 {
     controller = gameObject.transform.root.GetComponent<CharacterController>();
     motor = gameObject.transform.root.GetComponent<CharacterMotor>();
     inventory = gameObject.transform.root.GetComponent<Inventory>();
     vitals = gameObject.transform.root.GetComponent<PlayerVitals>();
 }
Example #11
0
 /// <summary>
 /// Reset and initialize the entire view based on the given Inventory.</summary>
 public void InitFromInventory(Inventory inventory)
 {
     foreach (KeyValuePair<InventoryItem, InventoryViewItem> entry in _items)
     {
         Destroy(entry.Value.gameObject);
     }
     _items.Clear();
     _numberOfSlots = inventory._items.Count;
     ResetSlots();
     int currentActionSlot = 0;
     for (int i=0; i < inventory._items.Count; i++)
     {
         var invItem = AddItem(inventory._items[i], inventory._quantities[i]);
         // Update the weapon Slot
         if (inventory._items[i] == Player._player.Stats._equippedWeapon)
         {
             _weaponSlot.Swap(invItem);
         }
         if (Player._player.Stats._equippedItems.Contains(inventory._items[i]))
         {
             PlayerMenu._playerMenu._actionSlots[currentActionSlot]._allowsDrag = true;
             PlayerMenu._playerMenu._actionSlots[currentActionSlot].Swap(invItem);
             PlayerMenu._playerMenu._actionSlots[currentActionSlot]._allowsDrag = false;
             currentActionSlot += 1;
         }
     }
 }
Example #12
0
	/**
	 * The Start method is called automatically by Monobehaviours,
	 * essentially becoming the constructor of the class.
	 * <p>
	 * See <a href="http://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html">docs.unity3d.com</a> for more information.
	 */
	private void Start() {
        inventory = this.transform.parent.parent.GetComponentInParent<Inventory>();
        amountText = this.transform.FindChild("Item Amount").GetComponent<Text>();
        tooltip = this.transform.FindChild("Item Tooltip").gameObject;
		tooltip.SetActive(false);
        BuildTooltipText();
	}
Example #13
0
    public LocalObject(LocalShape localShape, string _uniqueName = "", Inventory _inventory = null)
    {
        uniqueName = _uniqueName;
        shape = new ShapeComponent(localShape, this);

        if (localShape.type == LocalType.Get("Destructible") || localShape.type == LocalType.Get("Container"))
        {
            hp = new HPComponent(this);
        }
        else if (localShape.type == LocalType.Get("Creature"))
        {
            hp = new HPComponent(this);
            movement = new Movement(this);
            defence = new Defence(this);
            attack = new Attack(this);
            abilities = new Abilities(this);
            fatigue = new Fatigue(this);
            eating = new Eating(this);
        }

        if (_inventory != null)
        {
            inventory = new Inventory(6, 1, "", false, null, this);
            _inventory.CopyTo(inventory);
        }
    }
 protected void btnSave_Click(object sender, EventArgs e)
 {
     med = new Inventory();
     if (txtMedicineId.Text == "" || txtMedicineId.Text == null)
     {
         Response.Write("<script> window.alert('Please Select a Medicine to Edit before Saving.')</script>");
     }
     else
     {
         if (txtMedicineName.Text == "" || txtMedicineName.Text == null)
         {
             Response.Write("<script> window.alert('Medicine Field Should not be Empty.')</script>");
         }
         else
         {
             if (txtQuantity.Text == "" || txtQuantity.Text == null)
             {
                 Response.Write("<script> window.alert('Quantity Field Should not be Empty.')</script>");
             }
             else
             {
                 bool checker = med.UpdateMedicine(Convert.ToInt32(txtMedicineId.Text.Trim()), txtMedicineName.Text.Trim(),
                    ddlCategory.Text.Trim(), Convert.ToInt32(txtQuantity.Text.Trim()));
                 if (checker == true)
                     Response.Write("<script> window.alert('Updated Medicine Successful.')</script>");
                 else
                     Response.Write("<script> window.alert('Updating is Unsuccessful.')</script>");
                 
                 gridViewMedicine.DataBind();
                     
             }
         }
     }
 }
Example #15
0
 // Use this for initialization
 void Start()
 {
     itemImage = gameObject.GetComponent<Image> ();
     defaultPosition = transform.localPosition;
     myInv = transform.GetComponentInParent<Inventory> ();
     //defaultPosition.z = 0
 }
Example #16
0
	// Use this for initialization
	void Start () {
		weaponhandler = GameObject.FindGameObjectWithTag ("WeaponHandler").GetComponent<WeaponHandler> ();
		itemAmount = gameObject.transform.GetChild (1).GetComponent<Text> ();
		inventory = GameObject.FindGameObjectWithTag ("Inventory").GetComponent<Inventory>();
		itemImage = gameObject.transform.GetChild (0).GetComponent<Image> ();
		showinv = GameObject.FindGameObjectWithTag ("Player").GetComponent<ShowInventory> ();
	}
Example #17
0
 void Start()
 {
     anim = GetComponent<Animator>();
     gui = (Gui)GameObject.FindObjectOfType(typeof(Gui));
     inventory = (Inventory)GameObject.FindObjectOfType(typeof(Inventory));
     player = GameObject.FindGameObjectsWithTag("Player")[0];
 }
Example #18
0
 // Use this for initialization
 void Start()
 {
     king = GameObject.FindGameObjectWithTag("King").GetComponent<QuestGiver>();
     inv = GameObject.Find("Inventory").GetComponent<Inventory>();
     qg = GetComponent<QuestGiver>();
     musicSwitch = GameObject.FindObjectOfType<MusicSwitch>();
 }
Example #19
0
        public INVCommandHandler(TCPWrapper MyTCPWrapper, BasicCommunication.MessageParser MyMessageParser,HelpCommandHandler MyHelpCommandHandler, MySqlManager MyMySqlManager, Inventory MyInventory, TradeHandler MyTradeHandler, Stats MyStats)
        {
            this.TheTCPWrapper = MyTCPWrapper;
            this.TheMessageParser = MyMessageParser;
            this.TheHelpCommandHandler = MyHelpCommandHandler;
            this.TheMySqlManager = MyMySqlManager;
            this.TheInventory = MyInventory;
            this.TheTradeHandler = MyTradeHandler;
            this.TheStats = MyStats;

            //this.CommandIsDisabled = MyMySqlManager.CheckIfCommandIsDisabled("#inv",Settings.botid);

            //if (CommandIsDisabled == false)
            {
                if (Settings.IsTradeBot == true)
                {
                    TheHelpCommandHandler.AddCommand("#inventory / #inv / #i - show what I am selling");
                    TheHelpCommandHandler.AddCommand("#invmembers / #im - member rates");
                    TheHelpCommandHandler.AddCommand("#inv - null");
                    TheHelpCommandHandler.AddCommand("#i - null");
                    TheHelpCommandHandler.AddCommand("#inb - null");
                    TheHelpCommandHandler.AddCommand("#sell - null");
                    TheHelpCommandHandler.AddCommand("#selling - null");
                    TheHelpCommandHandler.AddCommand("#im - null");
                    TheHelpCommandHandler.AddCommand("#invmember - null");
                    TheHelpCommandHandler.AddCommand("#invmemver - null");
                    TheHelpCommandHandler.AddCommand("#invmemvers - null");
                }
                TheMessageParser.Got_PM += new BasicCommunication.MessageParser.Got_PM_EventHandler(OnGotPM);
            }
        }
Example #20
0
 // Use this for initialization
 void Start()
 {
     inventory = GameObject.FindGameObjectWithTag("Inventory");
     info = GameObject.FindGameObjectWithTag("InfoPanel").GetComponent<InfoPanel>();
     inv = inventory.GetComponent<Inventory>();
     inventory.SetActive(false);
 }
Example #21
0
    float z = -1f; // Z height to draw line

    #endregion Fields

    #region Methods

    void Awake()
    {
        standardForce = transform.right * forceMult;
        force = transform.right * forceMult;
        player = GetComponent<playerMove>();
        inv = GetComponent<Inventory>();
    }
Example #22
0
    public void OnPointerDown(PointerEventData data)
    {
        inv = transform.parent.parent.parent.GetComponent<Inventory>();
        if (transform.parent.parent.parent.GetComponent<Hotbar>() == null && data.button == PointerEventData.InputButton.Left && pressingButtonToSplit && inv.stackable && (inv.ItemsInInventory.Count < (inv.height * inv.width)))
        {
            ItemOnObject itemOnObject = GetComponent<ItemOnObject>();

            if (itemOnObject.item.itemValue > 1)
            {
                int splitPart = itemOnObject.item.itemValue;
                itemOnObject.item.itemValue = (int)itemOnObject.item.itemValue / 2;
                splitPart = splitPart - itemOnObject.item.itemValue;

                inv.addItemToInventory(itemOnObject.item.itemID, splitPart);
                inv.stackableSettings();

                if (GetComponent<ConsumeItem>().duplication != null)
                {
                    GameObject dup = GetComponent<ConsumeItem>().duplication;
                    dup.GetComponent<ItemOnObject>().item.itemValue = itemOnObject.item.itemValue;
                    dup.GetComponent<SplitItem>().inv.stackableSettings();
                }
                inv.updateItemList();

            }
        }
    }
Example #23
0
	void Awake(){
		gameObject.name = gameObject.name.Replace("(Clone)", "");
		Player = GameObject.FindWithTag("Player").transform;
		hcs = Player.GetComponent<HeroControllerScript>();
		inv = Player.GetComponent<Inventory>();
		ItemObject = Resources.Load(gameObject.name) as GameObject;
	}
Example #24
0
    public override string GetToolTip (Inventory inv) {

        string stats = string.Empty;

        if (Health > 0) {
            stats += "\nRestores " + Health.ToString() + " health";
        }
        if (Mana > 0)
        {
            stats += "\nRestores " + Mana.ToString() + " energy";
        }
        if (Rage > 0)
        {
            stats += "\nRestores " + Rage.ToString() + " rage";
        }
        string itemTip = base.GetToolTip(inv);

        if (inv is VendorInventory) {
            return string.Format("{0}" + "<size=20>{1}\n<color=yellow>Buy Price: {2} Crumbs</color></size>", itemTip, stats, BuyPrice);
        } 
        else if (VendorInventory.Instance.IsOpen) {
            return string.Format("{0}" + "<size=20>{1}\n<color=yellow>Sell Price: {2} Crumbs</color></size>", itemTip, stats, SellPrice);
        } 
        else {
            return string.Format("{0}" + "<size=20>{1}</size>", itemTip, stats);
        }

    }
Example #25
0
    void Update()
    {
        if (itemId == -1)
            return;
        //如果快捷栏有物品,则刷新物品状态
        if (inventory == null)
        {
            UnityEngine.GameObject canvas = UnityEngine.GameObject.FindGameObjectWithTag("Canvas");
            inventory = canvas.transform.Find("Panel - Inventory(Clone)").GetComponent<Inventory>();
        }
        if (inventory == null)
            return;
        //物品已使用完或者消失
        UnityEngine.GameObject itemobject = inventory.getItemGameObject(itemId);
        if (itemobject == null)
        {
            this.itemId = -1;
            this.gameObject.SetActive(false);
            return;
        }

        image_icon.sprite = itemobject.GetComponent<ItemOnObject>().item.itemIcon;
        text.rectTransform.localPosition = itemobject.transform.GetChild(1).GetComponent<Text>().transform.localPosition;
        text.enabled = true;
        text.text = itemobject.transform.GetChild(1).GetComponent<Text>().text;
        if (ConsumeLimitCD.instance.isWaiting())
        {
            image_cool.fillAmount = ConsumeLimitCD.instance.restTime / ConsumeLimitCD.instance.totalTime;
        }
        else
        {
            image_cool.fillAmount = 0;
        }
    }
Example #26
0
        public StatsExport GetCurrentInfo(Inventory inventory)
        {
            var stats = inventory.GetPlayerStats().Result;
            StatsExport output = null;
            var stat = stats.FirstOrDefault();
            if (stat != null)
            {
                var ep = stat.NextLevelXp - stat.PrevLevelXp - (stat.Experience - stat.PrevLevelXp);
                var time = Math.Round(ep/(TotalExperience/GetRuntime()), 2);
                var hours = 0.00;
                var minutes = 0.00;
                if (double.IsInfinity(time) == false && time > 0)
                {
                    time = Convert.ToDouble(TimeSpan.FromHours(time).ToString("h\\.mm"), CultureInfo.InvariantCulture);
                    hours = Math.Truncate(time);
                    minutes = Math.Round((time - hours)*100);
                }

                output = new StatsExport
                {
                    Level = stat.Level,
                    HoursUntilLvl = hours,
                    MinutesUntilLevel = minutes,
                    CurrentXp = stat.Experience - stat.PrevLevelXp - GetXpDiff(stat.Level),
                    LevelupXp = stat.NextLevelXp - stat.PrevLevelXp - GetXpDiff(stat.Level),
                };
            }
            return output;
        }
Example #27
0
 void Awake()
 {
     PickUpSound = gameObject.GetComponent<AudioSource> ();
     PickUpSound.clip = PickUpClip;
     player = GameObject.FindGameObjectWithTag ("Player");
     inv = canv.GetComponent<Inventory>();
 }
 public DecorationInventory(Inventory inventory)
 {
     this.inventory				= inventory;
     this.pockets				= new Dictionary<DecorationTypes, DecorationPocket>();
     this.secretBaseDecorations	= new List<PlacedDecoration>();
     this.bedroomDecorations		= new List<PlacedDecoration>();
 }
Example #29
0
 public void Reset(ISettings settings, ILogicSettings logicSettings)
 {
     Client = new Client(Settings) {AuthType = settings.AuthType};
     // ferox wants us to set this manually
     Inventory = new Inventory(Client, logicSettings);
     Navigation = new Navigation(Client);
 }
Example #30
0
    public virtual string GetToolTip (Inventory inv) {
        //string stats = string.Empty;
        string color = string.Empty;
        string newLine = string.Empty;

        if (Description != string.Empty) {
            newLine = "\n";
        }

        switch (Quality) {  
            case Quality.COMMON:
                color = "white";
                break;
            case Quality.UNCOMMON:
                color = "lime";
                break;
            case Quality.RARE:
                color = "navy";
                break;
            case Quality.EPIC:
                color = "magenta";
                break;
            case Quality.LEGENDARY:
                color = "red";
                break;
        }

        return string.Format("<color=" + color + "><size=40>{0}</size></color><size=25><i><color=lime>" + newLine + "{1}</color></i>\n{2}</size>", ItemName,Description, ItemType.ToString().ToLower());
	}
Example #31
0
 private void OnValidate()
 {
     inventory = FindObjectOfType <Inventory>();
 }
Example #32
0
        /// <summary>
        /// Function to process the part which has been applied to the frame
        /// </summary>
        /// <param name="usedObject"></param>
        /// <param name="interaction"></param>
        private void PartCheck(GameObject usedObject, HandApply interaction)
        {
            // For all the list of data(itemtraits, amounts needed) in machine parts
            for (int i = 0; i < machineParts.machineParts.Length; i++)
            {
                // If the interaction object has an itemtrait thats in the list, set the list machinePartsList variable as the list from the machineParts data from the circuit board.
                if (usedObject.GetComponent <ItemAttributesV2>().HasTrait(machineParts.machineParts[i].itemTrait))
                {
                    machinePartsList = machineParts.machineParts[i];
                    break;

                    // IF YOU WANT AN ITEM TO HAVE TWO ITEMTTRAITS WHICH CONTRIBUTE TO THE MACHINE BUILIDNG PROCESS, THIS NEEDS TO BE REFACTORED
                    // all the stuff below needs to go into its own method which gets called here, replace the break;
                }
            }

            // Amount of the itemtrait that is needed for the machine to be buildable
            var needed = machinePartsList.amountOfThisPart;

            // Itemtrait currently being looked at.
            var itemTrait = machinePartsList.itemTrait;

            // If theres already the itemtrait how many more do we need
            if (basicPartsUsed.ContainsKey(itemTrait))
            {
                needed -= basicPartsUsed[itemTrait];
            }

            //Main logic for tallying up and moving parts to hidden pos
            if (basicPartsUsed.ContainsKey(itemTrait) && usedObject.GetComponent <Stackable>() != null && usedObject.GetComponent <Stackable>().Amount >= needed)           //if the itemTrait already exists, and its stackable and some of it is needed.
            {
                basicPartsUsed[itemTrait] = machinePartsList.amountOfThisPart;

                Inventory.ServerDrop(interaction.HandSlot);

                AddItemToDict(usedObject, needed, interaction);
            }
            else if (basicPartsUsed.ContainsKey(itemTrait) && usedObject.GetComponent <Stackable>() != null && usedObject.GetComponent <Stackable>().Amount < needed)          //if the itemTrait already exists, and its stackable and all of its needed.
            {
                var used = usedObject.GetComponent <Stackable>().Amount;
                basicPartsUsed[itemTrait] += used;

                Inventory.ServerDrop(interaction.HandSlot);

                AddItemToDict(usedObject, used, interaction);
            }
            else if (usedObject.GetComponent <Stackable>() != null && usedObject.GetComponent <Stackable>().Amount >= needed)           //if the itemTrait doesnt exists, and its stackable and some of it is needed.
            {
                basicPartsUsed.Add(itemTrait, needed);

                Inventory.ServerDrop(interaction.HandSlot);

                AddItemToDict(usedObject, needed, interaction);
            }
            else if (usedObject.GetComponent <Stackable>() != null && usedObject.GetComponent <Stackable>().Amount < needed)          //if the itemTrait doesnt exists, and its stackable and all of its needed.
            {
                var used = usedObject.GetComponent <Stackable>().Amount;
                basicPartsUsed.Add(itemTrait, used);

                Inventory.ServerDrop(interaction.HandSlot);

                AddItemToDict(usedObject, used, interaction);
            }
            else if (basicPartsUsed.ContainsKey(itemTrait))            // ItemTrait already exists but isnt stackable
            {
                basicPartsUsed[itemTrait]++;

                Inventory.ServerDrop(interaction.HandSlot);

                AddItemToDict(usedObject, 1, interaction);
            }
            else            // ItemTrait doesnt exist but isnt stackable
            {
                basicPartsUsed.Add(itemTrait, 1);

                Inventory.ServerDrop(interaction.HandSlot);

                AddItemToDict(usedObject, 1, interaction);
            }
        }
Example #33
0
 void Start()
 {
     inv     = GameObject.FindGameObjectWithTag("Inventory").GetComponent <Inventory>();
     tooltip = inv.GetComponent <Tooltip>();
 }
        /// <summary>
        /// Get the inventory list result in jquery data table JSON format, return the DataTable Result with paging and sorting.
        /// </summary>
        /// <param name="dtParams">Jquery Data Table Parameter</param>
        /// <param name="queryInventory">Query Inventory Object</param>
        /// <returns>JSON: DataTable Result with paging and sorting</returns>
        public JsonNetResult GetInventoryDataTableJson(DTParams dtParams, Inventory queryInventory)
        {
            DTResult <Inventory> inventoryDataTableResult = inventoryService.GetInventoryDataTableResult(dtParams, queryInventory);

            return(new JsonNetResult(inventoryDataTableResult));
        }
Example #35
0
 public override string ToString()
 {
     return(Name + " " + CurrentState.ToString() + "   " + CurrentLocation.ToString() + "\n" + Inventory.ToString());
 }
Example #36
0
 public void addItem(Item item)
 {
     // System.Console.WriteLine(item.Name);
     Inventory.Add(item);
 }
Example #37
0
    public void SetInventroy(Inventory _inventory)
    {
        inventory = _inventory;

        inventory.SetInventory(this, List_items);
    }
Example #38
0
        public Client(ISettings settings)
        {
            if (settings.UsePogoDevHashServer)
            {
                if (string.IsNullOrEmpty(settings.AuthAPIKey))
                {
                    throw new AuthConfigException("You have selected Pogodev API but not provide proper API Key");
                }

                Cryptor = new Cipher();

                // This value will determine which version of the hashing service you will receive.
                // Currently supported versions:
                // v119   -> Pogo iOS 1.19
                // v121   -> Pogo iOS 1.21
                // v121_2 -> Pogo iOS 1.22
                // v125   -> Pogo iOS 1.25
                // v127_2 -> Pogo iOS 1.27.2
                // v127_3 -> Pogo iOS 1.27.3
                // v127_4 -> Pogo iOS 1.27.4
                // v129_1 -> Pogo iOS 1.29.1
                // v131_0 -> Pogo iOS 1.31.0
                // v133_1 -> Pogo iOS 1.33.1
                // v133_1 -> Pogo iOS 1.33.4
                // v137_1 -> Pogo iOS 1.37.1

                ApiEndPoint = Constants.ApiEndPoint;

                Hasher = new PokefarmerHasher(settings.AuthAPIKey, settings.DisplayVerboseLog, ApiEndPoint);

                // These 4 constants below need to change if we update the hashing server API version that is used.
                Unknown25 = Constants.Unknown25;

                // WARNING! IF YOU CHANGE THE APPVERSION BELOW ALSO UPDATE THE API_VERSION AT THE TOP OF THE FILE!
                AppVersion = Constants.AppVersion;

                CurrentApiEmulationVersion = new Version(Constants.API_VERSION);
                UnknownPlat8Field          = Constants.UnknownPlat8Field;
            }

            /*
             * else
             * if (settings.UseLegacyAPI)
             * {
             *  Hasher = new LegacyHashser();
             *  Cryptor = new LegacyCrypt();
             *
             *  Unknown25 = -816976800928766045;// - 816976800928766045;// - 1553869577012279119;
             *  AppVersion = 4500;
             *  CurrentApiEmulationVersion = new Version("0.45.0");
             * }
             */
            else
            {
                throw new AuthConfigException("No API method was selected in auth.json");
            }

            Settings          = settings;
            Proxy             = InitProxy();
            PokemonHttpClient = new PokemonHttpClient();
            Login             = new Login(this);
            Player            = new Player(this);
            Download          = new Download(this);
            Inventory         = new Inventory(this);
            Map            = new Map(this);
            Fort           = new Fort(this);
            Encounter      = new Encounter(this);
            Misc           = new Misc(this);
            KillswitchTask = new KillSwitchTask(this);

            Player.SetCoordinates(Settings.DefaultLatitude, Settings.DefaultLongitude, Settings.DefaultAltitude);
            Platform = settings.DevicePlatform.Equals("ios", StringComparison.Ordinal) ? Platform.Ios : Platform.Android;

            // We can no longer emulate Android so for now just overwrite settings with randomly generated iOS device info.
            if (Platform == Platform.Android)
            {
                Signature.Types.DeviceInfo iosInfo = DeviceInfoHelper.GetRandomIosDevice();
                settings.DeviceId             = iosInfo.DeviceId;
                settings.DeviceBrand          = iosInfo.DeviceBrand;
                settings.DeviceModel          = iosInfo.DeviceModel;
                settings.DeviceModelBoot      = iosInfo.DeviceModelBoot;
                settings.HardwareManufacturer = iosInfo.HardwareManufacturer;
                settings.HardwareModel        = iosInfo.HardwareModel;
                settings.FirmwareBrand        = iosInfo.FirmwareBrand;
                settings.FirmwareType         = iosInfo.FirmwareType;

                // Clear out the android fields.
                settings.AndroidBoardName      = "";
                settings.AndroidBootloader     = "";
                settings.DeviceModelIdentifier = "";
                settings.FirmwareTags          = "";
                settings.FirmwareFingerprint   = "";

                // Now set the client platform to ios
                Platform = Platform.Ios;
            }
        }
Example #39
0
 public Task Save(Inventory inventory)
 {
     return(this.repository.Create(inventory));
 }
Example #40
0
 // Start is called before the first frame update
 void Start()
 {
     anim      = GameObject.FindWithTag("Player").GetComponent <Animator>();
     invScript = GameObject.FindWithTag("GameController").GetComponent <Inventory>();
 }
 public void OnCollect(Inventory inventory)
 {
     inventory.ApplyChangeToWallet(value);
     Destroy(this.gameObject);
 }
Example #42
0
 public InventoryData(int numbSlots, Inventory parent)
 {
     items       = new GameObject[numbSlots];
     this.parent = parent;
 }
        private void CalculateSystemSerial()
        {
            // some switches does not support the "show inventory" command
            bool exec_error = Inventory.ToLowerInvariant().Contains("invalid input detected") || ScriptSettings.FailedCommandPattern.SplitBySemicolon().Any(w => Inventory.IndexOf(w) >= 0);

            if (exec_error)
            {
                DebugEx.WriteLine(String.Format("JunOS IRouter : switch does not support \"show chassis hardware\" command, parsing version information"), DebugLevel.Debug);
                // try to parse sh_version to get system serial numbers
                try
                {
                    _systemSerial = string.Join(",", _versionInfo.SplitByLine().Where(l => l.StartsWith("System serial number")).Select(l => l.Split(':')[1].Trim()));
                }
                catch (Exception Ex)
                {
                    DebugEx.WriteLine(String.Format("JunOS IRouter : error searching serial number in \"sh version\" output : {0}", Ex.InnerExceptionsMessage()), DebugLevel.Debug);
                }
            }
            else
            {
                switch (Type)
                {
                case "Switch":
                {
                    // Assuming an EX / QFX series switch
                    var FPCs = Regex.Matches(Inventory, @"FPC \d.*");
                    foreach (Match thisFPC in FPCs)
                    {
                        string[] fpcLineWords = thisFPC.Value.SplitBySpace();
                        // words should look like:FPC,0,REV,19,650-044931,PE3716200032,EX4300-48T
                        // serial number should be words[5]
                        _systemSerial += (";" + fpcLineWords[5]);
                        _modelNumber  += (";" + fpcLineWords[6]);
                    }
                    _systemSerial = _systemSerial?.TrimStart(';');
                    _modelNumber  = _modelNumber?.TrimStart(';');
                    break;
                }

                case "Firewall":
                {
                    // Assuming SRX firewall
                    var FPCs = Regex.Matches(Inventory, @"\bChassis.*\b");
                    foreach (Match thisFPC in FPCs)
                    {
                        string[] chassisLineWords = thisFPC.Value.SplitBySpace();
                        // expecting chassisLineWords as : Chassis,BU4913AK0887,SRX240H2
                        _systemSerial += (";" + chassisLineWords[1]);
                        _modelNumber  += (";" + chassisLineWords[2]);
                    }
                    _systemSerial = _systemSerial?.TrimStart(';');
                    _modelNumber  = _modelNumber?.TrimStart(';');
                    break;
                }

                case "Router":
                {
                    // not yet implemented
                    _systemSerial = "?";
                    _modelNumber  = "?";
                    break;
                }
                }
            }
        }
Example #44
0
 public void Init(Vector3 pos, int index, Inventory inv)
 {
     inventoryPos   = pos;
     theInv         = inv;
     inventoryIndex = index;
 }
Example #45
0
        public void ServerPerformInteraction(HandApply interaction)
        {
            //Anchor or disassemble
            if (CurrentState == initialState)
            {
                if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.Wrench))
                {
                    if (!ServerValidations.IsAnchorBlocked(interaction))
                    {
                        //wrench in place
                        ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                                  "You start wrenching the turret frame into place...",
                                                                  $"{interaction.Performer.ExpensiveName()} starts wrenching the turret frame into place...",
                                                                  "You wrench the turret frame into place.",
                                                                  $"{interaction.Performer.ExpensiveName()} wrenches the turret frame into place.",
                                                                  () =>
                        {
                            objectBehaviour.ServerSetAnchored(true, interaction.Performer);

                            stateful.ServerChangeState(anchoredState);
                        });

                        return;
                    }

                    Chat.AddExamineMsgFromServer(interaction.Performer, "Unable to anchor turret frame here");
                }
                else if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.Crowbar))
                {
                    //deconstruct
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                              "You start deconstructing the turret frame...",
                                                              $"{interaction.Performer.ExpensiveName()} starts deconstructing the turret frame...",
                                                              "You deconstruct the turret frame.",
                                                              $"{interaction.Performer.ExpensiveName()} deconstructs the turret frame.",
                                                              () =>
                    {
                        Spawn.ServerPrefab(CommonPrefabs.Instance.Metal, SpawnDestination.At(gameObject), 5);
                        _ = Despawn.ServerSingle(gameObject);
                    });
                }

                return;
            }

            //Adding metal or unanchor
            if (CurrentState == anchoredState)
            {
                if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.MetalSheet))
                {
                    //Add metal
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                              "You start adding a metal cover to the turret frame...",
                                                              $"{interaction.Performer.ExpensiveName()} starts adding a metal cover to the turret frame...",
                                                              "You add a metal cover to the turret frame.",
                                                              $"{interaction.Performer.ExpensiveName()} adds a metal cover to the turret frame.",
                                                              () =>
                    {
                        Inventory.ServerConsume(interaction.HandSlot, 1);
                        stateful.ServerChangeState(metalAddedState);
                    });
                }
                else if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.Wrench))
                {
                    //Unanchor
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                              "You start unwrenching the turret frame from the floor...",
                                                              $"{interaction.Performer.ExpensiveName()} starts unwrenching the turret frame from the floor...",
                                                              "You unwrench the turret frame from the floor.",
                                                              $"{interaction.Performer.ExpensiveName()} unwrenches the turret frame from the floor.",
                                                              () =>
                    {
                        objectBehaviour.ServerSetAnchored(false, interaction.Performer);

                        stateful.ServerChangeState(initialState);
                    });
                }

                return;
            }

            //Wrench or remove metal
            if (CurrentState == metalAddedState)
            {
                if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.Wrench))
                {
                    //Wrench
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                              "You start wrenching the bolts on the turret frame...",
                                                              $"{interaction.Performer.ExpensiveName()} starts wrenching the bolts on the turret frame...",
                                                              "You wrench the bolts on the turret frame.",
                                                              $"{interaction.Performer.ExpensiveName()} wrenches the bolts on the turret frame.",
                                                              () =>
                    {
                        stateful.ServerChangeState(wrenchState);
                    });
                }
                else if (Validations.HasUsedActiveWelder(interaction))
                {
                    //Remove metal
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                              "You start removing the metal cover from the turret frame...",
                                                              $"{interaction.Performer.ExpensiveName()} starts removing the metal cover from the turret frame...",
                                                              "You remove the metal cover from the turret frame.",
                                                              $"{interaction.Performer.ExpensiveName()} removes the metal cover from the turret frame.",
                                                              () =>
                    {
                        Spawn.ServerPrefab(CommonPrefabs.Instance.Metal, SpawnDestination.At(gameObject), 1);
                        stateful.ServerChangeState(anchoredState);
                    });
                }

                return;
            }

            //Add gun or unwrench
            if (CurrentState == wrenchState)
            {
                if (Validations.HasUsedItemTrait(interaction, gunTrait))
                {
                    //Add energy gun
                    Chat.AddActionMsgToChat(interaction, $"You place the {interaction.UsedObject.ExpensiveName()} inside the turret frame.",
                                            $"{interaction.Performer.ExpensiveName()} places the {interaction.UsedObject.ExpensiveName()} inside the turret frame.");
                    Inventory.ServerTransfer(interaction.HandSlot, gunSlot);
                    stateful.ServerChangeState(gunAddedState);
                }
                else if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.Wrench))
                {
                    //Remove unwrench bolts
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                              "You start removing the bolts from the turret frame...",
                                                              $"{interaction.Performer.ExpensiveName()} starts removing the bolts from the turret frame...",
                                                              "You remove the bolts from the turret frame.",
                                                              $"{interaction.Performer.ExpensiveName()} removes the bolts from the turret frame.",
                                                              () =>
                    {
                        stateful.ServerChangeState(metalAddedState);
                    });
                }

                return;
            }

            //Add prox or remove gun
            if (CurrentState == gunAddedState)
            {
                if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.ProximitySensor))
                {
                    //Add proximity sensor
                    Chat.AddActionMsgToChat(interaction, $"You place the {interaction.UsedObject.ExpensiveName()} inside the turret frame.",
                                            $"{interaction.Performer.ExpensiveName()} places the {interaction.UsedObject.ExpensiveName()} inside the turret frame.");
                    _ = Despawn.ServerSingle(interaction.UsedObject);
                    stateful.ServerChangeState(proxAddedState);
                }
                else if (interaction.HandObject == null)
                {
                    //Remove gun
                    Chat.AddActionMsgToChat(interaction, $"You remove the {gunSlot.ItemObject.ExpensiveName()} from the frame.",
                                            $"{interaction.Performer.ExpensiveName()} removes the {gunSlot.ItemObject.ExpensiveName()} from the frame.");
                    Inventory.ServerDrop(gunSlot);

                    stateful.ServerChangeState(wrenchState);
                }

                return;
            }

            //Screw or remove prox
            if (CurrentState == proxAddedState)
            {
                if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.Screwdriver))
                {
                    //Screw
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                              "You start closing the internal hatch of the turret frame...",
                                                              $"{interaction.Performer.ExpensiveName()} starts closing the internal hatch of the turret frame...",
                                                              "You close the internal hatch of the turret frame.",
                                                              $"{interaction.Performer.ExpensiveName()} closes the internal hatch of the turret frame.",
                                                              () =>
                    {
                        stateful.ServerChangeState(screwState);
                    });
                }
                else if (interaction.HandObject == null)
                {
                    //Remove prox
                    Chat.AddActionMsgToChat(interaction, $"You remove the {gunSlot.ItemObject.ExpensiveName()} from the frame.",
                                            $"{interaction.Performer.ExpensiveName()} removes the {gunSlot.ItemObject.ExpensiveName()} from the frame.");
                    Spawn.ServerPrefab(proximityPrefab, objectBehaviour.registerTile.WorldPosition, transform.parent);

                    stateful.ServerChangeState(gunAddedState);
                }

                return;
            }

            //Add metal or unscrew
            if (CurrentState == screwState)
            {
                if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.MetalSheet))
                {
                    //Add metal
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                              "You start adding a metal cover to the turret frame...",
                                                              $"{interaction.Performer.ExpensiveName()} starts adding a metal cover to the turret frame...",
                                                              "You add a metal cover to the turret frame.",
                                                              $"{interaction.Performer.ExpensiveName()} adds a metal cover to the turret frame.",
                                                              () =>
                    {
                        Inventory.ServerConsume(interaction.HandSlot, 1);
                        stateful.ServerChangeState(secondMetalAddedState);
                    });
                }
                else if (Validations.HasUsedItemTrait(interaction, CommonTraits.Instance.Screwdriver))
                {
                    //Unscrew
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                              "You start removing the bolts from the turret frame...",
                                                              $"{interaction.Performer.ExpensiveName()} starts removing the bolts from the turret frame...",
                                                              "You remove the bolts from the turret frame.",
                                                              $"{interaction.Performer.ExpensiveName()} removes the bolts from the turret frame.",
                                                              () =>
                    {
                        stateful.ServerChangeState(proxAddedState);
                    });
                }

                return;
            }

            //Finish construction, or remove metal
            if (CurrentState == secondMetalAddedState)
            {
                if (Validations.HasUsedActiveWelder(interaction))
                {
                    //Weld to finish turret
                    ToolUtils.ServerUseToolWithActionMessages(interaction, 2f,
                                                              "You start welding the outer metal cover to the turret frame...",
                                                              $"{interaction.Performer.ExpensiveName()} starts welding the outer metal cover to the turret frame...",
                                                              "You weld the outer metal cover to the turret frame.",
                                                              $"{interaction.Performer.ExpensiveName()} welds the outer metal cover to the turret frame.",
                                                              () =>
                    {
                        var spawnedTurret = Spawn.ServerPrefab(turretPrefab, objectBehaviour.registerTile.WorldPosition, transform.parent);

                        if (spawnedTurret.Successful && spawnedTurret.GameObject.TryGetComponent <Turret>(out var turret))
                        {
                            turret.SetUpTurret(gunSlot.Item.GetComponent <Gun>(), gunSlot);
                        }

                        _ = Despawn.ServerSingle(gameObject);
                    });
Example #46
0
 void Start()
 {
     timeLeft = Random.Range(0, 1000);
     inv      = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory>();
     rend     = GetComponent <Renderer>();
 }
Example #47
0
 /// <summary>
 /// Инициализация
 /// </summary>
 private void Start()
 {
     player    = GameObject.FindGameObjectWithTag("Player");
     inventory = player.GetComponent <Inventory>();
 }
 private void Awake()
 {
     Inventory = GetComponent <Inventory>();
     _mover    = GetComponent <Mover>();
 }
Example #49
0
 public WoWItem Mount()
 {
     return(Inventory.GetItem(mountNames.Where(x => Inventory.GetItemCount(x) > 0).FirstOrDefault()));
 }
Example #50
0
 private void Start()
 {
     inventory = FindObjectOfType <Inventory>();
 }
Example #51
0
 private void Start()
 {
     inventory = GameObject.FindGameObjectWithTag("Player").GetComponent <Inventory>();
     player    = inventory.GetComponent <PlayerMovement>();
     instaFood = GameObject.FindGameObjectWithTag("GameController").GetComponent <InstantiateFood>();
 }
Example #52
0
 // Meant to be overwritten by any station customer can interact with as
 // each station has their own unique interactions
 public virtual void Interact(Inventory playerInventory)
 {
 }
Example #53
0
 void Start()
 {
     inventory     = TagResolver.i.inventory;
     itemSlot      = GetComponent <ItemSlot>();
     rectTransform = GetComponent <RectTransform>();
 }
Example #54
0
 public ConsumablesModule(Inventory inventory, ObjectManager objectManager)
 {
     Inventory     = inventory;
     ObjectManager = objectManager;
 }
Example #55
0
 protected override void Start()
 {
     base.Start();
     inventory = Inventory.instance;
 }
    /*public override void HandleItem(UnderItem item) {
     *  //if (!CustomItemHandler(item))
     *  //item.inCombatUse();
     *  Inventory.UseItem(item.Name);
     * }*/

    public void HandleItem(int ID)
    {
        //item.inCombatUse();
        Inventory.UseItem(ID);
    }
Example #57
0
    void ReadInventoryInfo()
    {
        string infoTxt = inventoryInfo.ToString();

        string[] strArray = infoTxt.Split('\n');///每一行数据的数组
        foreach (string str in strArray)
        {
            string[] infoArray = str.Split('|');
            //ID 名称 图标 类型(Equip,Drug) 装备类型(Helm, Cloth, Weapon, Shoes, Necklace, Bracelet, Ring, Wing) 售价 星级 品质 伤害 生命 战斗力 作用类型 作用值 描述
            Inventory inventory = new Inventory();
            inventory.ID   = int.Parse(infoArray[0]);
            inventory.Name = infoArray[1];
            inventory.ICON = infoArray[2];
            switch (infoArray[3])
            {
            case "Equip":
                inventory.InventoryType = InventoryType.Equip;
                break;

            case "Drug":
                inventory.InventoryType = InventoryType.Drug;
                break;

            case "Box":
                inventory.InventoryType = InventoryType.Box;
                break;
            }
            inventory.Price = int.Parse(infoArray[5]);
            if (inventory.InventoryType == InventoryType.Equip)
            {
                switch (infoArray[4])
                {
                case "Helm":
                    inventory.EquipType = EquipType.Helm;
                    break;

                case "Cloth":
                    inventory.EquipType = EquipType.Cloth;
                    break;

                case "Weapon":
                    inventory.EquipType = EquipType.Weapon;
                    break;

                case "Shoes":
                    inventory.EquipType = EquipType.Shoes;
                    break;

                case "Necklace":
                    inventory.EquipType = EquipType.Necklace;
                    break;

                case "Bracelet":
                    inventory.EquipType = EquipType.Bracelet;
                    break;

                case "Ring":
                    inventory.EquipType = EquipType.Ring;
                    break;

                case "Wing":
                    inventory.EquipType = EquipType.Wings;
                    break;
                }
                inventory.StarLevel = int.Parse(infoArray[6]);
                inventory.Quality   = int.Parse(infoArray[7]);
                inventory.Damage    = int.Parse(infoArray[8]);
                inventory.HP        = int.Parse(infoArray[9]);
                inventory.Power     = int.Parse(infoArray[10]);
            }
            if (inventory.InventoryType == InventoryType.Drug)
            {
                switch (infoArray[11])
                {
                case "Energy":
                    inventory.InfoType = InfoType.Energy;
                    break;

                case "Toughen":
                    inventory.InfoType = InfoType.Toughen;
                    break;
                }
                inventory.ApplyValue = int.Parse(infoArray[12]);
            }
            inventory.DES = infoArray[13];
            inventoryDict.Add(inventory.ID, inventory);
        }
    }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     _inventory = InventoryManager.DeserializeInventory();
     SetItemsSource();
     memosPaths = InventoryManager.GetMemosPaths();
 }
Example #59
0
        public AvatarState(Address address,
                           Address agentAddress,
                           long blockIndex,
                           AvatarSheets avatarSheets,
                           GameConfigState gameConfigState,
                           Address rankingMapAddress,
                           string name = null) : base(address)
        {
            if (address == null)
            {
                throw new ArgumentNullException(nameof(address));
            }

            this.name         = name ?? string.Empty;
            characterId       = GameConfig.DefaultAvatarCharacterId;
            level             = 1;
            exp               = 0;
            inventory         = new Inventory();
            worldInformation  = new WorldInformation(blockIndex, avatarSheets.WorldSheet, GameConfig.IsEditor);
            updatedAt         = blockIndex;
            this.agentAddress = agentAddress;
            questList         = new QuestList(
                avatarSheets.QuestSheet,
                avatarSheets.QuestRewardSheet,
                avatarSheets.QuestItemRewardSheet,
                avatarSheets.EquipmentItemRecipeSheet,
                avatarSheets.EquipmentItemSubRecipeSheet
                );
            mailBox         = new MailBox();
            this.blockIndex = blockIndex;
            actionPoint     = gameConfigState.ActionPointMax;
            stageMap        = new CollectionMap();
            monsterMap      = new CollectionMap();
            itemMap         = new CollectionMap();
            const QuestEventType createEvent = QuestEventType.Create;
            const QuestEventType levelEvent  = QuestEventType.Level;

            eventMap = new CollectionMap
            {
                new KeyValuePair <int, int>((int)createEvent, 1),
                new KeyValuePair <int, int>((int)levelEvent, level),
            };
            combinationSlotAddresses = new List <Address>(CombinationSlotCapacity);
            for (var i = 0; i < CombinationSlotCapacity; i++)
            {
                var slotAddress = address.Derive(
                    string.Format(
                        CultureInfo.InvariantCulture,
                        CombinationSlotState.DeriveFormat,
                        i
                        )
                    );
                combinationSlotAddresses.Add(slotAddress);
            }

            combinationSlotAddresses = combinationSlotAddresses
                                       .OrderBy(element => element)
                                       .ToList();

            RankingMapAddress = rankingMapAddress;
            UpdateGeneralQuest(new[] { createEvent, levelEvent });
            UpdateCompletedQuest();

            PostConstructor();
        }
        public void OnAuthorize(uint id, string name, string displayname, byte _accessLevel)
        {
            this.ID          = id;
            this.Name        = name;
            this.Displayname = displayname;
            this.AccessLevel = _accessLevel;

            // LOAD PLAYER INFORMATION //
            if (!Load())
            {
                Send(new Packets.Authorization(Packets.Authorization.ErrorCodes.BadSynchronization));
                return;
            }

            // LOAD INVENTORY //
            Inventory = new Inventory(this);
            Inventory.Load();

            this.Authorized   = true;
            this.RoomListPage = 0;

            // Send the packet back //
            Send(new Packets.Authorization(this));
            SendPing();

            if (Inventory.ExpiredItems.Count > 0)
            {
                this.Send(new Packets.UpdateInventory(this));
                Inventory.ExpiredItems.Clear();
            }

            // Creating session //
            Databases.Game.AsyncQuery(string.Concat("INSERT INTO sessions (`userid`, `sessionid`, `expired`, `session_start`, `server`) VALUES ('", ID, "', '", SessionID, "', '0', '", System.DateTime.Now.ToString("yyyyMMddHHmmss"), "', '", Game.Config.SERVER_NAME, "');"));

            //Updating the userlist
            this.UserListPage = 0;

            ArrayList UserList = new ArrayList();

            foreach (Entities.User User in Managers.UserManager.Instance.Sessions.Values)
            {
                UserList.Add(User);
            }


            foreach (Entities.User InLobby in UserList)
            {
                if (InLobby.Room == null)
                {
                    InLobby.Send(new Packets.UserList(InLobby.UserListPage, UserList));
                }
            }

            //   string _welcomeMessage1 = Cristina.Core.Cristina.Localization.GetLocMessageFrom("PLAYER_WELCOME");
            // string _welcomeMessage2 = Cristina.Core.Cristina.Localization.GetLocMessageFrom("CRISTINA_VERSION");

            //   if (_welcomeMessage1.Contains("%/nickname/%"))
            //    _welcomeMessage1 = _welcomeMessage1.Replace("%/nickname/%", Displayname);

            //   if (_welcomeMessage2.Contains("%/version/%"))
            //    _welcomeMessage2 = _welcomeMessage2.Replace("%/version/%", Cristina.Core.Cristina.Version.ToString());

            Cristina.Core.Cristina.Chat.SayToPlayer("Hola " + Displayname + ", soy el asistente personal del servidor", this);
            Cristina.Core.Cristina.Chat.SayToPlayer("Mi version es la 0.4", this);

            //Logging
            ServerLogger.Instance.Append(ServerLogger.AlertLevel.Information, String.Format("The player {0} logged on", Displayname));
        }