public void SetProperties(int happiness, int hunger, Food eat, RareItem wear, RareItem canWear) { _happiness = happiness; _hunger = hunger; _wear = wear; _canWear = canWear; _eat = eat; }
public Animal(string name, int maxHappiness, Food eat, RareItem canWear) { _name = name; _hunger = 0; _maxHappiness = maxHappiness; _happiness = _maxHappiness; _eat = eat; _canWear = canWear; }
/// <summary> /// Load player game /// Currently only player position /// </summary> /// <param name="saveName"></param> public void LoadGame(string saveName) { if (PlayerPrefs.HasKey("Savegames")) { string allSavegamesString = PlayerPrefs.GetString("Savegames"); Savegames allSavegames = JsonUtility.FromJson <Savegames>(allSavegamesString); Savegame save = null; foreach (Savegame s in allSavegames.savegames) { if (s.name == saveName) { save = s; } } if (save != null) { foreach (string s in save.itemsNamesInventory) { _player.inventory.Add(GetItem(s)); } foreach (string s in save.itemsNamesStock) { _player.stock.Add(GetItem(s)); } Vector3 position = save.position; GameObject.Find("PlayerController").transform.position = position; foreach (AnimalData ad in save.animals) { AnimalBody concernedAnimal = GetAnimal(ad.name); Food eat = GetItem(ad.eat) as Food; int happiness = ad.happiness; int hunger = ad.hunger; Vector3 animalPosition = ad.position; Vector3 animalRotation = ad.rotation; string wearStr = ad.wear; RareItem wear = null; if (wearStr != null) { wear = GetItem(wearStr) as RareItem; } RareItem canWear = GetItem(ad.canWear) as RareItem; concernedAnimal.animal.SetProperties(happiness, hunger, eat, wear, canWear); concernedAnimal.transform.position = animalPosition; concernedAnimal.transform.rotation = Quaternion.Euler(animalRotation); } } } }
protected void GetRareItem(GPlayer player, uint TypeID) { AddItem AddItem; //For normal item //Form Rare item ItemRandomClass RareItem; ItemRandom PRare; List <Dictionary <uint, uint> > ListSet; try { RareItem = Items.GetRareItem(IffEntry.MemorialCoin.GetPool(TypeID)); while (true) { PRare = null; if (RareItem.GetLeft() <= 0) { break; } PRare = RareItem.GetItems(); if (!player.Inventory.IsExist(PRare.TypeId)) { break; } } if (PRare == null) { player.SendResponse(new byte[] { 0x64, 0x02, 0xAD, 0x0F9, 0x56, 0x00 }); WriteConsole.WriteLine("PlayerPlayerMemorialGacha: object is Null", ConsoleColor.Red); } if (GetItemGroup(PRare.TypeId) == 9) { ListSet = IffEntry.SetItem.SetList(PRare.TypeId); if (ListSet.Count <= 0) { player.SendResponse(new byte[] { 0x64, 0x02, 0xAD, 0x0F9, 0x56, 0x00 }); WriteConsole.WriteLine("PlayerPlayerMemorialGacha: Failed", ConsoleColor.Red); // ## should not be happened return; } foreach (var data in ListSet) { AddItem = new AddItem() { ItemIffId = data.Keys.FirstOrDefault(), Quantity = data.Values.FirstOrDefault(), Transaction = true, Day = 0// ## set should not be limited time in their set }; player.AddItem(AddItem); } } else { AddItem = new AddItem { ItemIffId = PRare.TypeId, Quantity = PRare.MaxQuantity, Transaction = true, Day = 0, }; player.AddItem(AddItem); } // ## send transaction player.SendTransaction(); // 0 = ITEM COMUM // 1 = ITEM NORMAL ASA FECHADA // 2 = ITEM NORMAL ASA ABERTA // 3 = ITEM RARO ASA FECHADA // 4 = ITEM RARO ASA ABERTA player.Response.Write(new byte[] { 0x64, 0x02 }); player.Response.Write(0); player.Response.Write(1); player.Response.Write(PRare.RareType); player.Response.WriteUInt32(PRare.TypeId); player.Response.WriteUInt32(PRare.MaxQuantity); player.SendResponse(); } catch { player.Close(); } }
public void SetWearItem(RareItem item) { _wear = item; }
public override void Setup() { RareItem.Add(new DropData(40440, 20f)); // Life Exploration Fishing Rod, 20 RareItem.Add(new DropData(18605, 10f)); // Ladeca Helm, 10 RareItem.Add(new DropData(40385, 5f)); // Ladeca Ice Wand, 5 RareItem.Add(new DropData(41130, 5f)); // Ladeca's Light Short Sword, 5 RareItem.Add(new DropData(41131, 5f)); // Ladeca's Light Short Sword, 5 RareItem.Add(new DropData(13015, 1f)); // Brigandine, 1 // RareItem.Add(new DropData(51041, 30f)); // Good Luck Potion, 30 (out until scripted) RareItem.Add(new DropData(51042, 40f)); // Poison Bottle, 40 RareItem.Add(new DropData(62058, 10f)); // Ancient Magic Powder, 10 RareItem.Add(new DropData(63025, 30f)); // Massive Holy Water of Lymilark, 30 Random rng1 = new Random(); Item pickedItem = Item.GetRandomDrop(rng1, RareItem); // Adds 0~2 Rare Items var rnd = RandomProvider.Get(); var addCount = rnd.Next(0, 3); for (int i = 0; i < addCount; i++) { rng1 = new Random(); pickedItem = Item.GetRandomDrop(rng1, RareItem); int pickID1 = pickedItem.Data.Id; switch (pickID1) // here's where items get their pricing, enchanting, tweaking. { case 13015: { var item = Item.CreateEnchanted(13015, 21202, 0); // Marble -> Brigandine var price = Convert.ToInt32(item.OptionInfo.Price * 3.5); // Cost Multiplier: 3.5x (some freakish ~850k figure) var stock = rnd.Next(1, 4); Add("Rare Items", item, price, stock); // What does this do? Pulled from edern.cs break; } /* case 00000: * { * // do whatever * // CreateEnchantedItem * // CreateEnchant * // etc ... * // Add(...); * } */ default: // else, just sell item at normal NPC price. { Add("Rare Items", pickID1); break; } } } TreasureItem.Add(new DropData(70155, 100f)); // Ordinary Key, 100 TreasureItem.Add(new DropData(91038, 500f)); // Ordinary Chest, 500 TreasureItem.Add(new DropData(70156, 10f)); // Premium Key, 10 TreasureItem.Add(new DropData(91039, 100f)); // Premium Chest, 100 TreasureItem.Add(new DropData(91208, 1f)); // Ancient Key, 1 TreasureItem.Add(new DropData(91206, 10f)); // Ancient Chest, 10 TreasureItem.Add(new DropData(91209, 20f)); // Ancient Chest Fragment, 20 Random rng2 = new Random(); Item pickedTreasure = Item.GetRandomDrop(rng2, TreasureItem); int pickID2 = pickedTreasure.Data.Id; Add("Treasures", pickID2); // RNG Treasure for this ErinnTime day Add("Dungeon Pass", 52004); Add("Dungeon Pass", 52005); Add("Dungeon Pass", 52006); Add("Dungeon Pass", 52007); Add("Event", 50532); // Broken Ice Piece Add("Event", 63063); // Glowing Frost Crystal }