-
Posts
2,491 -
Joined
-
Last visited
-
Days Won
196
Content Type
Profiles
Forums
Events
Everything posted by Dayo
-
I have been working on the release of V2.2.3 this weekend, it would be great if a few people can download and test it, there are some nice new features 😉 You can download it here: https://github.com/ChristopherDay/Gangster-Legends-V2/releases/tag/2.2.3
-
This is something me and dave have looked into and it is possible, we talked about it before christmas, just have to get the time to develop it.
-
https://github.com/ChristopherDay/Gangster-Legends-V2/commit/979bb316ac666c6491caf0f3cba6b35764c08a7a I've added more userAction hooks. Just have to get 3rd party developers to add them 🙂
- 17 replies
-
- 1
-
-
- mccode-v2
- mccode-lite
-
(and 3 more)
Tagged with:
-
I think this is a great move, I’ve been pricing modules above the 10usd mark for the sole reason of not costing MWG any money. This will allow me to make modules cheaper while still supporting the forum! the work and effort you put into this forum does not go un noticed and if this helps recoup a little bit of the costs then I’m more then happy.
-
Ill have a look at the userAction hooks this weekend, it seems like i haven't committed some of the changes. I have some work to do adding more hooks I also need to document all of the hooks so that other developers can start integrating them. Is your hook in the module.hooks.php file, also the hook should be new hook("userAction", function ($actionData) { and not new hook("userAction", function ( $mod, $user, $action, $outcome, $extraData = null) {
- 17 replies
-
- mccode-v2
- mccode-lite
-
(and 3 more)
Tagged with:
-
Bought all modules - Buying more if someone needs money
Dayo replied to Mark Topper's topic in Gangster Legends
I’ve moved it 🙂 -
I’ve been working on something like this, it will be released some time this weekend
-
That error usually occurs when $this->page->buildElement() is not called, ill look into the issue now
- 6 replies
-
- mccode-v2
- mccode-lite
-
(and 3 more)
Tagged with:
-
Hiya I am the original creator of GL v2 the core engine is completely free under the MIT licence. Over the past 6 months it has become a lot more popular partly down to the easy to use modular system. There are now several developers who are making mods for it too, that is also making it more popular 🙂
-
Have you thought about using time stamps rather then crons, it can be a lot more flexible and strain your server less
-
Looking very good, as dave said you can make any layout responsive, you just have to focus on what is important and what isnt.
-
I am already adding the ability for that for when i build it directly into the core engine, it will support both the callback method and the methods above
-
Yeah that's why i like to separate user crons and system crons, as well as adding limits to how many times a cron can run. Plus features should be designed in a way so that if a game has no activity for 100 days does it really need to run 100 days worth of crons or can it run the past week. Yeah back in the days when people would find an illegal copy of McCodes and run it on a free host 😛
-
Im a big fan of cronless crons and have been pushing this idea for 10 years now! (see here) Ive had a few people ask if i can make this easier to work with in GLv2 so i have created a simple Cron class that will hopefully make life easier and give you a better understanding of cronless crons. Cron Class <?php class Cron { public function __construct($cronName, $cronType, $interval, $maxRepetitions = 1000) { global $db, $user; $this->db = $db; $this->user = $user; $this->settings = new Settings(); $this->cronName = $cronName; $this->cronType = $cronType; $this->maxRepetitions = $maxRepetitions; $this->interval = $interval; } public function updateLastRun() { if (!$this->getRepetitionCount()) return $this; $key = "cron-" . $this->cronName; $newTime = time() - (time() % $this->interval); if ($this->cronType == "user" && $this->user) { $time = $this->user->updateTimer($key, $newTime); } else if ($this->cronType == "system") { $time = $this->settings->update($key, $newTime); } return $this; } public function getRepetitionCount () { $key = "cron-" . $this->cronName; if ($this->cronType == "user" && $this->user) { $time = $this->user->getTimer($key, false); } else if ($this->cronType == "system") { $time = $this->settings->loadSetting($key); } $count = floor((time() - $time) / $this->interval); return $count > $this->maxRepetitions?$this->maxRepetitions:$count; } public function getCronDates() { $key = "cron-" . $this->cronName; if ($this->cronType == "user" && $this->user) { $time = $user->getTimer($key); } else if ($this->cronType == "system") { $time = $this->settings->loadSetting($key); } $count = floor((time() - intval($time)) / $this->interval); if ($count > $this->maxRepetitions) { $count = $this->maxRepetitions; } if (!$count) return array(); $start = time() - time() % $this->interval; $dates = array(); while ($count) { $dates[] = $start - ($this->interval * ($count - 1)); $count--; } return $dates; } } Usage Examples (moduleExample.hooks.php) <?php new Hook("userInformation", function ($user) { global $page; if ($user) { $oneMinCron = new Cron("addUserEnergy", "user", 60, $this->user->info->US_maxEnergy); $howManyTimesTheCronWouldHaveRun = $oneMinCron->getRepetitionCount(); $newEnergy = $howManyTimesTheCronWouldHaveRun * 2 + $this->user->info->US_maxEnergy; if ($newEnergy > $this->user->info->US_maxEnergy) { $newEnergy = $this->user->info->US_maxEnergy; } $this->user->set("US_maxEnergy", $newEnergy); $oneMinCron->updateLastRun(); } $systemCron = new Cron("everyHour", "system", 3600, 24); $datesAndTimeThatTheCronWouldHaveRan = $systemCron->getCronDates(); foreach ($datesAndTimeThatTheCronWouldHaveRan as $date) { /* do something here */ } $systemCron->updateLastRun(); }); Documentation __construct($cronName, $cronType, $interval, $maxRepetitions) $cronName - A unique name given to this cron, this is used to identify it in the database $cronType - This can be "user" or "system" user - This cron will only run when the user is active and playing the game, if they have been AFK for a period of time it will run the cron as many times as needed.(capped by the maxRepetitions) system - This cron is run when there is any activity on the game, it can be a logged in user or someone visiting the login page, if it has not been run for a while it will run as many times as needed (capped by the maxRepetitions) $interval - How often should the cron run (seconds) $maxRepetitions - The maximum times this cron will run getRepetitionCount() Returns how many times the cron would have ran if it was running away in the background getCronDates() Same as getRepetitionCount but instead of returning a numerical value it will return an array of dates and times when the cron would have ran. updateLastRun Updates the database storing when the cron was last run. If the cron was not run
-
BETA is now open!
-
You can go onto the market place and see who purchased it and send out a PM 😉
-
My bad I was upgrading a module, now fixed
-
I have been working on Dystopian Life with a few partners for over a year now! We are finally ready to move from alpha into beta. You can pre-register at https://dystopian.life enjoy;)
-
Dont forget to add a decline fight, and try to use btn-success and btn-danger classes to help the user better understand what they mean (good for people with bad eyesight)
-
With the new MWG marketplace I've had no issues with payments, Dave has been great!
-
The wiki is on my radar but I've been focusing my time on community requests. I have already thought about this and TBH this would be a better way to do things. I am working on the ability to upgrade a module at the moment so ill make sure to add something like this. Some very good advise here, ill certainly do this going forward.
- 17 replies
-
- 2
-
-
- mccode-v2
- mccode-lite
-
(and 3 more)
Tagged with:
-
Care to share your fix so that I can update the code to prevent this happening to other users?
-
mccode-v2 Best Way to Prevent Repetitive Attacks?
Dayo replied to TonyCisseroni's topic in Game Support
You could do it so it increments i.e. 5 mins, 10 mins, 15 mins, 20 mins etc ...- 9 replies
-
- 1
-
-
- mccode-v2
- mccode-lite
-
(and 3 more)
Tagged with: