Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2014, 04:53 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 114,875
Kyttias is on a distinguished road
Question Item 'Rarity' Column

I'd like to add a column to the item table in the database, and make sure its included properly in places like class_item.php, so it can be rendered in shop and inventory pages. It also needs to be included in the admin back end when an item is created.

So~ just how many pages will I need to be editing/how painful is this going to be? Should I just basically be imitating how categories are done?

The rarity will initially be used as a visual indicator of how potent or costly the item is. Later, when I make a system that will dispense random items from a specific category, the rarity will determine the percent chance you will end up having that random item dispensed.

-

In phpMyAdmin, I already added the column to the database with -
Code:
ALTER TABLE `adopts_items` ADD `rarity` VARCHAR(40) NOT NULL DEFAULT 'common' ;
- and this will allow all current items to have a 'common' rarity, and all future items to be such as well, if a rarity is not supplied when the item is created.

-

OK NVM. Apparently that was literally all I needed to do. I can already use {$item->rarity}. For example, in inventoryview.php, all I had to do was add rarity to the headers -
PHP Code:
$inventoryTable->buildHeaders("Image""Category""Name""Description""Rarity""Quantity""Use""Sell""Toss"); 
- and then add it to the table (I added it after description).
PHP Code:
$cells->add(new TCell($item->rarity)); 
-

SO all I have left to do is make it so I can add the rarity on the admin end during item creation...
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 11-08-2014 at 05:26 PM.
Reply With Quote
  #2  
Old 11-08-2014, 05:31 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 21,274
IntoRain is on a distinguished road
Default

Quote:
Originally Posted by Kyttias View Post

SO all I have left to do is make it so I can add the rarity on the admin end during item creation...

Yeah, it's pretty easy to do, so don't worry! To put a field for rarity in the item creation on the acp you just need to edit the add() function in itemview.php and item.php (inside admincp folder). In itemview.php add the field to ask for a rarity and in item.php add the rarity field in $mysidia->db->insert(), and it should be done
__________________


asp.net stole my soul.
Reply With Quote
  #3  
Old 11-08-2014, 06:27 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 114,875
Kyttias is on a distinguished road
Default

Surprisingly painless! Thanks.

Eurghhh... Unrelated:

I renamed an item I already owned, so now my inventory is throwing a fit. Looks like even though we can rename items, we really can't - with the way the system works, it checks if an item exists by its name instead of by its id. So now I have to go into the database and edit by hand every instance of that item in adopts_inventory for all users to the new name, else their inventories will throw an error.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #4  
Old 11-08-2014, 06:51 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 21,274
IntoRain is on a distinguished road
Default

Quote:
Originally Posted by Kyttias View Post
Surprisingly painless! Thanks.

Eurghhh... Unrelated:

I renamed an item I already owned, so now my inventory is throwing a fit. Looks like even though we can rename items, we really can't - with the way the system works, it checks if an item exists by its name instead of by its id. So now I have to go into the database and edit by hand every instance of that item in adopts_inventory for all users to the new name, else their inventories will throw an error.
In the edit item function (item.php in admincp), maybe you can add a database update that changes the item name in the inventory table as well
__________________


asp.net stole my soul.
Reply With Quote
Reply

Tags
items, rarity


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mys v1.3.4 Item Shop Mod(s): NPC + Item Display + Tooltips Kyttias Mys v1.3.x Mods 55 06-19-2020 12:21 PM
Edit rarity code for 1.3.2 to the 1.3.3 script kristhasirah Questions and Supports 5 04-22-2015 12:36 PM
A 2-column table? Quillink Suggestions and Feature Requests 8 09-23-2010 03:26 PM
Adding a column to owned_adoptables? Tkrules Questions and Supports 1 01-22-2010 11:02 PM


All times are GMT -5. The time now is 07:45 PM.

Currently Active Users: 531 (0 members and 531 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636