public GameObject AddItemDescription(ItemDataBlock item, float aboveSpace) { float contentHeight = this.GetContentHeight(); GameObject itemDescription = NGUITools.AddChild(this.addParent, this.itemDescriptionPrefab); itemDescription.transform.FindChild("DescText").GetComponent<UILabel>().text = item.GetItemDescription(); itemDescription.transform.SetLocalPositionY(-(contentHeight + aboveSpace)); return null; }
public GameObject AddItemTitle(ItemDataBlock item, float aboveSpace) { float contentHeight = this.GetContentHeight(); GameObject gameObject = NGUITools.AddChild(this.addParent, this.itemTitlePrefab); gameObject.GetComponentInChildren<UILabel>().text = item.name; UITexture componentInChildren = gameObject.GetComponentInChildren<UITexture>(); componentInChildren.material = componentInChildren.material.Clone(); componentInChildren.material.Set("_MainTex", item.GetIconTexture()); gameObject.transform.SetLocalPositionY(-(contentHeight + aboveSpace)); return gameObject; }
public GatherEvent(ResourceTarget r, ItemDataBlock db, int qty) { // r can be null here. Contract.Requires(db != null); Contract.Requires(qty >= 0); if (db.name == null) throw new InvalidOperationException("ItemDataBlock's name is null."); this.res = r; this._qty = qty; this._item = db.name; this._type = "Tree"; this.Override = false; }
public override InventoryItem.MergeResult TryCombine(IInventoryItem other) { ItemDataBlock datablock = other.datablock; ItemDataBlock.CombineRecipe matchingRecipe = this.datablock.GetMatchingRecipe(datablock); if (matchingRecipe != null) { int uses = other.uses; if (uses < matchingRecipe.amountToLoseOther) { return(InventoryItem.MergeResult.Failed); } if (base.uses < matchingRecipe.amountToLose) { return(InventoryItem.MergeResult.Failed); } Inventory inventory = other.inventory; int amount = 0; int a = base.uses / matchingRecipe.amountToLose; int b = uses / matchingRecipe.amountToLoseOther; amount = Mathf.Min(a, b); int num5 = 0; if (matchingRecipe.resultItem.IsSplittable()) { num5 = Mathf.CeilToInt(((float)amount) / ((float)num5)); } else { num5 = amount; } int vacantSlotCount = inventory.vacantSlotCount; if (num5 <= vacantSlotCount) { int count = amount * matchingRecipe.amountToLoseOther; if (other.Consume(ref count)) { inventory.RemoveItem(other.slot); } inventory.AddItemAmount(matchingRecipe.resultItem, amount, Inventory.AmountMode.Default); int numWant = amount * matchingRecipe.amountToLose; if (base.Consume(ref numWant)) { base.inventory.RemoveItem(base.slot); } } } return(InventoryItem.MergeResult.Failed); }
void cmdGiveAll(NetUser netuser, string command, string[] args) { int amount = 1; int argsnum = args.Length; int? notReceived = null; string item = args[0]; //check if user has permision if (!hasAccess(netuser)) { SendReply(netuser, "You do not have permission to use this command"); return; } //check for args if ((args == null) || (argsnum < 1) || (argsnum > 2)) { SendReply(netuser, "Syntax: /giveall <item name> <amount>"); return; } if (argsnum == 2) { if (item == "kit") { string kitname = args[1]; foreach (PlayerClient player in PlayerClient.All) { Kits.Call("GiveKit", player.netUser, kitname); return; } } else { amount = Convert.ToInt32(args[1]); } } ItemDataBlock datablock = (GetItemDataBlock(item)); if (datablock != null) { foreach (PlayerClient player in PlayerClient.All) { NetUser targetuser = player.netUser; notReceived = Give(targetuser, datablock, amount); GiveCheck(netuser, targetuser, item, amount, notReceived); } } }
public static void PlayerGatherWood(IMeleeWeaponItem rec, ResourceTarget rt, ref ItemDataBlock db, ref int amount, ref string name) { Magma.Player player = Magma.Player.FindByNetworkPlayer(rec.inventory.networkView.owner); GatherEvent ge = new GatherEvent(rt, db, amount) { Item = "Wood" }; if (OnPlayerGathering != null) { OnPlayerGathering(player, ge); } db = Magma.Server.GetServer().Items.Find(ge.Item); amount = ge.Quantity; name = ge.Item; }
public void ReceiveBoundBPs(byte[] data, uLink.NetworkMessageInfo info) { this._boundBPs = this._boundBPs ?? new List <BlueprintDataBlock>(); this._boundBPs.Clear(); uLink.BitStream bitStream = new uLink.BitStream(data, false); int num = bitStream.ReadInt32(); for (int i = 0; i < num; i++) { ItemDataBlock byUniqueID = DatablockDictionary.GetByUniqueID(bitStream.ReadInt32()); if (byUniqueID) { this._boundBPs.Add(byUniqueID as BlueprintDataBlock); } } this.Refresh(); }
public void Internal_SetToolTip(ItemDataBlock itemdb, IInventoryItem item) { this.ClearContents(); if (itemdb == null) { this.SetVisible(false); return; } this.RepositionAtCursor(); itemdb.PopulateInfoWindow(this, item); Transform vector3 = this._background.transform; float contentHeight = this.GetContentHeight(); Vector3 vector31 = this.addParent.transform.localPosition; vector3.localScale = new Vector3(250f, contentHeight + Mathf.Abs(vector31.y * 2f), 1f); this.SetVisible(true); }
public override InventoryItem.MergeResult TryCombine(IInventoryItem other) { ItemDataBlock itemDataBlock = other.datablock; ItemDataBlock.CombineRecipe matchingRecipe = this.datablock.GetMatchingRecipe(itemDataBlock); if (matchingRecipe == null) { return(InventoryItem.MergeResult.Failed); } int num = other.uses; if (num < matchingRecipe.amountToLoseOther) { return(InventoryItem.MergeResult.Failed); } if (base.uses < matchingRecipe.amountToLose) { return(InventoryItem.MergeResult.Failed); } Inventory inventory = other.inventory; int num1 = 0; int num2 = base.uses / matchingRecipe.amountToLose; num1 = Mathf.Min(num2, num / matchingRecipe.amountToLoseOther); int num3 = 0; num3 = (!matchingRecipe.resultItem.IsSplittable() ? num1 : Mathf.CeilToInt((float)num1 / (float)num3)); if (num3 > inventory.vacantSlotCount) { return(InventoryItem.MergeResult.Failed); } int num4 = num1 * matchingRecipe.amountToLoseOther; if (other.Consume(ref num4)) { inventory.RemoveItem(other.slot); } inventory.AddItemAmount(matchingRecipe.resultItem, num1, Inventory.AmountMode.Default); int num5 = num1 * matchingRecipe.amountToLose; if (base.Consume(ref num5)) { base.inventory.RemoveItem(base.slot); } return(InventoryItem.MergeResult.Failed); }
public GatherEvent(ResourceTarget r, ItemDataBlock db, int qty) { // r can be null here. Contract.Requires(db != null); Contract.Requires(qty >= 0); if (db.name == null) { throw new InvalidOperationException("ItemDataBlock's name is null."); } this.res = r; this._qty = qty; this._item = db.name; this._type = "Tree"; this.Override = false; }
public static bool FindBlueprintForItem <T>(ItemDataBlock item, out T blueprint) where T : BlueprintDataBlock { ItemDataBlock[] all = DatablockDictionary.All; for (int i = 0; i < (int)all.Length; i++) { T t = (T)(all[i] as T); if (t && t.resultItem == item) { blueprint = t; return(true); } } Debug.LogWarning("Could not find blueprint foritem"); blueprint = (T)null; return(false); }
public void CheckWalloot(InventoryModEvent e) { User looter = e.Player; if (looter == null) { return; } if (IsWallooting(e.Player, e.Inventory)) { ItemDataBlock block = DatablockDictionary.GetByName(e.ItemName); e.Inventory.AddItemAmount(block, 1); Notify(looter, e.Inventory); Server.GetServer().BroadcastFrom(Core.Name, "[color yellow]☢ [color red]Player: [color yellow]" + looter.Name + "[color red] has been kicked for wall looting."); looter.Disconnect(); } }
/// <summary> /// Adds an item to the specified slot with the given amount. /// </summary> /// <param name="name"></param> /// <param name="slot"></param> /// <param name="amount"></param> public void AddItemTo(string name, int slot, int amount) { ItemDataBlock byName = DatablockDictionary.GetByName(name); if (byName != null) { Inventory.Slot.Kind belt = Inventory.Slot.Kind.Default; if ((slot > 0x1d) && (slot < 0x24)) { belt = Inventory.Slot.Kind.Belt; } else if ((slot >= 0x24) && (slot < 40)) { belt = Inventory.Slot.Kind.Armor; } this._inv.AddItemSomehow(byName, new Inventory.Slot.Kind?(belt), slot, amount); } }
public void AddItemTo(string name, int slot, int amount) { ItemDataBlock byName = DatablockDictionary.GetByName(name); if (byName != null) { Inventory.Slot.Kind value = Inventory.Slot.Kind.Default; if (slot > 29 && slot < 36) { value = Inventory.Slot.Kind.Belt; } else if (slot >= 36 && slot < 40) { value = Inventory.Slot.Kind.Armor; } this._inv.AddItemSomehow(byName, new Inventory.Slot.Kind?(value), slot, amount); } }
public static void PlayerGatherWood(IMeleeWeaponItem rec, ResourceTarget rt, ref ItemDataBlock db, ref int amount, ref string name) { try { Fougerite.Player player = Fougerite.Player.FindByNetworkPlayer(rec.inventory.networkView.owner); //Fougerite.Player player = Fougerite.Server.Cache[rec.inventory.networkView.owner.id]; GatherEvent ge = new GatherEvent(rt, db, amount); ge.Item = "Wood"; if (OnPlayerGathering != null) { OnPlayerGathering(player, ge); } db = Fougerite.Server.GetServer().Items.Find(ge.Item); amount = ge.Quantity; name = ge.Item; } catch { } }
private static ShopItem smethod_0(string string_0) { string[] array = Helper.SplitQuotes(string_0, ','); ShopItem result; if (array.Length < 4) { result = null; } else { ItemDataBlock byName = DatablockDictionary.GetByName(array[0]); if (byName == null) { result = null; } else { Shop.ItemCount++; int sell_price = -1; int buy_price = -1; int quantity = 1; int slots = -1; if (array.Length > 1 && !int.TryParse(array[1], out sell_price)) { sell_price = -1; } if (array.Length > 2 && !int.TryParse(array[2], out buy_price)) { buy_price = -1; } if (array.Length > 3 && !int.TryParse(array[3], out quantity)) { quantity = 1; } if (array.Length > 4 && !int.TryParse(array[4], out slots)) { slots = -1; } result = new ShopItem(Shop.ItemCount, array[0], sell_price, buy_price, quantity, slots, byName); } } return(result); }
///////////////////////// // Loaded() // Called when the server was initialized (when people can start joining) ///////////////////////// void OnServerInitialized() { ACData = Interface.GetMod().DataFileSystem.GetDatafile("AntiCheat"); getblueprints = typeof(PlayerInventory).GetField("_boundBPs", (BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic)); getlooters = typeof(Inventory).GetField("_netListeners", (BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic)); wooddata = DatablockDictionary.GetByName("Wood"); PlayerHandler phandler; foreach (PlayerClient player in PlayerClient.All) { if (hasPermission(player.netUser)) { continue; } phandler = player.gameObject.AddComponent <PlayerHandler>(); phandler.timeleft = GetPlayerData(player); phandler.StartCheck(); } }
public bool GetCookableInfo(out int consumeCount, out ItemDataBlock cookedVersion, out int cookedCount, out int cookTempMin, out int burnTemp) { burnTemp = 0x3b9ac9ff; cookTempMin = base.datablock.cookHeatRequirement; cookedVersion = base.datablock.cookedVersion; if (base.datablock.cookable && (cookedVersion != null)) { consumeCount = Mathf.Min(2, base.uses); cookedCount = consumeCount * Random.Range(base.datablock.numToGiveCookedMin, base.datablock.numToGiveCookedMax + 1); if (cookedCount == 0) { consumeCount = 0; return(false); } return(true); } cookedCount = consumeCount = 0; return(false); }
public bool PollForAmmoDatablock(out ItemDataBlock ammoType) { if (this.IsSplittable()) { ammoType = this; return(true); } if (this is BulletWeaponDataBlock) { ammoType = ((BulletWeaponDataBlock)this).ammoType; return(ammoType); } if (!(this is BowWeaponDataBlock)) { ammoType = null; return(false); } ammoType = ((BowWeaponDataBlock)this).defaultAmmo; return(ammoType); }
public void ReceiveBoundBPs(byte[] data, uLink.NetworkMessageInfo info) { if (this._boundBPs == null) { } this._boundBPs = new System.Collections.Generic.List <BlueprintDataBlock>(); this._boundBPs.Clear(); uLink.BitStream stream = new uLink.BitStream(data, false); int num = stream.ReadInt32(); for (int i = 0; i < num; i++) { ItemDataBlock byUniqueID = DatablockDictionary.GetByUniqueID(stream.ReadInt32()); if (byUniqueID != null) { BlueprintDataBlock item = byUniqueID as BlueprintDataBlock; this._boundBPs.Add(item); } } this.Refresh(); }
public bool GetCookableInfo(out int consumeCount, out ItemDataBlock cookedVersion, out int cookedCount, out int cookTempMin, out int burnTemp) { burnTemp = 999999999; cookTempMin = (T)this.datablock.cookHeatRequirement; cookedVersion = (T)this.datablock.cookedVersion; if (!(T)this.datablock.cookable || !cookedVersion) { int num = 0; int num1 = num; consumeCount = num; cookedCount = num1; return(false); } consumeCount = Mathf.Min(2, base.uses); cookedCount = consumeCount * UnityEngine.Random.Range((T)this.datablock.numToGiveCookedMin, (T)this.datablock.numToGiveCookedMax + 1); if (cookedCount != 0) { return(true); } consumeCount = 0; return(false); }
public override void DeInitialize() { if (_rpcBehaviour != null) { Object.Destroy(_rpcBehaviour); } if (_waitObject != null) { Object.Destroy(_waitObject); } Hooks.OnRustBusterClientPluginsLoaded -= OnRustBusterClientPluginsLoaded; foreach (var itemDataBlock in NewItems) { _dataBlocks.Remove(itemDataBlock.name); _dataBlocksByUniqueID.Remove(itemDataBlock.uniqueID); } ItemDataBlock[] _newAll = new ItemDataBlock[_oldAllLength]; for (var i = 0; i < _oldAllLength; i++) { _newAll[i] = _all[i]; } DatablockDictionary._dataBlocks = _dataBlocks; DatablockDictionary._dataBlocksByUniqueID = _dataBlocksByUniqueID; DatablockDictionary._all = _newAll; NewItems = new List <ItemDataBlock>(); _all = null; _dataBlocks = null; _dataBlocksByUniqueID = null; // UnityEngine.Object.Destroy(_loadObject); Hooks.LogData(Name, "Removed all custom items!"); }
public static void Prefabs() { if (File.Exists(World.FilePath)) { File.Delete(World.FilePath); } ItemDataBlock[] all = DatablockDictionary.All; for (int i = 0; i < all.Length; i++) { ItemDataBlock itemDataBlock = all[i]; if (itemDataBlock is DeployableItemDataBlock) { DeployableItemDataBlock deployableItemDataBlock = itemDataBlock as DeployableItemDataBlock; File.AppendAllText(World.FilePath, deployableItemDataBlock.ObjectToPlace.name + "=" + deployableItemDataBlock.DeployableObjectPrefabName + "\n"); } if (itemDataBlock is StructureComponentDataBlock) { StructureComponentDataBlock structureComponentDataBlock = itemDataBlock as StructureComponentDataBlock; File.AppendAllText(World.FilePath, structureComponentDataBlock.structureToPlacePrefab.name + "=" + structureComponentDataBlock.structureToPlaceName + "\n"); } } }
public bool GetCookableInfo(out int consumeCount, out ItemDataBlock cookedVersion, out int cookedCount, out int cookTempMin, out int burnTemp) { int num; burnTemp = (T)this.datablock.burnTemp; cookTempMin = (T)this.datablock.cookHeatRequirement; cookedVersion = (T)this.datablock.cookedVersion; if (!(T)this.datablock.cookable || !cookedVersion) { int num1 = 0; num = num1; consumeCount = num1; cookedCount = num; return(false); } int num2 = Mathf.Min(2, base.uses); num = num2; consumeCount = num2; cookedCount = num; return(consumeCount > 0); }
void icmd(NetUser netuser, string command, string[] args) { string item = String.Empty; int amount = 1; if (hasAcces(netuser)) { if (args == null || args.Length != 2) { rust.SendChatMessage(netuser, "Usage /i item amount"); return; } item = args[0]; amount = Convert.ToInt32(args[1]); data = DatablockDictionary.GetByName(item); if (data == null) { rust.SendChatMessage(netuser, "Item doesnt exists"); return; } GiveSelf(netuser, data, amount); } }
public bool SetHeldItem(IInventoryItem item) { if (item == null) { this.MakeEmpty(); if (!this.fadingOut) { this.Opaque(); } return(false); } this.hasItem = true; Texture iconTex = item.datablock.iconTex; ItemDataBlock.LoadIconOrUnknown <Texture>(item.datablock.icon, ref iconTex); this._icon.enabled = true; this._myMaterial.Set("_MainTex", iconTex); this._itemHolding = item; this.offsetVelocity = this.offsetPoint = (Vector3) new Vector2(); this.Opaque(); return(true); }
public override void DeInitialize() { Hooks.OnItemsLoaded -= OnItemsLoaded; Hooks.OnServerLoaded -= OnServerLoaded; Hooks.OnPlayerConnected -= OnPlayerConnected; Hooks.OnPlayerKilled -= OnPlayerKilled; Hooks.OnPlayerDisconnected -= OnPlayerDisconnected; Hooks.OnPlayerHurt -= OnPlayerHurt; foreach (var itemDataBlock in NewItems) { _dataBlocks.Remove(itemDataBlock.name); _dataBlocksByUniqueID.Remove(itemDataBlock.uniqueID); } ItemDataBlock[] _newAll = new ItemDataBlock[_oldAllLength]; for (var i = 0; i < _oldAllLength; i++) { _newAll[i] = _all[i]; } _dataBlocksField.SetValue(null, _dataBlocks); _datablocksByUniqueIDField.SetValue(null, _dataBlocksByUniqueID); _allField.SetValue(null, _newAll); NewItems.Clear(); _all = null; _dataBlocks = null; _dataBlocksByUniqueID = null; _reloaded = true; // UnityEngine.Object.Destroy(_loadObject); Logger.Log("Removed all custom items!"); }
// private void LoadWeaponStuff() // { // _loadObject = new GameObject(); // _loadObject.AddComponent<BundleBehaviour>(); // Object.DontDestroyOnLoad(_loadObject); // } public void AddItem(ItemDataBlock itemDataBlock) { Hooks.LogData(Name, "Adding: " + itemDataBlock.name); _dataBlocks.Add(itemDataBlock.name, _all.Length); _dataBlocksByUniqueID.Add(itemDataBlock.uniqueID, _all.Length); ItemDataBlock[] _newAll = new ItemDataBlock[_all.Length + 1]; for (var i = 0; i < _all.Length; i++) { _newAll[i] = _all[i]; } _newAll[_newAll.Length - 1] = itemDataBlock; _all = _newAll; DatablockDictionary._dataBlocks = _dataBlocks; DatablockDictionary._dataBlocksByUniqueID = _dataBlocksByUniqueID; DatablockDictionary._all = _all; // _dataBlocksField.SetValue(null, _dataBlocks); // _datablocksByUniqueIDField.SetValue(null, _dataBlocksByUniqueID); // _allField.SetValue(null, _all); }
private static ShopItem smethod_0(string string_0) { string[] strArray = Helper.SplitQuotes(string_0, ','); if (strArray.Length < 4) { return(null); } ItemDataBlock byName = DatablockDictionary.GetByName(strArray[0]); if (byName == null) { return(null); } ItemCount++; int result = -1; int num2 = -1; int num3 = 1; int num4 = -1; if ((strArray.Length > 1) && !int.TryParse(strArray[1], out result)) { result = -1; } if ((strArray.Length > 2) && !int.TryParse(strArray[2], out num2)) { num2 = -1; } if ((strArray.Length > 3) && !int.TryParse(strArray[3], out num3)) { num3 = 1; } if ((strArray.Length > 4) && !int.TryParse(strArray[4], out num4)) { num4 = -1; } return(new ShopItem(ItemCount, strArray[0], result, num2, num3, num4, byName)); }
int Give(NetUser targetuser, ItemDataBlock datablock, int num) { Inventory inv = targetuser.playerClient.rootControllable.idMain.GetComponent <Inventory>(); return(inv.AddItemAmount(datablock, num)); }
ItemDataBlock GetItemDataBlock(string item) { ItemDataBlock datablock = DatablockDictionary.GetByName(item); return(datablock); }
public static void SetToolTip(ItemDataBlock itemdb, IInventoryItem item = null) { ItemToolTip.Get().Internal_SetToolTip(itemdb, item); ItemToolTip.Get().RepositionAtCursor(); }
/// <summary> /// Adds an Item with the given amount to the inventory. /// </summary> /// <param name="name"></param> /// <param name="amount"></param> public void AddItem(string name, int amount) { ItemDataBlock item = DatablockDictionary.GetByName(name); this._inv.AddItemAmount(item, amount); }
internal InventoryItem(ItemDataBlock datablock) { this.maxUses = datablock._maxUses; this.datablockUniqueID = datablock.uniqueID; this.iface = this as IInventoryItem; }
protected static void DeserializeSharedProperties(uLink.BitStream stream, InventoryItem item, ItemDataBlock db) { item.uses = stream.ReadInvInt(); if (item.datablock.DoesLoseCondition()) { item.condition = stream.ReadSingle(); item.maxcondition = stream.ReadSingle(); } }
protected static void SerializeSharedProperties(uLink.BitStream stream, InventoryItem item, ItemDataBlock db) { stream.WriteInvInt(item.uses); if (item.datablock.DoesLoseCondition()) { stream.WriteSingle(item.condition); stream.WriteSingle(item.maxcondition); } }
public GameObject AddItemTitle(ItemDataBlock item) { return this.AddItemTitle(item, 0f); }
void cmdGive(NetUser netuser, string command, string[] args) { int? notReceived = null; string item = String.Empty; int amount = 1; NetUser targetuser = null; int argsnum = args.Length; //check if user has permision if (!hasAccess(netuser)) { SendReply(netuser, "You do not have permission to use this command"); return; } //check for args if ((args == null) || (argsnum < 1)) { SendReply(netuser, "Syntax: /give [optional:Playername] <item name> <amount>"); return; } switch (argsnum) { case (1): //single item to self item = args[0]; ItemDataBlock datablock = (GetItemDataBlock(item)); if (datablock != null) { targetuser = netuser; notReceived = Give(targetuser, datablock, amount); } else { Rust.Notice.Popup(netuser.networkPlayer, "â", "Item not found."); return; } break; case (2): // either (user, item) or (item, amount) //check to see if first arg is a player if ((rust.FindPlayer(args[0]) != null)) { //check to see if second arg is an item if ((GetItemDataBlock(args[1])) != null) { item = (args[1]); targetuser = rust.FindPlayer(args[0]); datablock = (GetItemDataBlock(item)); notReceived = Give(targetuser, datablock, amount); } //second arg is not an item so check to see if the first arg is an item else if ((GetItemDataBlock(args[0])) != null) { targetuser = netuser; item = (args[0]); datablock = (GetItemDataBlock(item)); amount = Convert.ToInt32(args[1]); notReceived = Give(targetuser, datablock, amount); } //something is wrong else { SendReply(netuser, "Syntax: /give [optional:Playername] <item name> <amount>"); } } //first arg is not a player so check if it is an item else if ((GetItemDataBlock(args[0])) != null) { targetuser = netuser; item = args[0]; datablock = (GetItemDataBlock(item)); amount = Convert.ToInt32(args[1]); notReceived = Give(targetuser, datablock, amount); } //something is wrong else { SendReply(netuser, "Syntax: /give [optional:Playername] <item name> <amount>"); } break; case (3): //(user, item, amount) targetuser = rust.FindPlayer(args[0]); if (targetuser != null) { item = args[1]; datablock = (GetItemDataBlock(item)); if (datablock != null) { amount = Convert.ToInt32(args[2]); notReceived = Give(targetuser, datablock, amount); } else { SendReply(netuser, "Item datablock not found"); } } else { SendReply(netuser, "Player not found"); } break; } GiveCheck(netuser, targetuser, item, amount, notReceived); }
public GameObject AddItemTitle(ItemDataBlock itemdb, IInventoryItem itemInstance = null, float aboveSpace = 0) { float contentHeight = this.GetContentHeight(); GameObject gameObject = NGUITools.AddChild(this.addParent, this.itemTitlePrefab); gameObject.GetComponentInChildren<UILabel>().text = (itemInstance == null ? itemdb.name : itemInstance.toolTip); UITexture componentInChildren = gameObject.GetComponentInChildren<UITexture>(); componentInChildren.material = componentInChildren.material.Clone(); componentInChildren.material.Set("_MainTex", itemdb.GetIconTexture()); componentInChildren.color = (itemInstance == null || !itemInstance.IsBroken() ? Color.white : Color.red); gameObject.transform.SetLocalPositionY(-(contentHeight + aboveSpace)); return gameObject; }
public static void PlayerGatherWood(IMeleeWeaponItem rec, ResourceTarget rt, ref ItemDataBlock db, ref int amount, ref string name) { try { Fougerite.Player player = Fougerite.Player.FindByNetworkPlayer(rec.inventory.networkView.owner); GatherEvent ge = new GatherEvent(rt, db, amount); ge.Item = "Wood"; if (OnPlayerGathering != null) { OnPlayerGathering(player, ge); } db = Fougerite.Server.GetServer().Items.Find(ge.Item); amount = ge.Quantity; name = ge.Item; } catch (Exception ex) { Logger.LogException(ex); } }
public void Internal_SetToolTip(ItemDataBlock itemdb, IInventoryItem item) { this.ClearContents(); if (itemdb == null) { this.SetVisible(false); return; } this.RepositionAtCursor(); itemdb.PopulateInfoWindow(this, item); Transform vector3 = this._background.transform; float contentHeight = this.GetContentHeight(); Vector3 vector31 = this.addParent.transform.localPosition; vector3.localScale = new Vector3(250f, contentHeight + Mathf.Abs(vector31.y * 2f), 1f); this.SetVisible(true); }