![]() |
#1
|
||||
|
||||
![]()
Is it possible to have items be in shops only during certain time periods? For example - if we wanted to create holiday items?
I think this would be a great addition to the site and I was hoping for a shove in the right direction before I start. There are three different ideas I have, but I'm not sure which one I'll share to the community (hopefully all three!): 1- An ordinary shop that, in addition to it's normal stock, also has some stock only available on holidays. (I'd like to do this, because the technique would be good for what I want to do with my shops.) - Medium 2- A holiday-only shop (ala Flight Rising's "Festive Favors" shop, only without the unique currency, yet anyway) that has different stock entirely based on an event period and is otherwise closed for business. It is open on every holiday, but only holidays, and has stock based on that holiday only. (I'd like this to be semi-automated, that way items can be ready to go in advance and I don't have to be online to open the shop at midnight manually. Just visiting the shop directory or the shop's link directly would be enough to trigger a rollover from Closed to Open status, at least on appropriate days) - Hard 3- A single holiday shop that does not have alternate stock and is only open for one, single event. (I find this to be the easiest and probably would not need help with implementing it.) - Easy All of this also might leans towards the start of shops that 'stock' in a way more like existing games do, down the road, anyway. You know, limited quantities of certain items and they restock based on set intervals and a slightly random array? I'd like to see more done with shops in the future. ^^
__________________
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; 12-24-2014 at 11:49 PM. |
#2
|
||||
|
||||
![]()
*jumps in to say 'great ideas' and then jumps out again* ;)
|
#3
|
||||
|
||||
![]()
well, for having the item only available on Holidays...you could probably look in at the function that allows you to have a pet released at a certain date...maybe take a look at that code and piece it out a bit.
You could also work that out with Item classes. I was going to look into classes myself, once I work on adding a Stats feature, but I don't know anything about them right now, so can't be of much help, apologies. Happy Holidays, at any rate :)
__________________
My Mods Site (1.3.4, 2020 Mods) |
#4
|
||||
|
||||
![]()
I coded something similar to #2, it should work properly but if you find a bug tell me.
How it works: You add a new table to your database with the events your site has. These events have a start and end date. The good thing to this table is that you can use these events for other things you want to change in your site during holidays! Then you associate your "holiday" shops with the various events they are open in, in the database. Then you associate your holiday items with a holiday shop and an event as well. When the shops are displayed, the server checks if any of the events they are associated with, if any, are active. If not, the shop is closed. If one is active, the shop is open. Shops without any events associated work like normal shops. Entering the shop, the server loads the items that belong to that shop and to the current event. Important: I only did this to the Itemshop so far, not Adoptshop Important: I did no Admincp option for this, so you will have to manually edit the database with the stuff you want. I will try to add this mod to the Admincp sometime later Also guys feel free to add in the stuff missing yourself or make any changes at all to fit your site and your ideas. How to do this: Database 1) First, add a new table to your database called [prefix]_events. Please note [prefix] is your database prefix, what all your tables begin with. For example, all my tables begin with 'adopts', because it's mysidia's default upon installation. Fields:
Note: Both startson and endson will be in the format Day-Month. If you switch to Month-Day some functions won't work anymore. Note2: If your startson is 24-12 (24 December) and endson is 28-12 (28 December), that means the shop will run on the 24, 25, 26 and 27. Once it's 28, the shop will be inactive. Example: Below is the structure and contents of my table adopts_events. ![]() 2) Now go to your table [prefix]_items and add the following column:
Items with an eventid of -1 don't belong in any event. Items with an eventid > 0 belong in an event. Example: For example, in the image above, you can see the eid of my Christmas event is 1. So I added an item to a store called "Holliday Items" with an eventid of 1. That means that item will be sold in the store Holliday Items only when it's Christmas (eventid = 1). If I had put an eventid of 3, it would appear on Valentine's Day, etc. It depends on the events you added to your [prefix]_events table and their eid. ![]() 3) Now go to your [prefix]_shops table and add in this new column:
In this column, you will put event IDs (eid from [prefix]_events table) separated by commas (no spaces between them). If the shop is not event-only, put 'none' instead. Example: For example, if I wanted a shop open on Christmas and Halloween, since the eid for those events are 1 and 2 in my events table, I have to put "1,2" on that column. If I just wanted Christmas, I'd put "1". If I wanted all my 3 events I created I have to put "1,2,3". ![]() Files 1) Create the file class_event.php (inside classes folder) with these contents: PHP Code:
2) Edit the file class_item.php like this: class_item.php PHP Code:
class_itemshop.php PHP Code:
I tested with a few different dates, but if you detect any bugs please tell me.
__________________
![]() ![]() ![]() asp.net stole my soul. Last edited by IntoRain; 12-25-2014 at 04:41 PM. |
#5
|
||||
|
||||
![]()
Wow! Looks great! I'll test it out right away.
And if I wanted a one-day only event, the start date would be the day of the event, and the end date should be set to the day after? Right?
__________________
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. |
#6
|
||||
|
||||
![]() Quote:
Yes, that would be it ^^
__________________
![]() ![]() ![]() asp.net stole my soul. |
![]() |
Tags |
holiday shop |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Shops | voni | Questions and Supports | 3 | 04-22-2015 02:01 PM |
Help !! Shops not appearing é.è | kitty08 | Feedback and Suggestions | 3 | 12-31-2014 11:15 AM |
Help with shops. | Nieth | Questions and Supports | 5 | 11-26-2013 05:15 AM |
Forum Shops? | AlexC | Feedback and Suggestions | 6 | 05-09-2012 03:28 PM |
Again Shops | RoconzaArt | Questions and Supports | 10 | 01-17-2011 04:32 PM |
What's New? |
What's Hot? |
What's Popular? |