void Awake() { // Setting up the references. player = GameObject.FindGameObjectWithTag("Player"); playerInventory = player.GetComponent<PlayerInventory>(); anim = GetComponent<Animator> (); }
private void Update() { if (LocalPlayer.AnimControl.onRope) { this.Sheen.SetActive(true); this.MyPickUp.SetActive(false); base.enabled = false; return; } if (!this.Sitting) { if (TheForest.Utils.Input.GetButtonDown("Take")) { this.Sitting = true; this.Player.SpecialActions.SendMessage("SitOnBench", base.transform); this.Sheen.SetActive(false); this.MyPickUp.SetActive(false); } } else if (TheForest.Utils.Input.GetButtonDown("Take") || TheForest.Utils.Input.GetButtonDown("Crouch") || TheForest.Utils.Input.GetButtonDown("Jump") || TheForest.Utils.Input.GetButtonDown("Vertical")) { this.Player.SpecialActions.SendMessage("UpFromBench"); this.Sitting = false; this.Player = null; base.enabled = false; } }
// Use this for initialization void Start() { inventoryButtonImage = GameObject.Find("Inventory Button").GetComponent<Image>(); buttonTargetColor = Color.white; inventoryInfoTransform = transform.GetComponent<RectTransform>(); pInventory = GameObject.Find ("Inventory Manager").GetComponent<PlayerInventory> (); hiddenPos = inventoryInfoTransform.position; visiblePos = inventoryInfoTransform.position + new Vector3(340,0,0); inventoryInfoTransform.position = hiddenPos; upgradeButton = transform.Find("Upgrade Button").gameObject; currentInventory = pInventory.inventorySize; activeColor = Color.white; inactiveColor = new Color(1,1,1,0.1f); nextUpgradeColorVisible = new Color(0,1,0,1); nextUpgradeColorTransparent = new Color(0,1,0,0.05f); inventoryImages = new RawImage[6]; inventoryImages[0] = transform.Find("Current Inventory").Find("Inventory Bar").Find("Inventory 1").GetComponent<RawImage>(); inventoryImages[1] = transform.Find("Current Inventory").Find("Inventory Bar").Find("Inventory 2").GetComponent<RawImage>(); inventoryImages[2] = transform.Find("Current Inventory").Find("Inventory Bar").Find("Inventory 3").GetComponent<RawImage>(); inventoryImages[3] = transform.Find("Current Inventory").Find("Inventory Bar").Find("Inventory 4").GetComponent<RawImage>(); inventoryImages[4] = transform.Find("Current Inventory").Find("Inventory Bar").Find("Inventory 5").GetComponent<RawImage>(); inventoryImages[5] = transform.Find("Current Inventory").Find("Inventory Bar").Find("Inventory 6").GetComponent<RawImage>(); ClearInventory(); }
void OnTriggerEnter(Collider other) { // If the triggering gameobject is the player... if (other.gameObject.tag == "Player")//only check if tag is player { playerInventory = other.gameObject.GetComponent<PlayerInventory>(); // ... if this door requires a key... if (isLocked) { // ... if the player has the key... if (playerInventory.HasKey(id)) { // ... increase the count of triggering objects. count++; //play door unlocked audio AudioSource unlockAudio = GameObject.FindGameObjectWithTag("UnlockDoorAudio").GetComponent<AudioSource>(); unlockAudio.Play(); } } else { // If the door doesn't require a key, increase the count of triggering objects. count++; } } else if (other.gameObject.tag == "Enemy") { // If its people in the house they can open door if (other is CapsuleCollider)//Temporary fix for large collider opening doors { count++; } } }
// Use this for initialization void Start() { m_spriteRenderer = GetComponent<SpriteRenderer>(); m_player = GameObject.FindGameObjectWithTag("Player"); m_inventory = m_player.GetComponent<PlayerInventory>(); m_boxcollider = GetComponent<BoxCollider2D>(); }
void Awake() { iTween.FadeTo(GameObject.Find("Fader"), iTween.Hash("alpha", 0, "time", .5)); dockManager = GameObject.FindGameObjectWithTag("DockManager").GetComponent<DockManager>(); playerInv = GameObject.Find("DockedShip").GetComponent<PlayerInventory>(); }
void Awake() { itemIcon = gameObject.transform.GetChild (0).GetComponent<Image> (); inventory = GameObject.FindGameObjectWithTag ("UI").transform.GetChild (1).GetComponent<PlayerInventory> (); manager = GameObject.FindGameObjectWithTag ("UI").GetComponent<UIManager> (); itemInformation = GameObject.FindGameObjectWithTag ("UI").transform.GetChild (1).GetChild (0).GetComponent<ItemInformation> (); }
void Awake() { anim = GetComponent<Animator>(); hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>(); player = GameObject.FindGameObjectWithTag(Tags.player); inventory = player.GetComponent<PlayerInventory>(); }
void OnTriggerEnter (Collider other) { if(other.gameObject == player1) { playerInventory = player1.GetComponent<PlayerInventory>(); playerInventory.hasKey = true; Destroy(gameObject); } if(other.gameObject == player2) { playerInventory = player2.GetComponent<PlayerInventory>(); playerInventory.hasKey = true; Destroy(gameObject); } if(other.gameObject == player3) { playerInventory = player3.GetComponent<PlayerInventory>(); playerInventory.hasKey = true; Destroy(gameObject); } }
// Use this for initialization void Start() { anim = endLevelPanel.GetComponent<Animator>(); anim.enabled = false; player = GameObject.FindGameObjectWithTag("Player"); playerInventory = player.GetComponent<PlayerInventory>(); }
public static PlayerInventory GetPlayerInventory() { if (instance == null) { return instance = new PlayerInventory(); } return instance; }
private void GrabEnter(GameObject grabber) { if (this.Player == null) { this.Player = grabber.transform.root.gameObject.GetComponent<PlayerInventory>(); base.enabled = true; } }
private PlayerInventory playerInventory; // Reference to the PlayerInventory script. #endregion Fields #region Methods void Awake() { // Setting up the references. anim = GetComponent<Animator>(); hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>(); player = GameObject.FindGameObjectWithTag(Tags.player); playerInventory = player.GetComponent<PlayerInventory>(); }
// Use this for initialization void Start() { _playerInventory = GetComponent<PlayerInventory> ();//Use GetComponent to get the PlayerInventory component from the player object _resources = _playerInventory.PlayerResources;//Put the recources from the PlayerInventory component in the recourses variable in this component //Be aware that this needs to be updated incase the player pick's up a new recourse print("Resources required to make a torch : " + "Wood: "+ _craftables.Torch.wood + " Stones: " + _craftables.Torch.stones); print("Resources required to make a fur coat" + _craftables.FurCoat.fur); }
public override void Give(PlayerInventory inventory) { inventory.Keys.Add(new Key {Name = KeyName, Code = KeyCode}); GameManager.Current.ShowMessage(string.Format("<color=#ffffffff>{0}</color> collected.", KeyName), 3f); if (PickupSound != null) AudioSource.PlayClipAtPoint(PickupSound, transform.position, 1f); Destroy(gameObject); }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); inven = player.GetComponent<PlayerInventory> (); self = GetComponent<MeshRenderer>(); selfRenderer = self; self.enabled = false; }
void Awake() { playerInventory = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerInventory>(); energy = GameObject.FindGameObjectsWithTag("Energy"); totalEnergy = energy.Length; neededEnergy = Mathf.RoundToInt (totalEnergy * difficultyPercentage); anim = GameObject.Find("HUDCanvas").GetComponent<Animator>(); }
void Awake() { anim = GetComponent<Animator> (); hash = GameObject.FindWithTag (Tags.GameController).GetComponent<HashIDs> (); player = GameObject.Find ("player"); playerInventory = player.GetComponent<PlayerInventory> (); open = false; }
private PlayerInventory playerInventory; // Reference to the PlayerInventory script. #endregion Fields #region Methods void Awake() { // Setting up the references. isDoorOpen = false; hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>(); player = GameObject.FindGameObjectWithTag(Tags.player); playerInventory = player.GetComponent<PlayerInventory>(); doorOpenClip = audio.clip; }
void Awake() { // Set up the references. player = GameObject.FindGameObjectWithTag ("Player").transform; nav = GetComponent <NavMeshAgent> (); motherShip = GameObject.Find("MotherShip").GetComponent<MotherShip>(); playerInventory = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerInventory>(); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag ("Player"); mSystem = player.GetComponent<MoneySystem> (); collider = GetComponent<Collider> (); p = player.GetComponent<PlayerInventory> (); currentHP = startingHP; }
void Start() { Inventory = this; //create initial inventory TurretInventory = new List<Turret>[8]{laserTurrets,ionTurrets,railTurrets,chargeBeamTurrets,drainBeamTurrets,fireMissileTurrets,ballisticMissileTurrets,aoeMissileTurrets}; createInventory(Turret.TurretType.Laser); createInventory(Turret.TurretType.Laser); }
// Use this for initialization void Awake() { weaponType = WeaponType.Utility; line = GetComponent<LineRenderer>(); line.SetWidth(lineWidth, lineWidth); line.SetColors(beamColor, beamColor); laserImpactEffect.Stop(); playerInventory = GameObject.FindGameObjectWithTag("PlayerShip").GetComponent<PlayerInventory>(); length = Mathf.RoundToInt(range); }
void Awake() { thisTransform = GetComponent<Transform>(); rb = GetComponent<Rigidbody>(); rb.maxAngularVelocity = 1000; playerCamera = cam.GetComponent<Camera>(); playerInventory = GetComponent<PlayerInventory>(); canvas = thisTransform.FindChild("Canvas").GetComponent<Canvas>(); anim = GetComponentInChildren<Animator>(); }
private void GrabEnter(GameObject grabber) { if (!LocalPlayer.AnimControl.onRope) { base.enabled = true; this.Player = grabber.transform.root.GetComponent<PlayerInventory>(); this.Sheen.SetActive(false); this.MyPickUp.SetActive(true); } }
public override void Give(PlayerInventory inventory) { if (PickupSound != null) { AudioSource.PlayClipAtPoint(PickupSound, transform.position, 1f); } inventory.Money += Amount; GameManager.Current.ShowMessage(string.Format("+<color=#ffff44ff>${0}</color>", Amount), 2f); HeadsUpDisplay.Current.MoneyPop(); Destroy(gameObject); }
void Awake () { anim = GetComponent<Animator>(); hash = GameObject.FindWithTag (Tags.gameController).GetComponent<HashIDs>(); player = GameObject.FindWithTag (Tags.player); playerInventory = player.GetComponent<PlayerInventory>(); audioSource = GetComponent<AudioSource>(); count = 0; }
//player data load success callback private void OnLoadSuccess() { EventsAggregator.Network.RemoveListener(ENetworkEvent.PlayerDataLoadSuccess, OnLoadSuccess); //TODO: assign correct values Resources = new PlayerResources(10, 2500, 100); Inventory = new PlayerInventory(); Heroes = new PlayerHeroes(new BaseHero[] { new BaseHero(UnitsConfig.Instance.GetHeroData(EUnitKey.Hero_Sniper), 0) }, 0); HeroSkills = new PlayerHeroSkills(); City = new PlayerCity(); StoryProgress = new PlayerStoryProgress(); Statistics = new PlayerStatistics(); VIPStatus = EPlayerVIP.None; }
void Start() { TheInventory = gameObject.GetComponent<InventoryGUI>(); TheTextures = gameObject.GetComponent<PlayerInventory>(); loadingScript = gameObject.GetComponent<LoadingScreen>(); for(int i= 0; i <PlayerInventory.itemPlayersAmount.Length; i++) // for loop die checkt hoeveel items er in playersAmount zit. { if (PlayerInventory.itemPlayersAmount[i] > 0) // kijken of een item uberhaupt een aantal heeft { TheInventory.Grids[i].image = TheTextures.itemTexture[i]; // zorgt ervoor dat de juiste image bij de correcte ID komt. } } }
public override void Give(PlayerInventory inventory) { if (!inventory.Ammunition.ContainsKey(Type)) inventory.Ammunition.Add(Type, 0); if (inventory.Ammunition[Type] < inventory.MaxAmmunition[Type]) { inventory.Ammunition[Type] = Utility.UpperClamp(inventory.Ammunition[Type] + Amount, inventory.MaxAmmunition[Type]); if (PickupSound != null) AudioSource.PlayClipAtPoint(PickupSound, transform.position, 1f); TriggerGiveAnimate(collector.transform); //Destroy(gameObject); } //Debug.Break(); }
void Awake() { _playerInventory = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>(); }
/// <summary> /// Checks whether the given inventory satisfies this Spell's item restrictions /// </summary> public SpellFailedReason CheckItemRestrictions(PlayerInventory inv) { return(CheckItemRestrictionsWithout(inv, null)); }
void Awake() { GameObject go = GameObject.FindGameObjectWithTag("Player"); Inventory = go.GetComponent <PlayerInventory> (); }
public override void Release(Level world, Player player, BlockCoordinates blockCoordinates) { long timeUsed = world.TickTime - _useTime; if (timeUsed < 6) // questionable, but we go with it for now. { player.SendPlayerInventory(); // Need to reset inventory, because we don't know what the client did here return; } PlayerInventory inventory = player.Inventory; bool isInfinity = this.GetEnchantingLevel(EnchantingType.Infinity) > 0; bool haveArrow = player.GameMode == GameMode.Creative; if (!haveArrow) { // Try off-hand first Item item = inventory.OffHand; if (item.Id == 262) { haveArrow = true; if (!isInfinity) { item.Count -= 1; item.UniqueId = Environment.TickCount & Int32.MaxValue; if (item.Count <= 0) { inventory.OffHand = new ItemAir(); } player.SendPlayerInventory(); } } } if (!haveArrow) { //TODO: Consume arrows properly //TODO: Make sure we deal with arrows based on "potions" for (byte i = 0; i < inventory.Slots.Count; i++) { Item itemStack = inventory.Slots[i]; if (itemStack.Id == 262) { haveArrow = true; if (isInfinity) { inventory.RemoveItems(262, 1); } break; } } } if (!haveArrow) { return; } float force = CalculateForce(timeUsed); if (force < 0.1D) { return; } var arrow = new Arrow(player, world, 2, !(force < 1.0)); arrow.PowerLevel = this.GetEnchantingLevel(EnchantingType.Power); arrow.KnownPosition = (PlayerLocation)player.KnownPosition.Clone(); arrow.KnownPosition.Y += 1.62f; arrow.Velocity = arrow.KnownPosition.GetHeadDirection().Normalize() * (force * 3); arrow.KnownPosition.Yaw = (float)arrow.Velocity.GetYaw(); arrow.KnownPosition.Pitch = (float)arrow.Velocity.GetPitch(); arrow.BroadcastMovement = true; arrow.DespawnOnImpact = false; arrow.SpawnEntity(); player.Inventory.DamageItemInHand(ItemDamageReason.ItemUse, player, null); }
void Awake() { instance = this; }
// Start is called before the first frame update void Start() { chatPanel.SetActive(false); playerInv = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>(); }
// Start is called before the first frame update void Start() { instance = this; }
// Update is called once per frame void Update() { // Setting up the references. //get the game object inventory = GameObject.FindGameObjectWithTag("PlayerInventory"); //get script attached to game object playerInventory = inventory.GetComponent <PlayerInventory>(); clicky = this.gameObject; wasclick = clicky.GetComponent <WorldButtonInteraction>(); if (wasclick.clicked) { if (this.gameObject.name == "Chest") { playerInventory.hasSword = true; playerInventory.itemlistSwordName = "Blade of Absurdity"; playerInventory.itemlistSwordStrength = playerInventory.baseWeaponATK + 1; playerInventory.itemlistSwordAgil = playerInventory.baseWeaponAGI + 1; playerInventory.itemlistSwordIntel = playerInventory.baseWeaponINT + 1; playerInventory.itemlistSwordLuck = playerInventory.baseWeaponLUC + 0; } else if (clicky.tag == "Sword") { playerInventory.getSword(); Debug.Log(clicky.GetComponent <Sword>().itemName); playerInventory.itemlistSwordName = clicky.GetComponent <Sword>().itemName; playerInventory.itemlistSwordStrength = playerInventory.baseWeaponATK + clicky.GetComponent <Sword>().str; playerInventory.itemlistSwordAgil = playerInventory.baseWeaponAGI + clicky.GetComponent <Sword>().agil; playerInventory.itemlistSwordIntel = playerInventory.baseWeaponINT + clicky.GetComponent <Sword>().intel; playerInventory.itemlistSwordLuck = playerInventory.baseWeaponLUC + clicky.GetComponent <Sword>().luc; //set other stats to 0 playerInventory.itemlistBowStrength = 0; playerInventory.itemlistBowAgil = 0; playerInventory.itemlistBowIntel = 0; playerInventory.itemlistBowLuck = 0; playerInventory.itemlistStaffStrength = 0; playerInventory.itemlistStaffAgil = 0; playerInventory.itemlistStaffIntel = 0; playerInventory.itemlistStaffLuck = 0; Destroy(this.gameObject); } else if (clicky.tag == "Armor") { playerInventory.getArmor(); Debug.Log(clicky.GetComponent <Armor>().itemName); playerInventory.itemlistArmorName = clicky.GetComponent <Armor>().itemName; playerInventory.itemlistArmorStrength = playerInventory.baseArmorATK + clicky.GetComponent <Armor>().str; playerInventory.itemlistArmorAgil = playerInventory.baseArmorAGI + clicky.GetComponent <Armor>().agil; playerInventory.itemlistArmorIntel = playerInventory.baseArmorINT + clicky.GetComponent <Armor>().intel; playerInventory.itemlistArmorLuck = playerInventory.baseArmorLUC + clicky.GetComponent <Armor>().luc; Destroy(this.gameObject); } else if (clicky.tag == "Helm") { playerInventory.getHelm(); Debug.Log(clicky.GetComponent <Helm>().itemName); playerInventory.itemlistHelmName = clicky.GetComponent <Helm>().itemName; playerInventory.itemlistHelmStrength = playerInventory.baseHelmATK + clicky.GetComponent <Helm>().str; playerInventory.itemlistHelmAgil = playerInventory.baseHelmAGI + clicky.GetComponent <Helm>().agil; playerInventory.itemlistHelmIntel = playerInventory.baseHelmINT + clicky.GetComponent <Helm>().intel; playerInventory.itemlistHelmLuck = playerInventory.baseHelmLUC + clicky.GetComponent <Helm>().luc; Destroy(this.gameObject); } else if (clicky.tag == "Bow") { playerInventory.getBow(); Debug.Log(clicky.GetComponent <Bow>().itemName); playerInventory.itemlistBowName = clicky.GetComponent <Bow>().itemName; playerInventory.itemlistBowStrength = playerInventory.baseWeaponATK + clicky.GetComponent <Bow>().str; playerInventory.itemlistBowAgil = playerInventory.baseWeaponAGI + clicky.GetComponent <Bow>().agil; playerInventory.itemlistBowIntel = playerInventory.baseWeaponINT + clicky.GetComponent <Bow>().intel; playerInventory.itemlistBowLuck = playerInventory.baseWeaponLUC + clicky.GetComponent <Bow>().luc; //set other stats to 0 playerInventory.itemlistStaffStrength = 0; playerInventory.itemlistStaffAgil = 0; playerInventory.itemlistStaffIntel = 0; playerInventory.itemlistStaffLuck = 0; playerInventory.itemlistSwordStrength = 0; playerInventory.itemlistSwordAgil = 0; playerInventory.itemlistSwordIntel = 0; playerInventory.itemlistSwordLuck = 0; Destroy(this.gameObject); } else if (clicky.tag == "Staff") { playerInventory.getStaff(); Debug.Log(clicky.GetComponent <Staff>().itemName); playerInventory.itemlistStaffName = clicky.GetComponent <Staff>().itemName; playerInventory.itemlistStaffStrength = playerInventory.baseWeaponATK + clicky.GetComponent <Staff>().str; playerInventory.itemlistStaffAgil = playerInventory.baseWeaponAGI + clicky.GetComponent <Staff>().agil; playerInventory.itemlistStaffIntel = playerInventory.baseWeaponINT + clicky.GetComponent <Staff>().intel; playerInventory.itemlistStaffLuck = playerInventory.baseWeaponLUC + clicky.GetComponent <Staff>().luc; //set other items to 0 stats playerInventory.itemlistBowStrength = 0; playerInventory.itemlistBowAgil = 0; playerInventory.itemlistBowIntel = 0; playerInventory.itemlistBowLuck = 0; playerInventory.itemlistSwordStrength = 0; playerInventory.itemlistSwordAgil = 0; playerInventory.itemlistSwordIntel = 0; playerInventory.itemlistSwordLuck = 0; Destroy(this.gameObject); } else if (clicky.tag == "Potion") { Destroy(this.gameObject); playerInventory.currentHP = playerInventory.fullHP; } else { Debug.Log("tag not found"); } } playerInventory.currentATK = playerInventory.itemlistBowStrength + playerInventory.itemlistSwordStrength + playerInventory.itemlistStaffStrength + playerInventory.itemlistArmorStrength + playerInventory.itemlistHelmStrength; playerInventory.currentAGI = playerInventory.itemlistStaffAgil + playerInventory.itemlistBowAgil + playerInventory.itemlistSwordAgil + playerInventory.itemlistArmorAgil + playerInventory.itemlistHelmAgil; playerInventory.currentINT = playerInventory.itemlistStaffIntel + playerInventory.itemlistBowIntel + playerInventory.itemlistSwordIntel + playerInventory.itemlistArmorIntel + playerInventory.itemlistHelmIntel; playerInventory.currentLUC = playerInventory.itemlistStaffLuck + playerInventory.itemlistBowLuck + playerInventory.itemlistSwordLuck + playerInventory.itemlistArmorLuck + playerInventory.itemlistHelmLuck; }
/// <summary> /// /// </summary> /// <param name="client"></param> /// <param name="packet"></param> /// <returns></returns> public int HandlePacket(GameClient client, GSPacketIn packet) { //int i; //eBageType bagType; //int place; //ItemInfo info; bool isBind; int mustGold; bool result; ItemTemplateInfo rewardItem; StringBuilder str = new StringBuilder(); int opertionType = packet.ReadByte(); //int count = packet.ReadInt(); int MinValid = int.MaxValue; List <ItemInfo> items = new List <ItemInfo>(); List <ItemInfo> appendItems = new List <ItemInfo>(); List <eBageType> bagTypes = new List <eBageType>(); if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked) { client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0])); return(1); } for (int i = 0; i < 4; i++) { //bagType = (eBageType) packet.ReadByte(); //place = packet.ReadInt(); ItemInfo info = client.Player.GetItemAt(eBageType.Store, i); if (info != null) { if (items.Contains(info)) { client.Out.SendMessage(eMessageType.Normal, "Bad Input 1"); return(1); } str.Append(string.Concat(info.ItemID, ":", info.TemplateID, ",")); items.Add(info); bagTypes.Add(eBageType.Store); if ((info.ValidDate < MinValid) && (info.ValidDate != 0)) { MinValid = info.ValidDate; } } } if (MinValid == int.MaxValue) { MinValid = 0; items.Clear(); } PlayerInventory storeBag2 = client.Player.StoreBag2; ItemInfo formul = null;// storeBag2.GetItemAt(0); ItemInfo tempitem = null; string beginProperty = null; string AddItem = ""; for (int i = 1; i <= 4; i++) { items.Add(storeBag2.GetItemAt(i)); } /* * using (ItemRecordBussiness db = new ItemRecordBussiness()) * { * foreach (ItemInfo item in items) * { * db.FusionItem(item, ref beginProperty); * } * } */ /*/int appendCount = packet.ReadInt(); * List<eBageType> bagTypesAppend = new List<eBageType>(); * for (int i = 0; i < 4; i++) * { * //bagType = (eBageType) packet.ReadByte(); * //place = packet.ReadInt(); * ItemInfo info = client.Player.GetItemAt(eBageType.Store, i); * if (info != null) * { * if (items.Contains(info) || appendItems.Contains(info)) * { * client.Out.SendMessage(eMessageType.Normal, "Bad Input 2"); * return 1; * } * str.Append(string.Concat(info.ItemID, ":", info.TemplateID, "," )); * appendItems.Add(info); * bagTypesAppend.Add(eBageType.Store); * object objItem = AddItem; * AddItem = string.Concat(objItem, info.ItemID, ":", info.Template.Name, ",", info.IsBinds, "|"); * } * } */ if (opertionType != 0) { storeBag2.ClearBag(); mustGold = 500;// (count + appendCount) * 400; if (client.Player.PlayerCharacter.Gold < mustGold) { client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("ItemFusionHandler.NoMoney")); return(0); } isBind = false; result = false; rewardItem = null; foreach (int formulID in FusionFormulID) { formul = ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(formulID), 1, 105); rewardItem = FusionMgr.Fusion(items, formul, ref isBind, ref result);// appendItems, if (rewardItem != null) { break; } } } else { isBind = false; Dictionary <int, double> previewItemList = null; foreach (int formulID in FusionFormulID) { formul = ItemInfo.CreateFromTemplate(ItemMgr.FindItemTemplate(formulID), 1, 105); previewItemList = FusionMgr.FusionPreview(items, formul, ref isBind);// appendItems, if ((previewItemList != null) && (previewItemList.Count > 0)) { break; } } if ((previewItemList != null) && (previewItemList.Count > 0)) { if (previewItemList.Count != 0) { client.Out.SendFusionPreview(client.Player, previewItemList, isBind, MinValid); } } else { client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemFusionHandler.ItemNotEnough")); } return(0); } if (rewardItem != null) { client.Player.RemoveGold(mustGold); for (int i = 0; i < items.Count; i++) { ItemInfo local1 = items[i]; local1.Count--; client.Player.UpdateItem(items[i]); } formul.Count--; client.Player.UpdateItem(formul); for (int i = 0; i < appendItems.Count; i++) { ItemInfo local2 = appendItems[i]; local2.Count--; client.Player.UpdateItem(appendItems[i]); } if (result) { str.Append(rewardItem.TemplateID + ","); ItemInfo item = ItemInfo.CreateFromTemplate(rewardItem, 1, 105); if (item == null) { return(0); } tempitem = item; item.IsBinds = isBind; item.ValidDate = MinValid; client.Player.OnItemFusion(item.Template.FusionType); client.Out.SendFusionResult(client.Player, result); client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemFusionHandler.Succeed1") + item.Template.Name); if (((item.TemplateID >= 8300) && (item.TemplateID <= 8999)) || ((item.TemplateID >= 9300) && (item.TemplateID <= 9999)) || ((item.TemplateID >= 14300) && (item.TemplateID <= 14999)) || ((item.TemplateID >= 7024) && (item.TemplateID <= 7028)) || ((item.TemplateID >= 14006) && (item.TemplateID <= 14010)) || ((item.TemplateID >= 17000) && (item.TemplateID <= 17010))) { string msg = LanguageMgr.GetTranslation("ItemFusionHandler.Notice", client.Player.PlayerCharacter.NickName, item.Template.Name); GSPacketIn pkg1 = new GSPacketIn((byte)ePackageType.SYS_NOTICE); pkg1.WriteInt(1); pkg1.WriteString(msg); GameServer.Instance.LoginServer.SendPacket(pkg1); GamePlayer[] players = WorldMgr.GetAllPlayers(); foreach (GamePlayer p in players) { p.Out.SendTCP(pkg1); } } if (!client.Player.AddTemplate(item, item.Template.BagType, item.Count)) { str.Append("NoPlace"); client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation(item.GetBagName()) + LanguageMgr.GetTranslation("ItemFusionHandler.NoPlace")); } } else { str.Append("false"); client.Out.SendFusionResult(client.Player, result); client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemFusionHandler.Failed")); } LogMgr.LogItemAdd(client.Player.PlayerCharacter.ID, LogItemType.Fusion, beginProperty, tempitem, AddItem, Convert.ToInt32(result)); client.Player.SaveIntoDatabase(); } else { client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ItemFusionHandler.NoCondition")); } return(0); }
// Start is called before the first frame update void Start() { movement = GetComponent <PlayerCapitalMovement>(); inventory = GetComponent <PlayerInventory>(); animations = GetComponent <CreatureAnimations>(); }
public void Read(BinaryReader reader) { InSession = reader.ReadBoolean(); if (!InSession) { return; } byte bools; int count; if (reader.ReadBoolean()) { ChunkEAudioState audio = new ChunkEAudioState(); audio.Read(reader); Audio = audio.Audio; } if (reader.ReadBoolean()) { RespawnPoint = new Vector2(reader.ReadSingle(), reader.ReadSingle()); } Inventory = new PlayerInventory(); bools = reader.ReadByte(); Inventory.Backpack = UnpackBool(bools, 0); Inventory.DreamDash = UnpackBool(bools, 1); Inventory.NoRefills = UnpackBool(bools, 2); Inventory.Dashes = reader.ReadByte(); Flags = new HashSet <string>(); count = reader.ReadByte(); for (int i = 0; i < count; i++) { Flags.Add(reader.ReadNullTerminatedString()); } LevelFlags = new HashSet <string>(); count = reader.ReadByte(); for (int i = 0; i < count; i++) { LevelFlags.Add(reader.ReadNullTerminatedString()); } Strawberries = new HashSet <EntityID>(); count = reader.ReadByte(); for (int i = 0; i < count; i++) { Strawberries.Add(new EntityID(reader.ReadNullTerminatedString(), reader.ReadInt32())); } DoNotLoad = new HashSet <EntityID>(); count = reader.ReadByte(); for (int i = 0; i < count; i++) { DoNotLoad.Add(new EntityID(reader.ReadNullTerminatedString(), reader.ReadInt32())); } Keys = new HashSet <EntityID>(); count = reader.ReadByte(); for (int i = 0; i < count; i++) { Keys.Add(new EntityID(reader.ReadNullTerminatedString(), reader.ReadInt32())); } Counters = new List <Session.Counter>(); count = reader.ReadByte(); for (int i = 0; i < count; i++) { Counters.Add(new Session.Counter { Key = reader.ReadNullTerminatedString(), Value = reader.ReadInt32() }); } FurthestSeenLevel = reader.ReadNullTerminatedString()?.Nullify(); StartCheckpoint = reader.ReadNullTerminatedString()?.Nullify(); ColorGrade = reader.ReadNullTerminatedString()?.Nullify(); count = reader.ReadByte(); SummitGems = new bool[count]; for (int i = 0; i < count; i++) { if ((i % 8) == 0) { bools = reader.ReadByte(); } SummitGems[i] = UnpackBool(bools, i % 8); } bools = reader.ReadByte(); FirstLevel = UnpackBool(bools, 0); Cassette = UnpackBool(bools, 1); HeartGem = UnpackBool(bools, 2); Dreaming = UnpackBool(bools, 3); GrabbedGolden = UnpackBool(bools, 4); HitCheckpoint = UnpackBool(bools, 5); LightingAlphaAdd = reader.ReadSingle(); BloomBaseAdd = reader.ReadSingle(); DarkRoomAlpha = reader.ReadSingle(); Time = reader.ReadInt64(); CoreMode = (Session.CoreModes)reader.ReadByte(); }
public abstract void AddToPlayerInventory(PlayerInventory pInventory);
public void SendUpdateInventorySlot(PlayerInventory bag, int[] updatedSlots) { throw new NotImplementedException(); }
private void Start() { player = FindObjectOfType <PlayerInventory>().GetComponent <PlayerInventory>(); foods = FindObjectOfType <FoodManager>().GetComponent <FoodManager>(); audioManager = FindObjectOfType <AudioManager>().GetComponent <AudioManager>(); }
private object CanMoveItem(Item item, PlayerInventory inventory, uint targetContainer, int targetSlot) { if (item == null || inventory == null) { return(null); } BasePlayer player = inventory.GetComponent <BasePlayer>(); if (player == null) { return(null); } ItemContainer container = inventory.FindContainer(targetContainer); ItemContainer originalContainer = item.GetRootContainer(); if (container == null || originalContainer == null) { return(null); } Func <object> splitFunc = () => { if (player == null || !HasPermission(player) || !GetEnabled(player)) { return(null); } PlayerOptions playerOptions = allPlayerOptions[player.userID]; if (container == null || originalContainer == null || container == item.GetRootContainer()) { return(null); } BaseOven oven = container.entityOwner as BaseOven; ItemModCookable cookable = item.info.GetComponent <ItemModCookable>(); if (oven == null || cookable == null) { return(null); } int totalSlots = 2 + (oven.allowByproductCreation ? 1 : 0); if (playerOptions.TotalStacks.ContainsKey(oven.ShortPrefabName)) { totalSlots = playerOptions.TotalStacks[oven.ShortPrefabName]; } if (cookable.lowTemp > oven.cookingTemperature || cookable.highTemp < oven.cookingTemperature) { return(null); } MoveSplitItem(item, oven, totalSlots); return(true); }; object returnValue = splitFunc(); if (HasPermission(player) && GetEnabled(player)) { BaseOven oven = container?.entityOwner as BaseOven ?? item.GetRootContainer().entityOwner as BaseOven; if (oven != null && compatibleOvens.Contains(oven.ShortPrefabName)) { if (returnValue is bool && (bool)returnValue) { AutoAddFuel(inventory, oven); } queuedUiUpdates.Push(oven); } } return(returnValue); }
void OnTriggerEnter2D(Collider2D other) { //Top Left if (transform.position.x < 0 && transform.position.y > 0) { if (other.gameObject.name == "Player1") { //sets the player when a player hits the cooking station myPlayerStatusScript = other.gameObject.GetComponent <PlayerStatus>(); myPlayerMovementScript = other.gameObject.GetComponent <PlayerMovement>(); myPlayerInventoryScript = other.gameObject.GetComponent <PlayerInventory>(); //sets the input to correct player input if (other.gameObject.GetComponent <PlayerMovement>().isMac == false) { if (SceneSwitchingScript.isXbox == true) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "Xbox_Button_B_P1"; inputA = "Xbox_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "Xbox_Button_B_P2"; inputA = "Xbox_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "Xbox_Button_B_P3"; inputA = "Xbox_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "Xbox_Button_B_P4"; inputA = "Xbox_Button_A_P4"; } } else if (SceneSwitchingScript.isXbox == false) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "PS4_Button_B_P1"; inputA = "PS4_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "PS4_Button_B_P2"; inputA = "PS4_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "PS4_Button_B_P3"; inputA = "PS4_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "PS4_Button_B_P4"; inputA = "PS4_Button_A_P4"; } } } else if (other.gameObject.GetComponent <PlayerMovement>().isMac == true) { if (SceneSwitchingScript.isXbox == true) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "Xbox_Button_B_P1_MAC"; inputA = "Xbox_Button_A_P1_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "Xbox_Button_B_P2_MAC"; inputA = "Xbox_Button_A_P2_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "Xbox_Button_B_P3_MAC"; inputA = "Xbox_Button_A_P3_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "Xbox_Button_B_P4_MAC"; inputA = "Xbox_Button_A_P4_MAC"; } } else if (SceneSwitchingScript.isXbox == false) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "PS4_Button_B_P1"; inputA = "PS4_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "PS4_Button_B_P2"; inputA = "PS4_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "PS4_Button_B_P3"; inputA = "PS4_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "PS4_Button_B_P4"; inputA = "PS4_Button_A_P4"; } } } } } //Bottom Left if (transform.position.x < 0 && transform.position.y < 0) { if (other.gameObject.name == "Player3") { //sets the player when a player hits the cooking station myPlayerStatusScript = other.gameObject.GetComponent <PlayerStatus>(); myPlayerMovementScript = other.gameObject.GetComponent <PlayerMovement>(); myPlayerInventoryScript = other.gameObject.GetComponent <PlayerInventory>(); //sets the input to correct player input if (other.gameObject.GetComponent <PlayerMovement>().isMac == false) { if (SceneSwitchingScript.isXbox == true) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "Xbox_Button_B_P1"; inputA = "Xbox_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "Xbox_Button_B_P2"; inputA = "Xbox_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "Xbox_Button_B_P3"; inputA = "Xbox_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "Xbox_Button_B_P4"; inputA = "Xbox_Button_A_P4"; } } else if (SceneSwitchingScript.isXbox == false) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "PS4_Button_B_P1"; inputA = "PS4_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "PS4_Button_B_P2"; inputA = "PS4_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "PS4_Button_B_P3"; inputA = "PS4_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "PS4_Button_B_P4"; inputA = "PS4_Button_A_P4"; } } } else if (other.gameObject.GetComponent <PlayerMovement>().isMac == true) { if (SceneSwitchingScript.isXbox == true) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "Xbox_Button_B_P1_MAC"; inputA = "Xbox_Button_A_P1_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "Xbox_Button_B_P2_MAC"; inputA = "Xbox_Button_A_P2_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "Xbox_Button_B_P3_MAC"; inputA = "Xbox_Button_A_P3_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "Xbox_Button_B_P4_MAC"; inputA = "Xbox_Button_A_P4_MAC"; } } else if (SceneSwitchingScript.isXbox == false) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "PS4_Button_B_P1"; inputA = "PS4_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "PS4_Button_B_P2"; inputA = "PS4_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "PS4_Button_B_P3"; inputA = "PS4_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "PS4_Button_B_P4"; inputA = "PS4_Button_A_P4"; } } } } } //Top Right if (transform.position.x > 0 && transform.position.y > 0) { if (other.gameObject.name == "Player2") { //sets the player when a player hits the cooking station myPlayerStatusScript = other.gameObject.GetComponent <PlayerStatus>(); myPlayerMovementScript = other.gameObject.GetComponent <PlayerMovement>(); myPlayerInventoryScript = other.gameObject.GetComponent <PlayerInventory>(); //sets the input to correct player input if (other.gameObject.GetComponent <PlayerMovement>().isMac == false) { if (SceneSwitchingScript.isXbox == true) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "Xbox_Button_B_P1"; inputA = "Xbox_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "Xbox_Button_B_P2"; inputA = "Xbox_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "Xbox_Button_B_P3"; inputA = "Xbox_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "Xbox_Button_B_P4"; inputA = "Xbox_Button_A_P4"; } } else if (SceneSwitchingScript.isXbox == false) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "PS4_Button_B_P1"; inputA = "PS4_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "PS4_Button_B_P2"; inputA = "PS4_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "PS4_Button_B_P3"; inputA = "PS4_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "PS4_Button_B_P4"; inputA = "PS4_Button_A_P4"; } } } else if (other.gameObject.GetComponent <PlayerMovement>().isMac == true) { if (SceneSwitchingScript.isXbox == true) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "Xbox_Button_B_P1_MAC"; inputA = "Xbox_Button_A_P1_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "Xbox_Button_B_P2_MAC"; inputA = "Xbox_Button_A_P2_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "Xbox_Button_B_P3_MAC"; inputA = "Xbox_Button_A_P3_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "Xbox_Button_B_P4_MAC"; inputA = "Xbox_Button_A_P4_MAC"; } } else if (SceneSwitchingScript.isXbox == false) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "PS4_Button_B_P1"; inputA = "PS4_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "PS4_Button_B_P2"; inputA = "PS4_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "PS4_Button_B_P3"; inputA = "PS4_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "PS4_Button_B_P4"; inputA = "PS4_Button_A_P4"; } } } } } //Bottom Left if (transform.position.x > 0 && transform.position.y < 0) { if (other.gameObject.name == "Player4") { //sets the player when a player hits the cooking station myPlayerStatusScript = other.gameObject.GetComponent <PlayerStatus>(); myPlayerMovementScript = other.gameObject.GetComponent <PlayerMovement>(); myPlayerInventoryScript = other.gameObject.GetComponent <PlayerInventory>(); //sets the input to correct player input if (other.gameObject.GetComponent <PlayerMovement>().isMac == false) { if (SceneSwitchingScript.isXbox == true) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "Xbox_Button_B_P1"; inputA = "Xbox_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "Xbox_Button_B_P2"; inputA = "Xbox_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "Xbox_Button_B_P3"; inputA = "Xbox_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "Xbox_Button_B_P4"; inputA = "Xbox_Button_A_P4"; } } else if (SceneSwitchingScript.isXbox == false) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "PS4_Button_B_P1"; inputA = "PS4_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "PS4_Button_B_P2"; inputA = "PS4_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "PS4_Button_B_P3"; inputA = "PS4_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "PS4_Button_B_P4"; inputA = "PS4_Button_A_P4"; } } } else if (other.gameObject.GetComponent <PlayerMovement>().isMac == true) { if (SceneSwitchingScript.isXbox == true) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "Xbox_Button_B_P1_MAC"; inputA = "Xbox_Button_A_P1_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "Xbox_Button_B_P2_MAC"; inputA = "Xbox_Button_A_P2_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "Xbox_Button_B_P3_MAC"; inputA = "Xbox_Button_A_P3_MAC"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "Xbox_Button_B_P4_MAC"; inputA = "Xbox_Button_A_P4_MAC"; } } else if (SceneSwitchingScript.isXbox == false) { if (other.gameObject.GetComponent <PlayerMovement>().player1 == true) { inputB = "PS4_Button_B_P1"; inputA = "PS4_Button_A_P1"; } else if (other.gameObject.GetComponent <PlayerMovement>().player2 == true) { inputB = "PS4_Button_B_P2"; inputA = "PS4_Button_A_P2"; } else if (other.gameObject.GetComponent <PlayerMovement>().player3 == true) { inputB = "PS4_Button_B_P3"; inputA = "PS4_Button_A_P3"; } else if (other.gameObject.GetComponent <PlayerMovement>().player4 == true) { inputB = "PS4_Button_B_P4"; inputA = "PS4_Button_A_P4"; } } } } } }
// Start is called before the first frame update void Start() { playerInv = gameObject.GetComponent <PlayerInventory>(); characterMotor = gameObject.GetComponent <CharacterMotor>(); }
public void setInventory(PlayerInventory pi) { this._inventory = pi; }
private void Awake() { m_PlayerInventory = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>(); m_TotalRect = m_ToxinTransform.GetComponent <RectTransform>().sizeDelta; m_ToxinTransform.sizeDelta = new Vector2(m_ToxinTransform.sizeDelta.x, 0); }
private void Start() { playerInventory = gameObject.GetComponent <PlayerInventory>(); SortA(); }
public static void OpenStorage(PlayerInventory __instance) { OnOpenedStorage?.Invoke(__instance.player); }
private void Respawn() { Debug.Log("LocalPlayer -> Respawn"); if (LocalPlayer.Stats.Dead) { if (LocalPlayer.IsInEndgame) { GameObject gameObject = GameObject.FindWithTag("EndgameLoader"); if (gameObject) { SceneLoadTrigger component = gameObject.GetComponent <SceneLoadTrigger>(); component.ForceUnload(); } } if (Scene.HudGui) { Scene.HudGui.LoadingCavesInfo.SetActive(false); } EventRegistry.Player.Publish(TfEvent.ExitOverlookArea, null); EventRegistry.Player.Publish(TfEvent.ExitEndgame, null); LocalPlayer.GameObject.SendMessage("NotInACave"); PlayerInventory inventory = LocalPlayer.Inventory; PlayerClothing clothing = LocalPlayer.Clothing; AchievementsManager achievements = LocalPlayer.Achievements; PassengerManifest passengerManifest = LocalPlayer.PassengerManifest; SurvivalBookTodo componentInChildren = LocalPlayer.SpecialItems.GetComponentInChildren <SurvivalBookTodo>(); string name = LocalPlayer.Entity.GetState <IPlayerState>().name; bool value = LocalPlayer.SavedData.ReachedLowSanityThreshold; bool value2 = LocalPlayer.SavedData.ExitedEndgame; LocalPlayer.Inventory.HideAllEquiped(false, false); LocalPlayer.Inventory.enabled = false; if (Scene.SceneTracker.allPlayers.Contains(LocalPlayer.GameObject)) { Scene.SceneTracker.allPlayers.Remove(LocalPlayer.GameObject); } if (Scene.SceneTracker.allPlayerEntities.Contains(LocalPlayer.Entity)) { Scene.SceneTracker.allPlayerEntities.Remove(LocalPlayer.Entity); } BoltNetwork.Detach(LocalPlayer.Entity); GameObject gameObject2 = LocalPlayer.GameObject; BoltEntity entity = LocalPlayer.Entity; gameObject2.name = "player Corpse - " + name; gameObject2.tag = "Untagged"; LocalPlayer.MainCamTr.parent = LocalPlayer.Transform; LocalPlayer.Inventory.CurrentView = PlayerInventory.PlayerViews.Loot; if (LocalPlayer.AnimControl.swimming) { LocalPlayer.Rigidbody.useGravity = true; } for (int i = gameObject2.transform.childCount - 1; i >= 0; i--) { Transform child = gameObject2.transform.GetChild(i); UnityEngine.Object.Destroy(child.gameObject); } Component[] components = gameObject2.GetComponents(typeof(MonoBehaviour)); foreach (Component component2 in components) { if (!(component2 is BoltEntity)) { UnityEngine.Object.DestroyImmediate(component2); } } Transform transform = base.transform; GameObject gameObject3 = UnityEngine.Object.Instantiate <GameObject>(Prefabs.Instance.PlayerPrefab, transform.position, transform.rotation); gameObject3.transform.localEulerAngles = new Vector3(0f, gameObject3.transform.localEulerAngles.y, 0f); gameObject3.name = Prefabs.Instance.PlayerPrefab.name; LocalPlayer.Inventory.SetQuickSelectItemIds(inventory.QuickSelectItemIds); LocalPlayer.Achievements.Clone(achievements); LocalPlayer.SpecialItems.GetComponentInChildren <SurvivalBookTodo>().Clone(componentInChildren); LocalPlayer.SavedData.ReachedLowSanityThreshold.SetValue(value); LocalPlayer.SavedData.ExitedEndgame.SetValue(value2); LocalPlayer.PassengerManifest.Clone(passengerManifest); LocalPlayer.FpCharacter.UnLockView(); LocalPlayer.CamFollowHead.enableMouseControl(false); LocalPlayer.MainCamTr.localEulerAngles = Vector3.zero; LocalPlayer.MainRotator.enabled = true; LocalPlayer.CamRotator.enabled = true; LocalPlayer.Stats.Health = 28f; LocalPlayer.Stats.HealthTarget = 28f; LocalPlayer.Stats.Energy = 100f; LocalPlayer.Stats.Fullness = 0.35f; LocalPlayer.Stats.Thirst = 0.35f; LocalPlayer.Stats.Invoke("CheckArmsStart", 2f); LocalPlayer.Stats.Invoke("PlayWakeMusic", 0.5f); LocalPlayer.Tuts.CloseColdTut(); Scene.RainFollowGO.GetComponent <SmoothTransformConstraint>().target = LocalPlayer.Transform; gameObject3.SetActive(true); CoopUtils.AttachLocalPlayer(gameObject3, name); Scene.SceneTracker.allPlayers.Add(LocalPlayer.GameObject); LocalPlayer.GreebleRoot.SetActive(true); LocalPlayer.Inventory.enabled = true; LocalPlayer.Transform.SendMessage("enableMpRenderers"); LocalPlayer.Transform.SendMessage("playerLoadedFromRespawn"); this._addedItems = false; StealItemTrigger stealItemTrigger = UnityEngine.Object.Instantiate <StealItemTrigger>(Prefabs.Instance.DeadBackpackPrefab, gameObject2.transform.position, gameObject2.transform.rotation); stealItemTrigger._entity = entity; stealItemTrigger.transform.parent = gameObject2.transform; gameObject2.AddComponent <DeathMPTut>(); gameObject2.AddComponent <backpackCleanup>(); ItemStorage itemStorage = gameObject2.AddComponent <ItemStorage>(); itemStorage._acceptedTypes = ~Item.Types.Story; for (int k = inventory._possessedItems.Count - 1; k >= 0; k--) { InventoryItem inventoryItem = inventory._possessedItems[k]; if (!LocalPlayer.Inventory.Owns(inventoryItem._itemId, false)) { if (inventoryItem.MaxAmount == 1) { InventoryItemView inventoryItemView = inventory.InventoryItemViewsCache[inventoryItem._itemId][0]; this.AddItemToStorage(inventoryItem._itemId, inventoryItem._amount, itemStorage, inventoryItemView.Properties); } else if (inventoryItem.MaxAmount > 0 && inventoryItem.MaxAmount < 2147483647) { while (inventory.Owns(inventoryItem._itemId, false)) { InventoryItemView inventoryItemView2 = inventory.InventoryItemViewsCache[inventoryItem._itemId][0]; inventory.SortInventoryViewsByBonus(inventoryItemView2, inventoryItemView2.Properties.ActiveBonus, true); int amount = inventory.AmountOfItemWithBonus(inventoryItem._itemId, inventoryItemView2.Properties.ActiveBonus); inventory.RemoveItem(inventoryItem._itemId, amount, true, false); this.AddItemToStorage(inventoryItem._itemId, amount, itemStorage, inventoryItemView2.Properties); } } else { this.AddItemToStorage(inventoryItem._itemId, inventoryItem._amount, itemStorage, null); } } } for (int l = 0; l < inventory.EquipmentSlots.Length; l++) { InventoryItemView inventoryItemView3 = inventory.EquipmentSlots[l]; if (inventoryItemView3 && inventoryItemView3._itemId > 0) { this.AddItemToStorage(inventoryItemView3._itemId, 1, itemStorage, inventoryItemView3.Properties); } } clothing.DropAll(gameObject2.transform.position, true, true); if (!this._addedItems) { UnityEngine.Object.Destroy(gameObject2); } animalAI[] array2 = UnityEngine.Object.FindObjectsOfType <animalAI>(); foreach (animalAI animalAI in array2) { animalAI.SendMessage("updatePlayerTargets"); } mutantAI[] array4 = UnityEngine.Object.FindObjectsOfType <mutantAI>(); foreach (mutantAI mutantAI in array4) { mutantAI.SendMessage("updatePlayerTargets"); } Fish[] array6 = UnityEngine.Object.FindObjectsOfType <Fish>(); mutantScriptSetup[] array7 = UnityEngine.Object.FindObjectsOfType <mutantScriptSetup>(); foreach (mutantScriptSetup mutantScriptSetup in array7) { mutantScriptSetup.setupPlayer(); mutantScriptSetup.search.refreshCurrentTarget(); } LocalPlayer.Transform.SendMessage("enableMpRenderers"); if (ForestVR.Enabled) { Scene.HudGui.GuiCam.SetActive(true); } Terrain.activeTerrain.GetComponent <Collider>().enabled = true; Scene.Clock.IsNotCave(); } PlayerRespawnMP.Cancel(); if (this._bringUpPauseMenu) { this._bringUpPauseMenu = false; LocalPlayer.Inventory.TogglePauseMenu(); } }
private void SetUpWeapons() { if (this.Remote) { return; } this.dig = base.transform.parent.GetComponentInChildren <Digger>(); this.setup = base.transform.parent.GetComponentInChildren <playerScriptSetup>(); this.animControl = base.GetComponent <playerAnimatorControl>(); this.player = base.transform.parent.GetComponent <PlayerInventory>(); this.armIK = base.transform.GetComponent <simpleIkSolver>(); Transform[] componentsInChildren = base.transform.root.GetComponentsInChildren <Transform>(); Transform[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Transform transform = array[i]; if (transform.name == "hitTrigger") { this.mainWeaponCollider = transform.GetComponent <Collider>(); if (this.mainWeaponCollider) { this.mainWeaponCollider.enabled = false; } this.hitTriggerTr = transform.parent.transform; } if (transform.name == "stickHeld") { this.stickCollider1 = transform.GetComponentInChildren <BoxCollider>(); this.stickCollider2 = transform.GetComponentInChildren <CapsuleCollider>(); this.stickCollider2.enabled = false; } if (transform.name == "FireStick") { this.fireStickCollider1 = transform.GetComponentInChildren <BoxCollider>(); this.fireStickCollider2 = transform.GetComponentInChildren <CapsuleCollider>(); this.fireStickCollider2.enabled = false; } if (transform.name == "AxeHeld") { this.axeCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "AxeCraftedHeld") { this.axeCraftedCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "RockHeld") { this.rockCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "spearHeld") { this.spearCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "AxeHeldRusty") { this.axeRustyCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "AxePlaneHeld") { this.axePlaneCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "testCube") { } if (transform.name == "armHeld") { this.armHeldCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "legHeld") { this.legHeldCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "HeadHeld") { this.headHeldCollider = transform.GetComponentInChildren <CapsuleCollider>(); } if (transform.name == "ClubCraftedHeld") { this.clubCraftedHeldCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "ClubHeld") { this.clubHeldCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "SkullHeld") { this.skullHeldCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "stickHeldUpgraded") { this.stickUpgradedHeldCollider = transform.GetComponentInChildren <BoxCollider>(); this.stickUpgradedHeldCollider2 = transform.GetComponentInChildren <CapsuleCollider>(); } if (transform.name == "RockHeldUpgraded") { this.rockUpgradedHeldCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "AxeClimbingHeld") { this.climbingAxeCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "boneHeld") { this.boneHeldCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "turtleShellHeld") { this.turtleShellHeldCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "KatanaHeld") { this.katanaHeldCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "spearHeldUpgraded") { this.spearUpgradedCollider = transform.GetComponentInChildren <Collider>(); } if (transform.name == "TennisRacketHeld") { this.tennisRacketHeldCollider = transform.GetComponentInChildren <Collider>(); } } }
private void Awake() { Instance = this; }
public void setPlayerId(int id) { this.player_id = id; this._inventory = new DaoManager(this._connection).getInventory(this.player_id); this._team = -1; this._mission = new Mission[3]; bool flag = TitleManager.getInstance().getTitle(id) == null; if (flag) { TitleManager.getInstance().AddTitleDb(id); Title acc = new Title { owner_id = id }; TitleManager.getInstance().AddTitle(acc); this.title = TitleManager.getInstance().getTitle(id); } else { this.title = TitleManager.getInstance().getTitle(id); } bool flag2 = ConfigManager.getInstance().getInfoItem(id) == null; if (flag2) { ConfigP configP = new ConfigP(); configP.setOwnerId(id); configP.setOwnerName(this.player_name); configP.setMira(1); configP.setSensibilidade(50); configP.setSangue(1); configP.setVisao(70); configP.setAudio1(100); configP.setAudio2(100); configP.config = 55; ConfigManager.getInstance().AddConfig(configP); ConfigManager.getInstance().AddConfigDb(id, 100, 100, 50, 70, 1, 0, this.player_name, 0, 7, 55); this._config = ConfigManager.getInstance().getInfoItem(id); this.audio1 = this.getConfig().getAudio1(); this.audio2 = this.getConfig().getAudio2(); this.sensibilidade = this.getConfig().getSensibilidade(); this.visao = this.getConfig().getVisao(); this.mira = this.getConfig().getMira(); this.mao = this.getConfig().getMao(); this.sangue = this.getConfig().getSangue(); this.audio_enable = this.getConfig().getAudioEnable(); this.config = this.getConfig().config; } else { this._config = ConfigManager.getInstance().getInfoItem(id); this.audio1 = this.getConfig().getAudio1(); this.audio2 = this.getConfig().getAudio2(); this.sensibilidade = this.getConfig().getSensibilidade(); this.visao = this.getConfig().getVisao(); this.mira = this.getConfig().getMira(); this.mao = this.getConfig().getMao(); this.sangue = this.getConfig().getSangue(); this.audio_enable = this.getConfig().getAudioEnable(); this.config = this.getConfig().config; } }
void Awake() { playerInventory = FindObjectOfType <PlayerInventory>(); weaponsInventoryUISlots = weaponsInventorySlotsParent.GetComponentsInChildren <InventoryUISlot>(); }
private void ChatCmd_Sell(PlayerSession player, string command, string[] args) { Occurences.Clear(); if (!bool.Parse(Config["cansell"].ToString())) { hurt.SendChatMessage(player, Color(GetMsg("msg_sellDisabled", player), "bad")); return; } double tmpPer; double.TryParse(Config["sellpercentage"].ToString(), out tmpPer); saleModifier = (1d - (tmpPer / 100d)); var argsL = args.Length; if (argsL == 0) { return; } PlayerInventory inventory = player.WorldPlayerEntity.GetComponent <PlayerInventory>(); var invContents = inventory.Items; var sellQty = (argsL == 2 ? Int32.Parse(args[1]) : 1); var im = GlobalItemManager.Instance; int queryItem; if (findItemId(args[0]) != -1) { queryItem = findItemId(args[0]); } else { hurt.SendChatMessage(player, Color(GetMsg("msg_idIncorrect", player).Replace("{command}", "/sell"), "bad")); return; } int sellQtyCounter = sellQty; var isFound = false; for (var i = 0; i < inventory.Capacity && sellQtyCounter > 0; i++) { var invCnt = invContents[i]; var itemFound = StoreStock.Find(item => item.stockId == queryItem); if (invCnt != null && itemFound != null) { isFound = true; var itemId = invCnt.Item.ItemId; var itemName = invCnt.Item.GetNameKey().ToString(); var itemQty = invCnt.StackSize; if (argsL >= 1 && itemId == queryItem) { if (sellQtyCounter > 0 && itemQty <= sellQtyCounter) { Occurences.Add(new Occurence(i, itemQty)); sellQtyCounter -= itemQty; } else if (sellQtyCounter > 0 && sellQtyCounter > 0 && itemQty >= sellQtyCounter) { Occurences.Add(new Occurence(i, sellQtyCounter)); sellQtyCounter -= sellQtyCounter; } } } } if (sellQtyCounter == 0) { PrintWarning("Perfect"); foreach (var red in Occurences) { var invCnt = invContents[red.row]; invCnt.ReduceStackSize(red.stackRemove); } double totalSalesPrice = SalesPrice(StoreStock.Find(item => item.stockId == queryItem).stockId) * sellQty; var oldBalance = Round((double)EconomyBanks.Call("Wallet", player)); im.GiveItem(player.Player, im.GetItem(22), 0); EconomyBanks.Call("AddCash", player, totalSalesPrice); UpdateTransactions(queryItem, "sold", sellQty); var newBalance = Round((double)EconomyBanks.Call("Wallet", player)); hurt.SendChatMessage(player, GetMsg("msg_soldMsg", player) .Replace("{moneySymbol}", MoneySym) .Replace("{sellQty}", sellQty.ToString()) .Replace("{totalSalesPrice}", totalSalesPrice.ToString())); hurt.SendChatMessage(player, GetMsg("msg_AfterSale", player) .Replace("{moneySymbol}", MoneySym) .Replace("{oldBalance}", oldBalance.ToString()) .Replace("{newBalance}", newBalance.ToString()) .Replace("{Color:Good}", "<color=#00ff00ff>") .Replace("{/Color:Good}", "</color>") .Replace("{Color:Bad}", "<color=#ff0000ff>") .Replace("{/Color:Bad}", "</color>")); } else if (!isFound) { hurt.SendChatMessage(player, Color(GetMsg("msg_notBuying", player), "bad")); } else if (sellQty == sellQtyCounter) { hurt.SendChatMessage(player, Color(GetMsg("msg_invDoesntHaveItem", player), "bad")); } else if (sellQtyCounter > 0) { PrintWarning("not enought in stock"); hurt.SendChatMessage(player, "You did not have the quantity requested to be sold, you only have " + (sellQty - sellQtyCounter)); } else { PrintError("Sh1t aint right = " + sellQtyCounter + ", please report to developer"); } }
// Start is called before the first frame update void Start() { m_Inventory = PlayerController.Instance.m_PlayerInventory; }
private void Awake() { inventory = GetComponent <PlayerInventory>(); }
public MyPlayer(int playerIndex, Vector2 position, Allegiance allegiance, Allegiance teamColor, PlayerInventory inventory, Player.HatState hatState, bool frozen = true) : base(playerIndex, position, allegiance, teamColor, inventory, hatState, frozen) { }