protected void delete_Click(object sender, EventArgs e) { int eq_id = Convert.ToInt32(TextBox1.Text); int result = 0; string fileName = "~/images/"; try { equipment delete = myDBEntities.equipment.Single(id => id.eq_id == eq_id); fileName += delete.picture; myDBEntities.equipment.Remove(delete); result = myDBEntities.SaveChanges(); } catch (Exception ex) { Response.Write("<script>window.onload = function () {alert('删除失败,编号不存在');}</script>"); } if (result > 0) { //文件是否存在 if (File.Exists(fileName)) { //删除文件 File.Delete(fileName); } Response.Redirect("~/WebForm1/WebForm1-3.aspx"); } }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } equipment equipment = db.equipments.Find(id); if (equipment == null) { return(HttpNotFound()); } var tech_models = db.tech_models.Where(tm => tm.modelID != null).ToList(); IEnumerable <SelectListItem> selectList1 = from tm in tech_models where tm.tech_brands != null orderby tm.tech_brands.name, tm.name select new SelectListItem { Value = tm.modelID.ToString(), Text = tm.tech_brands.name + " " + tm.name }; IEnumerable <SelectListItem> selectList2 = from tm in tech_models where tm.tech_brands == null orderby tm.name select new SelectListItem { Value = tm.modelID.ToString(), Text = tm.name }; IEnumerable <SelectListItem> selectList = selectList1.Concat(selectList2); ViewBag.modelID = new SelectList(selectList, "Value", "Text", equipment.modelID); return(View(equipment)); }
/// <summary> /// get a unique equipment from the list /// </summary> /// <param name="name">the name of the equipment</param> /// <returns>the unique equipment</returns> public equipment getUnique(string name) { equipment randEquipment = new equipment(); equipment tempEquipment; ArrayList templist = new ArrayList(); foreach (equipment e in uniqueslist) { if (e.equipmentName == name) { templist.Add(e); } } tempEquipment = (equipment)templist[UnityEngine.Random.Range(0, templist.Count)]; randEquipment.equipmentName = tempEquipment.equipmentName; randEquipment.equipmentType = tempEquipment.equipmentType; randEquipment.validSlot = tempEquipment.validSlot; randEquipment.maxlvl = tempEquipment.maxlvl; randEquipment.minlvl = tempEquipment.minlvl; randEquipment.flavorText = tempEquipment.flavorText; randEquipment.tier = tempEquipment.tier; randEquipment.ranged = tempEquipment.ranged; randEquipment.twohand = tempEquipment.twohand; randEquipment.onhit = tempEquipment.onhit; randEquipment.ranged = tempEquipment.ranged; randEquipment.twohand = tempEquipment.twohand; randEquipment.onhit = tempEquipment.onhit; randEquipment.modelname = tempEquipment.modelname; randEquipment.equipmentAttributes.Add(tempEquipment.equipmentAttributes); return randEquipment; }
public void equip(equipment new_equip) { change_equip_limit(new_equip, 1); bool did_equip = false; for (int i = 0; i < equipped.Length; i++) { if (!did_equip && equipped[i] == null) { equipped[i] = new_equip; new_equip.on_equip(); if (new_equip.perks.Count > 0) { for (int j = 0; j < new_equip.perks.Count; j++) { new_equip.perks[j].add_perk(); } } did_equip = true; //Debug.Log("Equipped " + new_equip.name + " to slot " + i.ToString()); } } if (!did_equip) { equip(new_equip, 0); } util_ref.events.trigger_event("equip", attached_character.get_character()); }
public void set_inv() { //Set equipment items for (int i = 0; i < 4; i++) { equipment ref_item = util_ref.p_manager.cur_player.GetComponent <player_script>().inv.get_equipped(i); if (ref_item != null) { GameObject new_item = GameObject.Instantiate(item_prefab); new_item.GetComponent <Image>().sprite = ref_item.icon; new_item.GetComponent <DragAndDropItem>().attached_item = ref_item; equipment.transform.GetChild(i).GetComponent <DragAndDropCell>().AddItem(new_item.GetComponent <DragAndDropItem>()); } } //Set inventory items for (int i = 0; i < 16; i++) { equipment ref_item = util_ref.p_manager.cur_player.GetComponent <player_script>().inv.get_inventory(i); if (ref_item != null) { GameObject new_item = GameObject.Instantiate(item_prefab); new_item.GetComponent <Image>().sprite = ref_item.icon; new_item.GetComponent <DragAndDropItem>().attached_item = ref_item; inventory.transform.GetChild(i).GetComponent <DragAndDropCell>().AddItem(new_item.GetComponent <DragAndDropItem>()); } } }
void Start() { //建立一個player物件 player p1 = new player(); //設置p1內的各屬性 p1.name = "Tom"; p1.level = 50; p1.attack = 600; p1.defence = 200; equipment eq1 = new equipment(); eq1.attack = 87; eq1.limitLevel = 50; eq1.equipmentName = "Excalibur"; p1.equipment.Add(eq1); //將此player裡面的屬性轉成string(json格式) string saveString = JsonUtility.ToJson(p1); //將字串saveString存到硬碟中 StreamWriter file = new StreamWriter(System.IO.Path.Combine("Assets/GameJSONData", "Player1.json")); file.Write(saveString); file.Close(); }
void Start() { instance = this; rectTran = this.GetComponent <RectTransform>(); ps = GameObject.FindGameObjectWithTag("Player").GetComponent <playerStatus>(); }
// save new User to DB public static void EquipmentSaveToDatabase(equipment eqInstance) { using (reservations_dbEntities context = new reservations_dbEntities()) { context.equipment.Add(eqInstance); context.SaveChanges(); } }
public void pickup(equipment new_equip, int slot) { if (equipment_list[slot] != null) { Debug.LogWarning("Overwrote " + equipment_list[slot].name + " with " + new_equip.name); } equipment_list[slot] = new_equip; }
public void EquipItem(equipment equipment) { UnequipItem(equipment.category); CurrentNinja.equipment.Add(equipment); CurrentNinjaChanged(); }
public ActionResult _DeleteConfirmed(int id) { equipment equipment = db.equipment.Find(id); db.equipment.Remove(equipment); db.SaveChanges(); return(RedirectToAction("Index", new { dept = equipment.department })); }
public static void DelEquipment(string Id) { using (fitnessEntities dbe = new fitnessEntities()) { equipment equipment = dbe.equipments.Where(o => o.equipment_id.Equals(Id)).SingleOrDefault(); dbe.equipments.Remove(equipment); dbe.SaveChanges(); } }
protected void SignUp_Click(object sender, EventArgs e) { equipment equip = new equipment(); if (lblRogueHidden.Text != "") { newUser.character = lblRogueHidden.Text; } else if (lblGambitHidden.Text != "") { newUser.character = lblGambitHidden.Text; } else if (lblMagikHidden.Text != "") { newUser.character = lblMagikHidden.Text; } else if (lblColossusHidden.Text != "") { newUser.character = lblColossusHidden.Text; } SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["xmenContext"].ToString()); SqlCommand cmd = new SqlCommand("SELECT * FROM characterStats WHERE name = @character;", conn); cmd.Parameters.AddWithValue("@character", newUser.character); conn.Open(); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { newUser.charHealth = Convert.ToInt32(dr["health"].ToString()); newUser.atk = Convert.ToInt32(dr["charAtk"].ToString()); newUser.def = Convert.ToInt32(dr["charDef"].ToString()); newUser.speed = Convert.ToInt32(dr["charSpeed"].ToString()); } string password = txtPassword.Text; PasswordHasher PH = new PasswordHasher(); string hashed = PH.CreateHash(password); newUser.firstName = txtFName.Text; newUser.lastName = txtLName.Text; newUser.password = hashed; newUser.email = txtEmail.Text; newUser.equipId = equip.equipId; Session.Add("user", newUser); Session.Add("equipment", equip); xmenContext context = new xmenContext(); context.users.Add(newUser); context.equipments.Add(equip); try { context.SaveChanges(); } catch (DbUpdateException ex) { Console.Write(ex.Message); } FormsAuthentication.RedirectFromLoginPage(txtEmail.Text, false); Response.Redirect("LevelOne.aspx"); }
public void DeleteEquipment(equipment equipment) { equipment.ninjas.Clear(); Context.equipments.Remove(equipment); All.Remove(equipment); EquipmentChanged(); }
public async Task <ActionResult> DeleteConfirmed(string id) { equipment equipment = await db.equipments.FindAsync(id); db.equipments.Remove(equipment); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public EquipmentModificationDialog(equipment equipment = null) { InitializeComponent(); DataContext = new EquipmentModificationViewModel { Equipment = new EquipmentCrudModel(equipment) }; }
public ActionResult _Edit([Bind(Include = "id,department,ftype,name,feature,ip,op,op_bit,op_copyright,db,office,offcie_copyright,antivirus,note")] equipment equipment) { if (ModelState.IsValid) { db.Entry(equipment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", new { dept = equipment.department })); } return(PartialView(equipment)); }
public mainChar(string name, float hpVal, float mpVal, float att, float def, float intl) : base(name, hpVal, mpVal, att, def, intl) { exp = 0; expCap = setExpCap(lv); // expCap = (x^2)/2 + 125x for (int i = 0; i < wearingNum; i++) //for each wearing places in character { equipment.eqType eqtype = (equipment.eqType)(i); //get type of the place equipment temp = new equipment(eqtype); //create new equipment changeEquipment(temp); //equip the new equipment to character } }
public ActionResult Create([Bind(Include = "id,department,ftype,name,feature,ip,op,op_bit,op_copyright,db,office,offcie_copyright,antivirus,note")] equipment equipment) { if (ModelState.IsValid) { db.equipment.Add(equipment); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(equipment)); }
protected void Button2_Click(object sender, EventArgs e) { //获取输入内容 string name = TextBox3.Text; string specifications = TextBox4.Text; string price = TextBox5.Text; string date = TextBox6.Text; string location = TextBox7.Text; string picture = ""; // 重新命名文件名,避免重复和保密 string exten = System.IO.Path.GetExtension(FileUpload1.FileName); //取扩展名 string newFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + exten; //生成新的文件名 string path = "~/images/" + newFileName; //设置上传的目标虚拟路径 if (FileUpload1.HasFile) //如果上传文件控件不为空,既有文件 { picture = newFileName; } if (name != "" && specifications != "" && price != "" && date != "" && picture != "" && location != "") { //创建实体类对象 并且赋值 equipment equipment = new equipment(); equipment.name = name; equipment.specifications = specifications; equipment.price = Convert.ToDouble(price); equipment.date = Convert.ToDateTime(date); equipment.location = location; equipment.picture = picture; equipment.ep_id = Convert.ToInt32(Session["id"]); //通过linq技术 把实体类对象添加到数据库中 myDBEntities myDBEntities = new myDBEntities(); myDBEntities.equipment.Add(equipment); int result = myDBEntities.SaveChanges(); //通过执行添加操作的返回值 判断添加是否成功 if (result > 0) { Label1.Text = "添加成功"; FileUpload1.SaveAs(Server.MapPath(path));//保存图片 } else { Label1.Text = "添加失败"; } } else { Label1.Text = "请输入添加的信息!"; } }
public ActionResult Edit([Bind(Include = "equipmentID,name,modelID,mark,count,note")] equipment equipment) { if (ModelState.IsValid) { db.Entry(equipment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.brandmodelID = new SelectList(db.tech_models, "modelID", "name", equipment.modelID); return(View(equipment)); }
public ActionResult Create([Bind(Include = "equipmentID,name,modelID,mark,count,note")] equipment equipment) { if (ModelState.IsValid) { db.equipments.Add(equipment); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.modelID = new SelectList(db.tech_models, "modelID", "name", equipment.modelID); return(View(equipment)); }
public override void Enter() { Controller.Camera.enabled = true; toBeUsed = null; hoverEquip = null; hoverEquipped = null; equipItem = null; Controller.DraggedEquip = null; health= resource= power= defense= damage= attackSpeed= movementSpeed = ""; }
public EquipmentCrudModel(equipment equipment = null) { OriginalEquipment = equipment ?? new equipment(); Name = OriginalEquipment.name; Image = OriginalEquipment.image; Category = CategoryRepository.Instance.All.FirstOrDefault(e => e.name == OriginalEquipment.category?.name); Value = OriginalEquipment.value; Strength = OriginalEquipment.strength; Intelligence = OriginalEquipment.intelligence; Agility = OriginalEquipment.agility; }
public bool addEquipment(equipment eq) { for (int i = 0; i < ownedNum; i++) //loop through owned equipment array, put the equipment into empty slot or cannot add { if (owned[i].isNull()) { owned[i] = eq; return(true); } } return(false); }
public async Task <ActionResult> Edit([Bind(Include = "equ_id,equ_name,equ_cat_id,equ_description,equ_amount,equ_status")] equipment equipment) { if (ModelState.IsValid) { db.Entry(equipment).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.equ_cat_id = new SelectList(db.equ_category, "equ_cat_id", "equ_cat_name", equipment.equ_cat_id); return(View(equipment)); }
public override bool Equals(object equip) { equipment eq = (equipment)equip; return(this.eqName == eq.eqName && this.eqtype == eq.eqtype && this.owner == eq.owner && this.lv == eq.lv && this.rank == eq.rank && this.attributePair == eq.attributePair && this.description == eq.description); }
public int pickup(equipment new_equip) { //Find the first empty spot for (int i = 0; i < equipment_list.Length; i++) { if (equipment_list[i] == null || equipment_list[i].GetInstanceID() == new_equip.GetInstanceID()) { equipment_list[i] = new_equip; return(i); } } return(-1); }
internal Item(string name, int price, int atk, int arm, int hp, int exp, int lvl, equipment e, int hitC, int dC) { this.name = name; this.price = price; this.atk = atk; armor = arm; this.hp = hp; this.exp = exp; level = lvl; equip = e; hitChance = hitC; doubleChance = dC; }
internal Item(string name, equipment e) { this.name = name; price = 0; equip = e; atk = 0; armor = 0; hp = 0; exp = 0; level = 0; hitChance = 100; doubleChance = 20; }
// GET: Contacts/Delete/5 public ActionResult _Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } equipment equipment = db.equipment.Find(id); if (equipment == null) { return(HttpNotFound()); } return(PartialView(equipment)); }
// GET: Equipments/Details/5 public async Task <ActionResult> Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } equipment equipment = await db.equipments.FindAsync(id); if (equipment == null) { return(HttpNotFound()); } return(View(equipment)); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } equipment equipment = db.equipments.Find(id); if (equipment == null) { return(HttpNotFound()); } return(View(equipment)); }
public ActionResult DeleteConfirmed(int id) { equipment equipment = db.equipments.Find(id); db.equipments.Remove(equipment); IEnumerable <project_equipment> project_equipment = db.project_equipment.Where(pe => pe.equipmentID == id); foreach (project_equipment pe in project_equipment) { pe.equipmentID = null; } db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Add the attribute changes of an item to the entity. The item must correlate to one of the equipment slots, /// Head, Chest, Legs, Feet, Main, Off. Attribute changes are taken as an attributes object. Returns /// false if the slot is already filled. /// /// Removes the equipped item from the list of inventory items and adds it to the list of equipped items. /// </summary> /// <param name="slot">The equipment slot being filled.</param> /// <returns></returns> public bool addEquipment(equipment item) { if (this.equippedEquip.ContainsKey(item.validSlot)) { return false; } else if (item.twohand == true && this.equippedEquip.ContainsKey(equipSlots.slots.Off)) { return false; } else if (item.validSlot == equipSlots.slots.Off && equippedEquip.ContainsKey(equipSlots.slots.Main) && equippedEquip[equipSlots.slots.Main].twohand == true) { return false; } else { this.equippedEquip.Add(item.validSlot, item); this.equipAtt.Add(item.equipmentAttributes); UpdateCurrentAttributes(); GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>().EquipmentFactory.saveequipment(((int)item.validSlot).ToString(), item); if (item.validSlot == equipSlots.slots.Main && item.onhit != "") { abilityManager.RemoveAbility(6); abilityManager.AddAbility(GameManager.Abilities[item.onhit], 6); abilityIndexDict[item.onhit] = 6; } if (tag == "Player" && item.validSlot == equipSlots.slots.Main) { //GameObejct weaponModel = (Resources.Load(equipment.FILEPATH + item.modelname, typeof(GameObject)) as GameObject).GetComponent<MeshFilter>().mesh; } inventory.RemoveItem(item); return true; } }
void RightClickEquip(equipment item) { if (Controller.Player.EquippedEquip.ContainsKey(item.validSlot)) { Controller.Player.removeEquipment(item.validSlot); } Controller.Player.addEquipment(item); }
void DropToUnequip(Rect overRect) { //To Drop: //Check to see if the current event type is MouseUp and if the mouse position of the current event is inside the target rect. If it is, perform the necessary operation (in this case, removing the currently slotted ability and adding it to the spellbook list) and set the temporary variable to null. if (Event.current.type == EventType.MouseUp && overRect.Contains(Event.current.mousePosition) && Controller.DraggedEquip != null) { if (Controller.Player.Inventory.Items.Count < Controller.Player.Inventory.Max) { Controller.Player.removeEquipment(Controller.DraggedEquip.validSlot); } Controller.DraggedEquip = null; hoverEquip = null; } }
void TooltipEquipment(Dictionary<Rect, equipment> hoverRects) { Vector2 mPos = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y); foreach (Rect hoverRect in hoverRects.Keys) { if (hoverRect.Contains(GUIUtility.ScreenToGUIPoint(mPos)) && Controller.DraggedEquip == null) { //Debug.Log("in rect: " + hoverRect.ToString()); hoverEquipped = hoverRects[hoverRect]; return; } else { hoverEquipped = null; } } }
public override void Enter() { base.Enter(); lootItem = null; }
/* public void webequip() { string downloadedString; WebClient client; string dl2; client = new WebClient(); downloadedString = client.DownloadString("http://www.wordgenerator.net/application/p.php?id=nouns&type=50&spaceflag=false"); string[] randomnoun = downloadedString.Split(','); //dl2 = client.DownloadString("http://www.wordgenerator.net/application/p.php?id=adjectives&type=50&spaceflag=false"); //string[] randomadj = dl2.Split(','); Debug.Log(randomnoun[1]+ " "+ randomnoun[2]); } */ /// <summary> /// builds a default equipment /// </summary> /// <returns>an equipment object</returns> public equipment buildEquipment() { equipment tempEquipment = new equipment(); return tempEquipment; }
public void AddItem(equipment item) { if (items.Count < MAX) items.Add(item); }
void OnWindow(int windowID) { #region Mouse in GUI check Vector2 mPos = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y); if (mPos.x > windowDimensions.x && mPos.x < windowDimensions.width + windowDimensions.x && mPos.y > windowDimensions.y && mPos.y < windowDimensions.height + windowDimensions.y) { Controller.PlayerController.MouseOverGUI = true; } else { Controller.PlayerController.MouseOverGUI = false; } #endregion float yOffset = 0; lootRects = new Dictionary<Rect, equipment>(); int viewSize = Controller.ChestInventory.Items.Count * 25; Rect viewArea = new Rect(0,0,10, viewSize); scrollViewVector = GUI.BeginScrollView(new Rect(5, 20, WIDTH - 10, HEIGHT - 50), scrollViewVector, viewArea); foreach (equipment item in Controller.ChestInventory.Items) { Rect thisRect = new Rect(0, yOffset, totalInvWidth, 25); GUI.Box(thisRect, item.equipmentName); if (thisRect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseUp && Event.current.button == 1) { lootItem = item; } lootRects.Add(thisRect, item); yOffset += 27; } Tooltip(lootRects); if (lootItem != null) { Loot(lootItem); lootItem = null; } GUI.EndScrollView(); Rect lootAllRect = new Rect(5, HEIGHT - 30, WIDTH - 10, 25); if (GUI.Button(lootAllRect, "Loot All")) { LootAll(); } }
/// <summary> /// function to generate a random equipment /// </summary> /// <param name="tier">the tier of the desired equipment</param> /// <returns>a random equipment of the desired tier</returns> public equipment randomEquipment(int tier) { equipment randEquipment = new equipment(); equipment tempEquipment; //grab a random equipment out of the list appropriate for the tier if (tier == 3) { int randint = UnityEngine.Random.Range(0, uniqueslist.Count); tempEquipment = (equipment)uniqueslist[randint]; } else { int randint = UnityEngine.Random.Range(0, basesList.Count); tempEquipment = (equipment)basesList[randint]; } randEquipment.equipmentName = tempEquipment.equipmentName; randEquipment.equipmentType = tempEquipment.equipmentType; randEquipment.validSlot = tempEquipment.validSlot; randEquipment.maxlvl = tempEquipment.maxlvl; randEquipment.minlvl = tempEquipment.minlvl; randEquipment.flavorText = tempEquipment.flavorText; randEquipment.tier = tempEquipment.tier; randEquipment.ranged = tempEquipment.ranged; randEquipment.twohand = tempEquipment.twohand; randEquipment.onhit = tempEquipment.onhit; randEquipment.modelname = tempEquipment.modelname; randEquipment.equipmentAttributes.Add(tempEquipment.equipmentAttributes); doaffixes(randEquipment, tier); return randEquipment; }
/// <summary> /// function to generate a random piece of equipment /// </summary> /// <returns>an equipment object</returns> public equipment randomEquipment() { equipment randEquipment = new equipment(); equipment tempEquipment; //roll the dice to see if we get affixes int randint = UnityEngine.Random.Range(0, 100); if (randint >= 97) { int lootroll = UnityEngine.Random.Range(0, uniqueslist.Count); tempEquipment = (equipment)uniqueslist[lootroll]; } else { int lootroll = UnityEngine.Random.Range(0, basesList.Count); tempEquipment = (equipment)basesList[lootroll]; } randEquipment.equipmentName = tempEquipment.equipmentName; randEquipment.equipmentType = tempEquipment.equipmentType; randEquipment.validSlot = tempEquipment.validSlot; randEquipment.maxlvl = tempEquipment.maxlvl; randEquipment.minlvl = tempEquipment.minlvl; randEquipment.flavorText = tempEquipment.flavorText; randEquipment.tier = tempEquipment.tier; randEquipment.ranged = tempEquipment.ranged; randEquipment.twohand = tempEquipment.twohand; randEquipment.onhit = tempEquipment.onhit; randEquipment.modelname = tempEquipment.modelname; randEquipment.equipmentAttributes.Add(tempEquipment.equipmentAttributes); int tier = 0; if (randint > 60 && randint <= 85) tier = 1; if (randint > 85 && randint < 97) tier = 2; doaffixes(randEquipment, tier); return randEquipment; }
/// <summary> /// generate a random equipment /// </summary> /// <param name="level">the desired level</param> /// <returns>a random equipment of the desired level</returns> public equipment randomEquipmentByLevel(int level) { equipment randEquipment = new equipment(); equipment tempEquipment; //roll the dice to see if we get affixes int randint = UnityEngine.Random.Range(0, 100); if (randint >= 95) { ArrayList templist = new ArrayList(); foreach (equipment e in uniqueslist) { if (e.maxlvl >= level && e.minlvl <= level) { templist.Add(e); } } tempEquipment = (equipment)templist[UnityEngine.Random.Range(0, templist.Count)]; } else { ArrayList templist = new ArrayList(); foreach (equipment e in basesList) { if (e.maxlvl >= level && e.minlvl <= level) { templist.Add(e); } } tempEquipment = (equipment)templist[UnityEngine.Random.Range(0, templist.Count)]; } randEquipment.equipmentName = tempEquipment.equipmentName; randEquipment.equipmentType = tempEquipment.equipmentType; randEquipment.validSlot = tempEquipment.validSlot; randEquipment.maxlvl = tempEquipment.maxlvl; randEquipment.minlvl = tempEquipment.minlvl; randEquipment.flavorText = tempEquipment.flavorText; randEquipment.tier = tempEquipment.tier; randEquipment.ranged = tempEquipment.ranged; randEquipment.twohand = tempEquipment.twohand; randEquipment.onhit = tempEquipment.onhit; randEquipment.modelname = tempEquipment.modelname; randEquipment.equipmentAttributes.Add(tempEquipment.equipmentAttributes); int tier = 0; if (randint > 50 && randint <= 80) tier = 1; if (randint > 80 && randint < 95) tier = 2; doaffixes(randEquipment, tier); return randEquipment; }
/// <summary> /// function to generate a random equipment /// </summary> /// <param name="tier">the tier of the desired equipment</param> /// <param name="level">the level of the desired equipment</param> /// <param name="slot">the slot of the desired equipment</param> /// <returns></returns> public equipment randomEquipment(int tier, int level, equipSlots.slots slot) { equipment randEquipment = new equipment(); equipment tempEquipment; //NO! BAD USER! LEVEL CAP IS A THING! if (level > 20) { level = 20; } //grab a random equipment out of the list appropriate for the tier if (tier >= 3) { ArrayList templist = new ArrayList(); foreach(equipment e in uniqueslist) { if (e.validSlot == slot && e.minlvl <= level && e.maxlvl >= level) { templist.Add(e); } } tempEquipment = (equipment)templist[UnityEngine.Random.Range(0, templist.Count)]; } else { ArrayList templist = new ArrayList(); foreach(equipment e in basesList) { if (e.validSlot == slot && e.minlvl <= level && e.maxlvl >= level) { templist.Add(e); } } tempEquipment = (equipment)templist[UnityEngine.Random.Range(0, templist.Count-1)]; } randEquipment.equipmentName = tempEquipment.equipmentName; randEquipment.equipmentType = tempEquipment.equipmentType; randEquipment.validSlot = tempEquipment.validSlot; randEquipment.maxlvl = tempEquipment.maxlvl; randEquipment.minlvl = tempEquipment.minlvl; randEquipment.flavorText = tempEquipment.flavorText; randEquipment.tier = tempEquipment.tier; randEquipment.ranged = tempEquipment.ranged; randEquipment.twohand = tempEquipment.twohand; randEquipment.onhit = tempEquipment.onhit; randEquipment.modelname = tempEquipment.modelname; randEquipment.equipmentAttributes.Add(tempEquipment.equipmentAttributes); doaffixes(randEquipment, tier); return randEquipment; }
void Start() { nativeResolution.x = Screen.width; nativeResolution.y = Screen.height; playerController = GameObject.FindWithTag("Player").GetComponent<PlayerController>(); player = GameObject.FindWithTag("Player").GetComponent<PlayerEntity>(); guiState = States.INGAME; stateMachine = new UIStateMachine((int)States.MACHINE_ROOT, this); stateMachine.AddDefaultState(new InGameUI((int)States.INGAME, this)); stateMachine.AddState(new MenuUI((int)States.MENU, this)); stateMachine.AddState(new CharacterUI((int)States.CHARACTER, this)); stateMachine.AddState(new LevelupUI((int)States.LEVELUP, this)); stateMachine.AddState(new TalentUI((int)States.TALENT, this)); stateMachine.AddState(new SpellbookUI((int)States.SPELLBOOK, this)); stateMachine.AddState(new AttributesUI((int)States.ATTRIBUTES, this)); stateMachine.AddState(new LootUI((int)States.LOOT, this)); style.normal.textColor = Color.white; draggedEquip = null; }
/// <summary> /// loads the base items from xml /// </summary> public void loadBaseItems() { equipment tempequip; #region weapons #region daggers //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Dagger", equipSlots.equipmentType.Dagger, equipSlots.slots.Main, 0, 1, 4, 0f, 0f, 0f, 0f, 10f, 40f, 0f, 2.0f, "", false, false, "", "dagger1"); basesList.Add(tempequip); tempequip = new equipment("Iron Dagger", equipSlots.equipmentType.Dagger, equipSlots.slots.Main, 0, 5, 9, 0f, 0f, 0f, 0f, 20f, 50f, 0f, 2.0f, "", false, false, "", "dagger2"); basesList.Add(tempequip); tempequip = new equipment("Steel Dagger", equipSlots.equipmentType.Dagger, equipSlots.slots.Main, 0, 10, 14, 0f, 0f, 0f, 0f, 30f, 60f, 0f, 2.0f, "", false, false, "", "dagger3"); basesList.Add(tempequip); tempequip = new equipment("Ritual Dagger", equipSlots.equipmentType.Dagger, equipSlots.slots.Main, 0, 15, 20, 0f, 0f, 0f, 0f, 40f, 70f, 0f, 2.0f, "", false, false, "", "dagger4"); basesList.Add(tempequip); #endregion #region swords //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Sword", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 0, 1, 4, 0f, 0f, 0f, 0f, 10f, 80f, 0f, 1.5f, "", false, false, "", "sword1"); basesList.Add(tempequip); tempequip = new equipment("Iron Sword", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 0, 5, 9, 0f, 0f, 0f, 0f, 20f, 90f, 0f, 1.5f, "", false, false, "", "sword2"); basesList.Add(tempequip); tempequip = new equipment("Steel Sword", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 0, 10, 14, 0f, 0f, 0f, 0f, 30f, 100f, 0f, 1.5f, "", false, false, "", "sword3"); basesList.Add(tempequip); tempequip = new equipment("Diamond Sword", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 0, 15, 20, 0f, 0f, 0f, 0f, 40f, 110f, 0f, 1.5f, "", false, false, "", "sword4"); basesList.Add(tempequip); #endregion #region clubs //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Wooden Club", equipSlots.equipmentType.Club, equipSlots.slots.Main, 0, 1, 4, 0f, 0f, 0f, 0f, 10f, 60f, 0f, 1.7f, "", false, false, "", "club1"); basesList.Add(tempequip); tempequip = new equipment("Cudgel", equipSlots.equipmentType.Club, equipSlots.slots.Main, 0, 5, 9, 0f, 0f, 0f, 0f, 20f, 70f, 0f, 1.7f, "", false, false, "", "club2"); basesList.Add(tempequip); tempequip = new equipment("Steel Mace", equipSlots.equipmentType.Club, equipSlots.slots.Main, 0, 10, 14, 0f, 0f, 0f, 0f, 30f, 80f, 0f, 1.7f, "", false, false, "", "club3"); basesList.Add(tempequip); tempequip = new equipment("Morning Star", equipSlots.equipmentType.Club, equipSlots.slots.Main, 0, 15, 20, 0f, 0f, 0f, 0f, 40f, 90f, 0f, 1.7f, "", false, false, "", "club4"); basesList.Add(tempequip); #endregion #region axes //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Axe", equipSlots.equipmentType.Axe, equipSlots.slots.Main, 0, 3, 6, 0f, 0f, 0f, 0f, 10f, 100f, 0f, 1f, "", false, false, "", "axe1"); basesList.Add(tempequip); tempequip = new equipment("Iron Axe", equipSlots.equipmentType.Axe, equipSlots.slots.Main, 0, 7, 11, 0f, 0f, 0f, 0f, 20f, 110f, 0f, 1f, "", false, false, "", "axe2"); basesList.Add(tempequip); tempequip = new equipment("Steel Axe", equipSlots.equipmentType.Axe, equipSlots.slots.Main, 0, 12, 17, 0f, 0f, 0f, 0f, 30f, 120f, 0f, 1f, "", false, false, "", "axe3"); basesList.Add(tempequip); tempequip = new equipment("Bearded Axe", equipSlots.equipmentType.Axe, equipSlots.slots.Main, 0, 18, 20, 0f, 0f, 0f, 0f, 40f, 130f, 0f, 1f, "", false, false, "", "axe4"); basesList.Add(tempequip); #endregion #region spears //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Wooden Spear", equipSlots.equipmentType.Spear, equipSlots.slots.Main, 0, 1, 4, 0f, 0f, 0f, 0f, 10f, 70f, 0f, 1.5f, "", false, false, "", "spear1"); basesList.Add(tempequip); tempequip = new equipment("Iron Spear", equipSlots.equipmentType.Spear, equipSlots.slots.Main, 0, 5, 9, 0f, 0f, 0f, 0f, 20f, 80f, 0f, 1.5f, "", false, false, "", "spear2"); basesList.Add(tempequip); tempequip = new equipment("Trident", equipSlots.equipmentType.Spear, equipSlots.slots.Main, 0, 10, 14, 0f, 0f, 0f, 0f, 30f, 90f, 0f, 1.5f, "", false, false, "", "spear3"); basesList.Add(tempequip); tempequip = new equipment("Halberd", equipSlots.equipmentType.Spear, equipSlots.slots.Main, 0, 15, 20, 0f, 0f, 0f, 0f, 40f, 100f, 0f, 1.5f, "", false, false, "", "spear4"); basesList.Add(tempequip); #endregion #region twohand //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("BIGASS SWORD", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 1, 20, 20, 0f, 0f, 0f, 0f, 10f,150f, 0f, 1f, "",true,false, "", "2hsword1"); basesList.Add(tempequip); tempequip = new equipment("BIGASS THROWING SWORD", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 1, 20, 20, 0f, 0f, 0f, 0f, 10f,150f, 0f, 1f, "",true,true, "", "2hsword1"); basesList.Add(tempequip); #endregion #endregion #region armor #region head //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Floppy Cap", equipSlots.equipmentType.ClothHelm, equipSlots.slots.Head, 0, 1, 4, 0f, 25f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Linen Hat", equipSlots.equipmentType.ClothHelm, equipSlots.slots.Head, 0, 5, 9, 0f, 60f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Silk Hat", equipSlots.equipmentType.ClothHelm, equipSlots.slots.Head, 0, 10, 14, 0f, 100f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Yarmulke", equipSlots.equipmentType.ClothHelm, equipSlots.slots.Head, 0, 15, 20, 0f, 200f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Leather Hat", equipSlots.equipmentType.LeatherHelm, equipSlots.slots.Head, 0, 1, 4, 15f, 15f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Leather Skullcap", equipSlots.equipmentType.LeatherHelm, equipSlots.slots.Head, 0, 5, 9, 35f, 35f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Tricorn", equipSlots.equipmentType.LeatherHelm, equipSlots.slots.Head, 0, 10, 14, 70f, 70f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Dragonhide Helm", equipSlots.equipmentType.LeatherHelm, equipSlots.slots.Head, 0, 15, 20, 130f, 130f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Chainmail Coif", equipSlots.equipmentType.ChainHelm, equipSlots.slots.Head, 0, 1, 4, 15f, 0f, 0f, 7f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Chainmail Coif", equipSlots.equipmentType.ChainHelm, equipSlots.slots.Head, 0, 5, 9, 35f, 0f, 0f, 13f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Chainmail Coif", equipSlots.equipmentType.ChainHelm, equipSlots.slots.Head, 0, 10, 14, 70f, 0f, 0f, 19f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Mithril Mail Coif", equipSlots.equipmentType.ChainHelm, equipSlots.slots.Head, 0, 15, 20, 130f, 0f, 0f, 25f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Battered Helm", equipSlots.equipmentType.ScaleHelm, equipSlots.slots.Head, 0, 1, 4, 20f, 0f, 0f, 5f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Sallet", equipSlots.equipmentType.ScaleHelm, equipSlots.slots.Head, 0, 5, 9, 45f, 0f, 0f, 10f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Sallet", equipSlots.equipmentType.ScaleHelm, equipSlots.slots.Head, 0, 10, 14, 85f, 0f, 0f, 15f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Greatcrown", equipSlots.equipmentType.ScaleHelm, equipSlots.slots.Head, 0, 15, 20, 140f, 0f, 0f, 20f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Barbute", equipSlots.equipmentType.PlateHelm, equipSlots.slots.Head, 0, 1, 4, 25f, 0f, 0f, 7f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Barbute", equipSlots.equipmentType.PlateHelm, equipSlots.slots.Head, 0, 5, 9, 50f, 0f, 0f, 13f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Bascinet", equipSlots.equipmentType.PlateHelm, equipSlots.slots.Head, 0, 10, 14, 100f, 0f, 0f, 19f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Mithril Greathelm", equipSlots.equipmentType.PlateHelm, equipSlots.slots.Head, 0, 15, 20, 150f, 0f, 0f, 25f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); #endregion #region chest //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Clothes", equipSlots.equipmentType.ClothArmor, equipSlots.slots.Chest, 0, 1, 4, 0f, 25f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Linen Robe", equipSlots.equipmentType.ClothArmor, equipSlots.slots.Chest, 0, 5, 9, 0f, 60f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Silk Robe", equipSlots.equipmentType.ClothArmor, equipSlots.slots.Chest, 0, 10, 14, 0f, 100f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Moonweave Robe", equipSlots.equipmentType.ClothArmor, equipSlots.slots.Chest, 0, 15, 20, 0f, 200f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Leather Jerkin", equipSlots.equipmentType.LeatherArmor, equipSlots.slots.Chest, 0, 1, 4, 15f, 15f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Leather Armor", equipSlots.equipmentType.LeatherArmor, equipSlots.slots.Chest, 0, 5, 9, 35f, 35f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Thief's Garb", equipSlots.equipmentType.LeatherArmor, equipSlots.slots.Chest, 0, 10, 14, 70f, 70f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Assassin's Garb", equipSlots.equipmentType.LeatherArmor, equipSlots.slots.Chest, 0, 15, 20, 130f, 130f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Chainmail Vest", equipSlots.equipmentType.ChainArmor, equipSlots.slots.Chest, 0, 1, 4, 15f, 0f, 0f, 7f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Chainmail Coat", equipSlots.equipmentType.ChainArmor, equipSlots.slots.Chest, 0, 5, 9, 35f, 0f, 0f, 13f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Chainmail Doublet", equipSlots.equipmentType.ChainArmor, equipSlots.slots.Chest, 0, 10, 14, 70f, 0f, 0f, 19f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Mithril Ringmail", equipSlots.equipmentType.ChainArmor, equipSlots.slots.Chest, 0, 15, 20, 130f, 0f, 0f, 25f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Scale Vest", equipSlots.equipmentType.ScaleArmor, equipSlots.slots.Chest, 0, 1, 4, 20f, 0f, 0f, 5f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Scale Doublet", equipSlots.equipmentType.ScaleArmor, equipSlots.slots.Chest, 0, 5, 9, 45f, 0f, 0f, 10f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Scale Armor", equipSlots.equipmentType.ScaleArmor, equipSlots.slots.Chest, 0, 10, 14, 85f, 0f, 0f, 15f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Wyrmscale", equipSlots.equipmentType.ScaleArmor, equipSlots.slots.Chest, 0, 15, 20, 140f, 0f, 0f, 20f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Chestplate", equipSlots.equipmentType.PlateArmor, equipSlots.slots.Chest, 0, 1, 4, 25f, 0f, 0f, 7f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Battleplate", equipSlots.equipmentType.PlateArmor, equipSlots.slots.Chest, 0, 5, 9, 50f, 0f, 0f, 13f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Chestplate", equipSlots.equipmentType.PlateArmor, equipSlots.slots.Chest, 0, 10, 14, 100f, 0f, 0f, 19f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Mithril Fullplate", equipSlots.equipmentType.PlateArmor, equipSlots.slots.Chest, 0, 15, 20, 150f, 0f, 0f, 25f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); #endregion #region legs //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Ragged Pants", equipSlots.equipmentType.ClothPants, equipSlots.slots.Legs, 0, 1, 4, 0f, 25f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Linen Pants", equipSlots.equipmentType.ClothPants, equipSlots.slots.Legs, 0, 5, 9, 0f, 60f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Silk Pants", equipSlots.equipmentType.ClothPants, equipSlots.slots.Legs, 0, 10, 14, 0f, 100f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Moonweave Pants", equipSlots.equipmentType.ClothPants, equipSlots.slots.Legs, 0, 15, 20, 0f, 200f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Leather Pants", equipSlots.equipmentType.LeatherPants, equipSlots.slots.Legs, 0, 1, 4, 15f, 15f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Leather Breeches", equipSlots.equipmentType.LeatherPants, equipSlots.slots.Legs, 0, 5, 9, 35f, 35f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Thief's Breeches", equipSlots.equipmentType.LeatherPants, equipSlots.slots.Legs, 0, 10, 14, 70f, 70f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Dragonhide Breeches", equipSlots.equipmentType.LeatherPants, equipSlots.slots.Legs, 0, 15, 20, 130f, 130f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Chainmail Chausses", equipSlots.equipmentType.ChainPants, equipSlots.slots.Legs, 0, 1, 4, 15f, 0f, 0f, 7f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Chainmail Chausses", equipSlots.equipmentType.ChainPants, equipSlots.slots.Legs, 0, 5, 9, 35f, 0f, 0f, 13f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Chainmail Chausses", equipSlots.equipmentType.ChainPants, equipSlots.slots.Legs, 0, 10, 14, 70f, 0f, 0f, 19f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Mithril Ringmail Chausses", equipSlots.equipmentType.ChainPants, equipSlots.slots.Legs, 0, 15, 20, 130f, 0f, 0f, 25f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Cuisses", equipSlots.equipmentType.ScalePants, equipSlots.slots.Legs, 0, 1, 4, 20f, 0f, 0f, 5f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Cuisses", equipSlots.equipmentType.ScalePants, equipSlots.slots.Legs, 0, 5, 9, 40f, 0f, 0f, 10f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Cuisses", equipSlots.equipmentType.ScalePants, equipSlots.slots.Legs, 0, 10, 14, 85f, 0f, 0f, 15f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Wyrmscale Cuisses", equipSlots.equipmentType.ScalePants, equipSlots.slots.Legs, 0, 15, 20, 140f, 0f, 0f, 20f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Faulds", equipSlots.equipmentType.PlatePants, equipSlots.slots.Legs, 0, 1, 4, 25f, 0f, 0f, 7f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Faulds", equipSlots.equipmentType.PlatePants, equipSlots.slots.Legs, 0, 5, 9, 50f, 0f, 0f, 13f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Faulds", equipSlots.equipmentType.PlatePants, equipSlots.slots.Legs, 0, 10, 14, 100f, 0f, 0f, 19f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Mithril Legplates", equipSlots.equipmentType.PlatePants, equipSlots.slots.Legs, 0, 15, 20, 150f, 0f, 0f, 25f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); #endregion #region feet //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Footwraps", equipSlots.equipmentType.ClothShoes, equipSlots.slots.Feet, 0, 1, 4, 0f, 25f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Linen Slippers", equipSlots.equipmentType.ClothShoes, equipSlots.slots.Feet, 0, 5, 9, 0f, 60f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Silk Slippers", equipSlots.equipmentType.ClothShoes, equipSlots.slots.Feet, 0, 10, 14, 0f, 100f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Moonweave Slippers", equipSlots.equipmentType.ClothShoes, equipSlots.slots.Feet, 0, 15, 20, 0f, 200f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Leather Shoes", equipSlots.equipmentType.LeatherShoes, equipSlots.slots.Feet, 0, 1, 4, 15f, 15f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Leather Boots", equipSlots.equipmentType.LeatherShoes, equipSlots.slots.Feet, 0, 5, 9, 35f, 35f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Thief's Shoes", equipSlots.equipmentType.LeatherShoes, equipSlots.slots.Feet, 0, 10, 14, 70f, 70f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Dragonhide Boots", equipSlots.equipmentType.LeatherShoes, equipSlots.slots.Feet, 0, 15, 20, 130f, 130f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Chain Boots", equipSlots.equipmentType.ChainShoes, equipSlots.slots.Feet, 0, 1, 4, 15f, 0f, 0f, 7f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Chain Boots", equipSlots.equipmentType.ChainShoes, equipSlots.slots.Feet, 0, 5, 9, 35f, 0f, 0f, 13f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Chain Boots", equipSlots.equipmentType.ChainShoes, equipSlots.slots.Feet, 0, 10, 14, 70f, 0f, 0f, 19f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Mithril Ringmail Boots", equipSlots.equipmentType.ChainShoes, equipSlots.slots.Feet, 0, 15, 20, 130f, 0f, 0f, 25f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Sabatons", equipSlots.equipmentType.ScaleShoes, equipSlots.slots.Feet, 0, 1, 4, 20f, 0f, 0f, 5f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Sabatons", equipSlots.equipmentType.ScaleShoes, equipSlots.slots.Feet, 0, 5, 9, 40f, 0f, 0f, 10f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Sabatons", equipSlots.equipmentType.ScaleShoes, equipSlots.slots.Feet, 0, 10, 14, 85f, 0f, 0f, 15f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Wyrmscale Sabatons", equipSlots.equipmentType.ScaleShoes, equipSlots.slots.Feet, 0, 15, 20, 140f, 0f, 0f, 20f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Rusty Greaves", equipSlots.equipmentType.PlateShoes, equipSlots.slots.Feet, 0, 1, 4, 25f, 0f, 0f, 7f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Greaves", equipSlots.equipmentType.PlateShoes, equipSlots.slots.Feet, 0, 5, 9, 50f, 0f, 0f, 13f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Greaves", equipSlots.equipmentType.PlateShoes, equipSlots.slots.Feet, 0, 10, 14, 100f, 0f, 0f, 19f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Mithril Greaves", equipSlots.equipmentType.PlateShoes, equipSlots.slots.Feet, 0, 15, 20, 150f, 0f, 0f, 25f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); #endregion #region offhand //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Hide Buckler", equipSlots.equipmentType.SmallShield, equipSlots.slots.Off, 0, 1, 4, 10f, 0f, 0f, 2f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Iron Buckler", equipSlots.equipmentType.SmallShield, equipSlots.slots.Off, 0, 5, 9, 25f, 0f, 0f, 5f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Studded Round Shield", equipSlots.equipmentType.SmallShield, equipSlots.slots.Off, 0, 10, 14, 50f, 0f, 0f, 9f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Ironwood Round Shield", equipSlots.equipmentType.SmallShield, equipSlots.slots.Off, 0, 15, 20, 100f, 0f, 0f, 14f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Lashed Planks", equipSlots.equipmentType.LargeShield, equipSlots.slots.Off, 0, 1, 4, 15f, 15f, 0f, 7f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Kite Shield", equipSlots.equipmentType.LargeShield, equipSlots.slots.Off, 0, 5, 9, 35f, 35f, 0f, 13f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Steel Tower Shield", equipSlots.equipmentType.LargeShield, equipSlots.slots.Off, 0, 10, 14, 70f, 70f, 0f, 19f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Mythril Greatshield", equipSlots.equipmentType.LargeShield, equipSlots.slots.Off, 0, 15, 20, 130f, 130f, 0f, 26f, 0f, 0f, -0.1f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Moldy Spellbook", equipSlots.equipmentType.Book, equipSlots.slots.Off, 0, 1, 4, 0f, 15f, 0f, 5f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Forgotten Folio", equipSlots.equipmentType.Book, equipSlots.slots.Off, 0, 5, 9, 0f, 30f, 0f, 10f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Fiendish Codex", equipSlots.equipmentType.Book, equipSlots.slots.Off, 0, 10, 14, 0f, 45f, 0f, 15f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Forbidden Text", equipSlots.equipmentType.Book, equipSlots.slots.Off, 0, 15, 20, 0f, 60f, 0f, 20f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Dun Orb", equipSlots.equipmentType.Orb, equipSlots.slots.Off, 0, 1, 4, 0f, 30f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Glass Sphere", equipSlots.equipmentType.Orb, equipSlots.slots.Off, 0, 5, 9, 0f, 60f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Crystal Ball", equipSlots.equipmentType.Orb, equipSlots.slots.Off, 0, 10, 14, 0f, 90f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); tempequip = new equipment("Quicksilver Globe", equipSlots.equipmentType.Orb, equipSlots.slots.Off, 0, 15, 20, 0f, 120f, 0f, 0f, 0f, 0f, 0f, 0f, ""); basesList.Add(tempequip); #endregion #endregion #region uniques //NAME TYPE SLOT tier level h r p d mndg mxdg ms as flavortext tempequip = new equipment("Dux's Leek", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 3, 1, 20, 0f, 0f, 0f, 0f, 1f, 1f, 0f, 1f, "Able to CUT the mightiest bush!"); uniqueslist.Add(tempequip); tempequip = new equipment("Shankin' Stick", equipSlots.equipmentType.Dagger, equipSlots.slots.Main, 3, 1, 4, 0f, 0f, 0f, 0f, 20f, 50f, 0.5f, 2f, "Dis end da pointy one!"); uniqueslist.Add(tempequip); tempequip = new equipment("Mirror Shard", equipSlots.equipmentType.Dagger, equipSlots.slots.Main, 3, 5, 9, 50f, 0f, 0f, 0f, 30f, 60f, 0.5f, 2.0f, "There isn't really a good way to hold this thing."); uniqueslist.Add(tempequip); tempequip = new equipment("McStabby", equipSlots.equipmentType.Dagger, equipSlots.slots.Main, 3, 10, 15, 0f, 10f, 0f, 10f, 40f, 70f, 0f, 2.0f, "Cut the onions, extra cheese."); uniqueslist.Add(tempequip); tempequip = new equipment("Vivisector", equipSlots.equipmentType.Dagger, equipSlots.slots.Main, 3, 15, 20, 0f, 100f, 0f, 0f, 50f, 80f, 0f, 2.0f, "This valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin, van guarding vice and vouchsafing the violently vicious and voracious violation of volition."); uniqueslist.Add(tempequip); tempequip = new equipment("Swoop's Revenge", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 3, 1, 4, 50f, 0f, 0f, 0f, 20f, 90f, 0f, 1.5f, "Who names their kid 'Swoop'?"); uniqueslist.Add(tempequip); tempequip = new equipment("The Bing Toolbar", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 3, 5, 9, 20f, 100f, 0f, 0f, 30f,100f, 0f, 1.5f, "As painful as it is frustrating"); uniqueslist.Add(tempequip); tempequip = new equipment("Moonflair Spellblade", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 3, 10, 15, 0f, 100f, 0f, 10f, 40f,110f, 0f, 1.5f, "What is this, 2009?"); uniqueslist.Add(tempequip); tempequip = new equipment("Darkin Blade", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 3, 15, 20, 0f, 0f, 0f, 0f, 50f,120f, 0f, 1.5f, "Don't cut yourself, 'cause this is SO EDGY"); uniqueslist.Add(tempequip); tempequip = new equipment("The Wrecking Stick", equipSlots.equipmentType.Club, equipSlots.slots.Main, 3, 1, 4, 0f, 0f, 20f, 0f, 20f, 70f, 0f, 1.7f, "This stick reckon's you're in the wrong town..."); uniqueslist.Add(tempequip); tempequip = new equipment("Mace of Spades", equipSlots.equipmentType.Club, equipSlots.slots.Main, 3, 5, 9, 40f, 40f, 0f, 0f, 30f, 80f, 0f, 1.7f, "You win some, lose some, all the same to me."); uniqueslist.Add(tempequip); tempequip = new equipment("The Louisville Pulverizer", equipSlots.equipmentType.Club, equipSlots.slots.Main, 3, 10, 15, 0f, 0f, 15f, 0f, 40f, 90f, 0.3f, 1.7f, "It's one, two, three strikes you're dead"); uniqueslist.Add(tempequip); tempequip = new equipment("The Tenderizer", equipSlots.equipmentType.Club, equipSlots.slots.Main, 3, 15, 20, 50f, 0f, 10f, 0f, 50f,115f, 0f, 1.7f, "It'll tenderize them so good, they'll fall apart right in front of you. Taste not Guaranteed."); uniqueslist.Add(tempequip); tempequip = new equipment("Boneprow", equipSlots.equipmentType.Axe, equipSlots.slots.Main, 3, 3, 6, 50f, 0f, 0f, 20f, 20f,110f, 0f, 1.0f, "Not actually part of a ship. Or made of bones."); uniqueslist.Add(tempequip); tempequip = new equipment("Noun's Axe of Verbing", equipSlots.equipmentType.Axe, equipSlots.slots.Main, 3, 7, 11, 30f, 30f, 10f, 10f, 31f,121f, 0.01f, 1.01f, "For those who want to cut the nerd crap"); uniqueslist.Add(tempequip); tempequip = new equipment("The Jacked Axe", equipSlots.equipmentType.Axe, equipSlots.slots.Main, 3, 12, 17, 0f, 0f, 50f, 0f, 0f,140f, 0f, 1.0f, "Do you even lift, brah?"); uniqueslist.Add(tempequip); tempequip = new equipment("The Chillaxe", equipSlots.equipmentType.Axe, equipSlots.slots.Main, 3, 18, 20, 100f, 0f, 10f, 0f, 50f,145f, 0f, 1.0f, "You need to chill, bro"); uniqueslist.Add(tempequip); tempequip = new equipment("Phil", equipSlots.equipmentType.Spear, equipSlots.slots.Main, 3, 1, 4, 50f, 50f, 0f, 0f, 20f, 80f, 0f, 1.5f, "Literally fedora."); uniqueslist.Add(tempequip); tempequip = new equipment("Gáe Bolga", equipSlots.equipmentType.Spear, equipSlots.slots.Main, 3, 5, 9, 0f, 0f, 0f, 0f, 35f, 95f, 0.3f, 1.5f, "A terrible barbed spear, said to be impossible to pull from its victim."); uniqueslist.Add(tempequip); tempequip = new equipment("Gungnir", equipSlots.equipmentType.Spear, equipSlots.slots.Main, 3, 10, 15, 0f, 0f, 15f, 15f, 40f,100f, 0f, 1.5f, "Thought lost in the stomach of a giant wolf"); uniqueslist.Add(tempequip); tempequip = new equipment("Hades' Pitchfork", equipSlots.equipmentType.Spear, equipSlots.slots.Main, 3, 15, 20, 0f,1000f, 0f, 0f, 50f,110f, 0f, 1.5f, "The fire makes it great for a weapon, but pretty useless as a pitchfork."); uniqueslist.Add(tempequip); tempequip = new equipment("ONHITTEST", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 3, 1, 20, 0, 0, 0, 0, 5, 5, 0, 1, "testing onhits", false, false, "onhitnormal"); uniqueslist.Add(tempequip); tempequip = new equipment("Sword of the 37th King", equipSlots.equipmentType.Sword, equipSlots.slots.Main, 3, 15, 20, 0f, 0, 0f, 0f, 60f, 90f, 0.2f, 1.7f, "The ██████████ it █████ for ████████, but ██████████ as ███████████."); uniqueslist.Add(tempequip); tempequip = new equipment("Tailored Suit of the 37th King", equipSlots.equipmentType.ClothArmor, equipSlots.slots.Chest, 3, 15, 20, 40f, 60f, 0f, 0f, 0f, 0f, 0.2f, 0.0f, "You ██████, ████████████ ██████, all the █████████ █████████ ██████."); uniqueslist.Add(tempequip); #endregion #region legacy xml loading /* //xml reading stuff. this is probably a jank way to do it, but IT WORKS XmlDocument equipList = new XmlDocument(); XmlReader reader = new XmlTextReader("Assets/Scripts/equipmentList.xml"); try { equipList.Load("Assets/Scripts/equipmentList.xml"); } catch { Debug.Log("equipmentlist fail"); } //Debug.Log("after load"); //Debug.Log(equipList.InnerXml); XmlNode root = equipList.ReadNode(reader); XmlNodeList bases = root.SelectNodes("type"); //this is for each item in the file foreach(XmlNode item in bases) { //Debug.Log("in foreach"); equipment newE = new equipment(); XmlNode tempnode = item.SelectSingleNode("name"); //Debug.Log(tempnode.InnerText); //since this is base, with no affixes, the item name and type are the same newE.equipmentName = tempnode.InnerText; newE.equipmentType = tempnode.InnerText; tempnode = item.SelectSingleNode("slot"); newE.setslot(tempnode.InnerText); //Debug.Log(tempnode.InnerText); //min and max lvl tempnode = item.SelectSingleNode("minlvl"); newE.minlvl = int.Parse(tempnode.InnerText); tempnode = item.SelectSingleNode("maxlvl"); newE.maxlvl = int.Parse(tempnode.InnerText); //tier and flavor text if (item.SelectSingleNode("tier") != null) { tempnode = item.SelectSingleNode("tier"); newE.tier = int.Parse(tempnode.InnerText); } if (item.SelectSingleNode("flavor") != null) { tempnode = item.SelectSingleNode("flavor"); newE.flavorText = tempnode.InnerText; } //this is for each attribute for each item XmlNodeList atts = item.SelectNodes("attribute"); foreach(XmlNode att in atts) { //this is a bit wierd, there probably is a better way to do this if(att.InnerText == "Health") { newE.equipmentAttributes.Health += float.Parse(att.Attributes.GetNamedItem("value").InnerText); } else if (att.InnerText == "Power") { newE.equipmentAttributes.Power += float.Parse(att.Attributes.GetNamedItem("value").InnerText); } else if (att.InnerText == "Resource") { newE.equipmentAttributes.Resource += float.Parse(att.Attributes.GetNamedItem("value").InnerText); } else if (att.InnerText == "MoveSpeed") { newE.equipmentAttributes.MovementSpeed += float.Parse(att.Attributes.GetNamedItem("value").InnerText); } else if (att.InnerText == "Defense") { newE.equipmentAttributes.Defense += float.Parse(att.Attributes.GetNamedItem("value").InnerText); } else if (att.InnerText == "AttackSpeed") { newE.equipmentAttributes.AttackSpeed += float.Parse(att.Attributes.GetNamedItem("value").InnerText); } else if (att.InnerText == "MinDamage") { newE.equipmentAttributes.MinDamage += float.Parse(att.Attributes.GetNamedItem("value").InnerText); } else if (att.InnerText == "MaxDamage") { newE.equipmentAttributes.MaxDamage += float.Parse(att.Attributes.GetNamedItem("value").InnerText); } else { Debug.Log("CAUTION: " + att.InnerText + " is not in the Factory!"); } //Debug.Log(att.InnerText + " " + att.Attributes.GetNamedItem("value").InnerText); } if (newE.tier == 0) { basesList.Add(newE); } else if (newE.tier == 3) { uniqueslist.Add(newE); } } * */ #endregion }
/// <summary> /// Method for saving an equipment to playerprefs /// </summary> /// <param name="i">the ID of the equipment in storage</param> /// <param name="item"> the equipment to store</param> /// <returns></returns> public void saveequipment(string i, equipment item) { PlayerPrefs.SetString(i + "name", item.equipmentName); PlayerPrefs.SetString(i + "type", item.equipmentType.ToString()); PlayerPrefs.SetString(i + "slot", item.validSlot.ToString()); PlayerPrefs.SetInt(i + "tier", item.tier); PlayerPrefs.SetInt(i + "minlvl", item.minlvl); PlayerPrefs.SetInt(i + "maxlvl", item.maxlvl); PlayerPrefs.SetFloat(i + "health", item.equipmentAttributes.Health); PlayerPrefs.SetFloat(i + "resource", item.equipmentAttributes.Resource); PlayerPrefs.SetFloat(i + "power", item.equipmentAttributes.Power); PlayerPrefs.SetFloat(i + "defense", item.equipmentAttributes.Defense); PlayerPrefs.SetFloat(i + "mindmg", item.equipmentAttributes.MinDamage); PlayerPrefs.SetFloat(i + "maxdmg", item.equipmentAttributes.MaxDamage); PlayerPrefs.SetFloat(i + "movespeed", item.equipmentAttributes.MovementSpeed); PlayerPrefs.SetFloat(i + "attackspeed", item.equipmentAttributes.AttackSpeed); PlayerPrefs.SetString(i + "flavortext", item.flavorText); if (item.twohand == true) { PlayerPrefs.SetInt(i + "istwohand", 1); } else { PlayerPrefs.SetInt(i + "istwohand", 0); } if (item.ranged == true) { PlayerPrefs.SetInt(i + "isranged", 1); } else { PlayerPrefs.SetInt(i + "isranged", 0); } PlayerPrefs.SetString(i + "onhitability", item.onhit); PlayerPrefs.SetString(i + "modelname", item.modelname); PlayerPrefs.SetString(i + "prefixname", item.prefixname); PlayerPrefs.SetString(i + "suffixname", item.suffixname); }
void RightClickUnEquip(equipment item) { Controller.Player.removeEquipment(item.validSlot); }
void OnWindow(int windowID) { #region Mouse in GUI check Vector2 mPos = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y); if (mPos.x > windowDimensions.x && mPos.x < windowDimensions.width + windowDimensions.x && mPos.y > windowDimensions.y && mPos.y < windowDimensions.height + windowDimensions.y) { Controller.PlayerController.MouseOverGUI = true; } else { Controller.PlayerController.MouseOverGUI = false; } #endregion slotRects = new Dictionary<Rect, equipment>(); yOffset = 30; // Equipment slots. GUILayout.BeginArea(new Rect(5, 20, WIDTH, 300)); for (int i = 0; i < EQUIPMENT_SLOTS; i += 2) { Rect thisRect = new Rect(5, yOffset, 50, 50); if (Controller.Player.EquippedEquip.ContainsKey(((equipSlots.slots)i))) { GUI.Box(thisRect, new GUIContent(Controller.Player.EquippedEquip[((equipSlots.slots)i)].equipmentName)); Drag(Controller.Player.EquippedEquip[((equipSlots.slots)i)], thisRect); slotRects.Add(thisRect, Controller.Player.EquippedEquip[((equipSlots.slots)i)]); if (thisRect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseUp && Event.current.button == 1 && Event.current.shift == true) { deleteItem = Controller.Player.EquippedEquip[((equipSlots.slots)i)]; } else if (thisRect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseUp && Event.current.button == 1) { equipItem = Controller.Player.EquippedEquip[((equipSlots.slots)i)]; } } else { GUI.Box(thisRect, new GUIContent(((equipSlots.slots)i).ToString())); slotRects.Add(thisRect, null); } DropToEquip(thisRect, i); //GUILayout.Space(WIDTH - 115); thisRect = new Rect((WIDTH - 65), yOffset, 50, 50); if (Controller.Player.EquippedEquip.ContainsKey(((equipSlots.slots)i+1))) { GUI.Box(thisRect, new GUIContent(Controller.Player.EquippedEquip[((equipSlots.slots)i+1)].equipmentName)); Drag(Controller.Player.EquippedEquip[((equipSlots.slots)i+1)], thisRect); slotRects.Add(thisRect, Controller.Player.EquippedEquip[((equipSlots.slots)i + 1)]); if (thisRect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseUp && Event.current.button == 1 && Event.current.shift == true) { deleteItem = Controller.Player.EquippedEquip[((equipSlots.slots)i+1)]; } else if (thisRect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseUp && Event.current.button == 1) { equipItem = Controller.Player.EquippedEquip[((equipSlots.slots)i+1)]; } } else { GUI.Box(thisRect, new GUIContent(((equipSlots.slots)i+1).ToString())); slotRects.Add(thisRect, null); } DropToEquip(thisRect, i + 1); yOffset += 100; } if (equipItem != null) { RightClickUnEquip(equipItem); equipItem = null; } if (deleteItem != null) { DeleteItem(deleteItem); deleteItem = null; } TooltipEquipment(slotRects); GUILayout.EndArea(); //selection = GUI.Toolbar(new Rect(10, 300, WIDTH - 20, 50), selection, HEADERS); #region Inventory Area slotRects = new Dictionary<Rect, equipment>(); int viewSize = (Controller.Player.Inventory.Max * ((totalInvWidth / rowLength) + 2)) / rowLength; Rect viewArea = new Rect(0, 0, 10, viewSize); scrollViewVector = GUI.BeginScrollView(new Rect(10, 320, WIDTH - 10, 180), scrollViewVector, viewArea); yOffset = 0; xOffset = 0; for (int i = 0; i < Controller.Player.Inventory.Max; i++ ) { if (i != 0 && i % rowLength == 0) { yOffset += (totalInvWidth / rowLength) + 2; xOffset = 0; } Rect thisRect = new Rect(xOffset, yOffset, totalInvWidth / rowLength, totalInvWidth / rowLength); if (i < Controller.Player.Inventory.Items.Count) { GUI.Box(thisRect, Controller.Player.Inventory.Items[i].equipmentName); Drag(Controller.Player.Inventory.Items[i], thisRect); slotRects.Add(thisRect, Controller.Player.Inventory.Items[i]); if (thisRect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseUp && Event.current.button == 1 && Event.current.shift == true) { deleteItem = Controller.Player.Inventory.Items[i]; } else if (thisRect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseUp && Event.current.button == 1) { equipItem = Controller.Player.Inventory.Items[i]; } } else { GUI.Box(thisRect, ""); DropToUnequip(thisRect); slotRects.Add(thisRect, null); } xOffset += (totalInvWidth / rowLength) + 4; } if (equipItem != null) { RightClickEquip(equipItem); equipItem = null; } if (deleteItem != null) { DeleteItem(deleteItem); deleteItem = null; } TooltipInventory(slotRects); GUI.EndScrollView(); #endregion }
void DeleteItem(equipment item) { if (Controller.Player.EquippedEquip.ContainsKey(item.validSlot)) { Controller.Player.removeEquipment(item.validSlot); } Controller.Player.Inventory.RemoveItem(item); }
public void EquipItem(equipment item) { equippedItems[(int)item.validSlot] = item; items.Remove(item); }
public void RemoveItem(equipment item) { items.Remove(item); }
void Drag(equipment draggingEquip, Rect draggingRect) { //To Drag: //Check to see if the current event type is MouseDown and if the mouse position of the current event is inside the target rect. If it is, assign the target ability to a temporary variable that can be accessed from where you will be dropping the ability later. if (Event.current.type == EventType.MouseDown && draggingRect.Contains(Event.current.mousePosition) && Controller.DraggedEquip == null && Event.current.button == 0) { Controller.DraggedEquip = draggingEquip; } }
void Loot(equipment thisItem) { Controller.ChestInventory.RemoveItem(thisItem); Controller.Player.Inventory.AddItem(thisItem); }
void DropToEquip(Rect overRect, int slotIndex) { equipSlots.slots thisSlot = ((equipSlots.slots)slotIndex); //To Drop: //Check to see if the current event type is MouseUp and if the mouse position of the current event is inside the target rect. If it is, perform the necessary operation (in this case, replacing the currently slotted ability with the dragged ability) and set the temporary variable to null. if (Event.current.type == EventType.MouseUp && overRect.Contains(Event.current.mousePosition) && Controller.DraggedEquip != null) { if(thisSlot == Controller.DraggedEquip.validSlot) { if (Controller.Player.EquippedEquip.ContainsKey(thisSlot)) { Controller.Player.removeEquipment(thisSlot); } Controller.Player.addEquipment(Controller.DraggedEquip); } Controller.DraggedEquip = null; hoverEquip = null; } }
/// <summary> /// Method for loading an equipment from playerprefs /// </summary> /// <param name="i">the ID of the equipment in storage</param> /// <returns></returns> public equipment loadequipment(string i) { if (!PlayerPrefs.HasKey(i + "name")) return null; equipment tempequip = new equipment(PlayerPrefs.GetString(i + "name"), (equipSlots.equipmentType)Enum.Parse(typeof(equipSlots.equipmentType), PlayerPrefs.GetString(i + "type"), true), (equipSlots.slots)Enum.Parse(typeof(equipSlots.slots), PlayerPrefs.GetString(i + "slot"), true), PlayerPrefs.GetInt(i + "tier"), PlayerPrefs.GetInt(i + "minlvl"), PlayerPrefs.GetInt(i + "maxlvl"), PlayerPrefs.GetFloat(i + "health"), PlayerPrefs.GetFloat(i + "resource"), PlayerPrefs.GetFloat(i + "power"), PlayerPrefs.GetFloat(i + "defense"), PlayerPrefs.GetFloat(i + "mindmg"), PlayerPrefs.GetFloat(i + "maxdmg"), PlayerPrefs.GetFloat(i + "movespeed"), PlayerPrefs.GetFloat(i + "attackspeed"), PlayerPrefs.GetString(i + "flavortext"), Convert.ToBoolean(PlayerPrefs.GetInt(i + "istwohand")), Convert.ToBoolean(PlayerPrefs.GetInt(i + "isranged")), PlayerPrefs.GetString(i + "onhitability"), PlayerPrefs.GetString(i+ "modelname"), PlayerPrefs.GetString(i+"prefixname"), PlayerPrefs.GetString(i+"suffixname")); return tempequip; }
private void doaffixes(equipment randEquipment, int tier) { //one affix if (tier == 1) { affix tempaffix; tempaffix = getrandaffix(randEquipment.validSlot); //make the name correctly if (tempaffix.affixType == equipSlots.affixtype.Suffix) { randEquipment.equipmentName = randEquipment.equipmentName + " " + tempaffix.affixName; randEquipment.suffixname = tempaffix.affixName; } else if (tempaffix.affixType == equipSlots.affixtype.Prefix) { randEquipment.equipmentName = tempaffix.affixName + " " + randEquipment.equipmentName; randEquipment.prefixname = tempaffix.affixName; } //add its attributes to the equipment randEquipment.equipmentAttributes.Add(tempaffix.affixAttributes); } else if (tier == 2) { //two affixes //rollin dem bones affix tempaffix; tempaffix = getrandaffix(randEquipment.validSlot, equipSlots.affixtype.Prefix); //add it to the equipment randEquipment.equipmentName = tempaffix.affixName + " " + randEquipment.equipmentName; randEquipment.equipmentAttributes.Add(tempaffix.affixAttributes); randEquipment.prefixname = tempaffix.affixName; //roll for a suffix tempaffix = getrandaffix(randEquipment.validSlot, equipSlots.affixtype.Suffix); //add it on randEquipment.equipmentName = randEquipment.equipmentName + " " + tempaffix.affixName; randEquipment.equipmentAttributes.Add(tempaffix.affixAttributes); randEquipment.suffixname = tempaffix.affixName; } }