public static void SendPlacedItemInStorage(Character chr, LockerItem item) { var pw = GetPacketWriter(CashPacketOpcodes.S_MoveStoL_Done); item.Encode(pw); chr.SendPacket(pw); }
public static void SendBoughtItem(Character chr, LockerItem item) { var pw = GetPacketWriter(CashPacketOpcodes.S_Buy_Done); item.Encode(pw); chr.SendPacket(pw); }
public static void SendGiftDone(Character chr, LockerItem item, string receipient) { var pw = GetPacketWriter(CashPacketOpcodes.S_Gift_Done); pw.WriteString(receipient); pw.WriteInt(item.ItemId); pw.WriteShort(item.Amount); chr.SendPacket(pw); }
private void OnButtonClick(LockerItem item) { PlayerPrefs.SetString("PlayerPreview", item.Name); SetAbilityText(item); playerPreview.sprite = item.sprite; playerPrefab.GetComponent <SpriteRenderer>().sprite = item.sprite; DontDestroyOnLoad(playerPrefab); }
private void UpdateLocker() { for (int i = 0; i < lockerItem.Length; i++) { LockerItem item = lockerItem[i]; if (!GameObject.Find($"{item.Name}") && PlayerPrefs.GetInt($"{item.Name}") == 1) { GameObject itemObject = Instantiate(lockerItemPrefab, lockerContainer); itemObject.GetComponent <Image>().sprite = item.sprite; itemObject.transform.GetComponent <Button>().onClick.AddListener(() => OnButtonClick(item)); itemObject.name = item.Name; } } }
private static LockerItem CreateLockerItem(int userId, CommodityInfo ci, string buyCharacterName) { var expiration = ci.Period > 0 ? Tools.GetFileTimeWithAddition(new TimeSpan(ci.Period, 0, 0, 0)) : BaseItem.NoItemExpiration; var item = new LockerItem() { ItemId = ci.ItemID, Amount = ci.Count, CashId = 0, // Will be created on insert Expiration = expiration, BuyCharacterName = buyCharacterName, // Empty, only set when gift CharacterId = 0, // 0, as its in the locker CommodityId = ci.SerialNumber, GiftUnread = string.IsNullOrEmpty(buyCharacterName) == false, UserId = userId }; return(item); }
private void PopulateLocker() { for (int i = 0; i < lockerItem.Length; i++) { LockerItem item = lockerItem[i]; if (PlayerPrefs.GetInt($"{item.Name}") == 1) { GameObject itemObject = Instantiate(lockerItemPrefab, lockerContainer); itemObject.GetComponent <Image>().sprite = item.sprite; itemObject.transform.GetComponent <Button>().onClick.AddListener(() => OnButtonClick(item)); itemObject.name = item.Name; } if (item.Name == PlayerPrefs.GetString("PlayerPreview")) { playerPreview.sprite = item.sprite; SetAbilityText(item); } } }
public static BaseItem CreateCashItem(LockerItem li, CommodityInfo ci) { li.CashId = (long)((long)(Rand32.Next()) << 32 | Rand32.Next()); li.CashId &= 0x00FFFFFFFFFFFFFF; // Get rid of the first byte var item = BaseItem.CreateFromItemID(li.ItemId); item.Amount = li.Amount; item.CashId = li.CashId; item.Expiration = li.Expiration; if (item is PetItem pi) { pi.Name = DataProvider.Pets[pi.ItemID].Name; pi.Closeness = 0; pi.Fullness = 100; pi.Level = 1; } return(item); }
private void SetAbilityText(LockerItem item) { switch (item.Name) { case "Default": { abilityText.text = "None"; break; } case "Green": { abilityText.text = "Additional life"; break; } case "Violet": { abilityText.text = "Immune to spiked platforms"; break; } } }