Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Steev

Pages: [1]
1
General SMFShop Discussion / Variable Restock Rates
« on: April 12, 2007, 11:12:32 pm »
I have just uploaded Release Candidate 1 of my Variable Restock Rates mod for SMFShop to http://dev.dansoftaustralia.net/projects/varrestocks/.  I would appreciate any comments or suggestions you may have.

NOTE
While I have tested the code itself, and all appears to work, I have not yet tested the .xml files used to add the package automatically.  If you use these, make backups of affected files.

Affected Files
ShopAdmin.template.php
ShopAdmin.php
Shop.english.php
item_engine.php

New Files
dostock.php

readme.txt
This modification makes an additional method of restocking the SMFShop, allowing to automatically stock at a certain rate, up to a specified maximum value.  Each item in the shop can have it's own configured restock rate.

Changelog:
==================
Version 1.0 (RC1)
- Added the ability to reset stocking periods.
- Changed dostock.php so that it will reduce to max_stock even if stock_period hasn't arrived.
- Wrote an uninstall script that will remove database fields if run.

Version 0.1
- First version
- Added new database configuration to allow for automatic restocking.
- Added new file, dostock.php, which will do the automatic stocking.  Requires a cron job to run successfully.
- Altered administration files to show restock options.
- Altered item_engine.php to add restock variables.
- Added new elements to Shop.english.php.
- Default Values: 50 Max Stock, 50 Restock Rate, 1 Hour Intervals


2
Coding / Several Modification Ideas
« on: April 06, 2007, 08:52:35 am »
Some of these I've noticed are repeats from other threads, but not all of them, and since I had them handwritten as ideas, I'm including them all for completeness.

1) Points per post By Board
This would require in the "Modify Boards" section of the ACP change the "Count Shop Posts" into a "Points per Post".  It shouldn't be too hard of a change; the big change is altering the Boards table so that it has a MoneyPerPost smallint(5) field; but I'm probably missing something on that regard.

2) Sellable Items
Each item should have a sale price and an OnSale() function.  The function would probably only add the money to their inventory and remove the item.  Perhaps an option to allow sold items to return to the store inventory or not?

3) Items by Usergroup
I'd like to see a way to make an item limited to certain usergroups.  Buying, using, or both.  This one, though, I have absolutely no idea how to go about it, at the moment.

4) Variable Restock Rates
A couple more variables--TimeToRestock, MaxStock, EachStock.  A new field in the shop's inventory would have a LastRestocked time.  A cron job would probably be needed so that every hour it would check the last restocks against the time to restock, and if it's been at least TimeToRestock hours, it increases the shop's stock by EachStock, up to a maximum of MaxStock.  I've got a good idea of how to do this, but I see it being fairly complicated and will take some time to do.

5) Destruction Changes / Charged Items
Instead of just a static delete_on_use variable, there should be a OnCleanUp() function; a counter should be added to the inventory field as well for charged items.  The OnCleanUp() function would decide whether and how to remove the item; for instance, if the counter has reached 0, or a random chance is met.  I recently created an item with three options; on three of them, it would get deleted, and it would stay on the other three.  This would be optimal for items like that.

If anyone has already finished these, or has more ideas of how to implement them, I'd be appreciative.

Pages: [1]