DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • May 20, 2013, 10:10:05 AM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1]   Go Down
  Print  
Author Topic: File Discussion - City Blocker  (Read 646 times)
0 Members and 1 Guest are viewing this topic.
Aeo
Mod God
*****
Offline Offline

Posts: 1079


Doctor.. Who?


View Profile WWW
« on: July 31, 2012, 05:30:45 AM »

Name: City Blocker (cityblock.php)
Author: Aeolus
Version: 1.0
Category: Village
Compatibility: Only tested on 1.1.2, should work on any 1.x.x
Requires: Eric Stevens' cities.php module- found in the Core Module Pack. (Only required due to the fact that having this module is pointless if you're not using Multiple Cities)

Description:
Adds a nav in the Travel nav for superusers with the SU_EDIT_CONFIG flag, which directs them to a page which lists all cities that are installed on the server (pulls all cities from the database that are under a setting name of villagename from any module). Gives the option of allowing the city 'Full Access' (access under the regular AND superuser nav headers), 'SU Only' (access only under the superuser nav header), or 'Restricted' (no access at all). Allows all superusers to view the status of each village, but only SU_EDIT_CONFIG can change the statuses.

Future Additions:
- Add check boxes to change options of multiple cities at the same time

File Submission: Here

Warning: Still sends a player to the home city of their race after a dragon kill, whether or not it is blocked from travel.

Bugs, opinions and suggestions welcome.
« Last Edit: August 07, 2012, 08:32:57 PM by Aeolus » Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Afkamm
Mod God
*****
Offline Offline

Posts: 1563

MarcTheSlayer


View Profile WWW
« Reply #1 on: July 31, 2012, 09:00:19 AM »

You should add the file name to all the functions you create, this will stop any problems with people doing the same and getting "function already defined" errors. Smiley

How do you specifically limit travel to/from a certain city?
Logged

Aeo
Mod God
*****
Offline Offline

Posts: 1079


Doctor.. Who?


View Profile WWW
« Reply #2 on: July 31, 2012, 09:10:37 AM »

You should add the file name to all the functions you create, this will stop any problems with people doing the same and getting "function already defined" errors. Smiley

Done, and re-uploaded! Thanks for that, it didn't cross my mind. ^_^

How do you specifically limit travel to/from a certain city?

You'll find that under case 'travel'.

Code:
<?php
$blockedarp 
cityblock_explode(get_module_setting('blockedp'));
$blockedarr cityblock_explode(get_module_setting('blockedr'));
$allcities db_query("SELECT value FROM ".db_prefix('module_settings')." WHERE setting='villagename'");
while($row db_fetch_assoc($allcities)){
$city $row['value'];
if (in_array($city,$blockedarp) || in_array($city,$blockedarr)){
blocknav("runmodule.php?module=cities&op=travel&city=".urlencode($city));
blocknav("runmodule.php?module=cities&op=travel&city=".urlencode($city)."&d=1");
}
if (in_array($city,$blockedarr)){
blocknav("runmodule.php?module=cities&op=travel&city=".urlencode($city)."&su=1");
}
}
?>

Where blockedp is the list of cities blocked to players (superuser access only), and blockedr is the list of cities blocked to all.
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Afkamm
Mod God
*****
Offline Offline

Posts: 1563

MarcTheSlayer


View Profile WWW
« Reply #3 on: July 31, 2012, 10:04:11 AM »

What I'm asking is, you can't block from one location, but allow from another?
Logged

Aeo
Mod God
*****
Offline Offline

Posts: 1079


Doctor.. Who?


View Profile WWW
« Reply #4 on: July 31, 2012, 10:11:40 AM »

What I'm asking is, you can't block from one location, but allow from another?

As long as you have the Travel nav, you can block and allow from wherever you are. o.o Is that what you mean?
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Aeo
Mod God
*****
Offline Offline

Posts: 1079


Doctor.. Who?


View Profile WWW
« Reply #5 on: August 05, 2012, 02:07:13 AM »

So, it would appear that while it will block travel from Alpha to Beta (for example), if I pick Race Gamma, and it's home city is Beta.. I still end up in Beta after my DK. o.o

However, once I travel out of that city, I can't return to it. (Which is what it's meant to do.)

So, the question is.. How do I block the home city of a race with a/the module? o.o
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Afkamm
Mod God
*****
Offline Offline

Posts: 1563

MarcTheSlayer


View Profile WWW
« Reply #6 on: August 05, 2012, 08:54:10 AM »

You could try hooking in dragonkill and checking to see if a player's location is a block city, then changing it to a default.
Logged

Smoobert
Member

Offline Offline

Posts: 3


View Profile
« Reply #7 on: December 23, 2012, 02:57:22 AM »

I could see this module being handy if one were able to block access and visibility of certain cities based on minimum and maximum Dragon Kills. Meaning, for example, you could force people to stay on Newbie Island until they completed their first DK. Or you could allow people access to a race's particular city whenever a race became available based on DK. Of course, it could get a bit dicey if someone bought this based on lodge points, which would add another bit of confusion, but you could correct this by allowing access to cities based on race or simply allowing access to a certain city on a per person basis.
Logged
Aeo
Mod God
*****
Offline Offline

Posts: 1079


Doctor.. Who?


View Profile WWW
« Reply #8 on: December 23, 2012, 05:04:25 AM »

Meaning, for example, you could force people to stay on Newbie Island until they completed their first DK.

Edit that module to do that. No need for this module for that.

Or you could allow people access to a race's particular city whenever a race became available based on DK.

Edit that race's travel hook for that. No need for this module for that.

[...] or simply allowing access to a certain city on a per person basis.

Easily done using the Customizable Race-less Cities module and an additional pref for access, added into the travel hook. No need for this module for that.
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Smoobert
Member

Offline Offline

Posts: 3


View Profile
« Reply #9 on: December 23, 2012, 06:44:45 AM »

Meaning, for example, you could force people to stay on Newbie Island until they completed their first DK.

Edit that module to do that. No need for this module for that.

Or you could allow people access to a race's particular city whenever a race became available based on DK.

Edit that race's travel hook for that. No need for this module for that.

[...] or simply allowing access to a certain city on a per person basis.

Easily done using the Customizable Race-less Cities module and an additional pref for access, added into the travel hook. No need for this module for that.

I wonder why you chose to be curt with me when I was doing as you asked. You said "Bugs, opinions and suggestions welcome." Your response indicates that your feelings about this are otherwise. I was not rude nor demanding nor impolite in any way towards you. I was simply offering my opinions and suggestions. My own view, which was freely offered and not demanded, is that what I suggested would allow your mod to control a little bit more which would in turn simplify things for more people running servers, and be more helpful for more people running servers. It seems like what I suggested was something that was very related to what else your mod does. I agree, there is no need whatsoever for you to take more time and put more work in to have your mod do what I say, but I never said it needed to do those things, all I offered was my opinions and suggestions.

You could say, for example, "Thanks for taking the time to write your thoughts and suggestions, but that's not something I'd like to focus on." You could even say on top of it, "If you are interested in getting your hands dirty and do it yourself, here's a resource, check it out," or something else along those lines. The way you responded, however, treated me as if I had demanded you change your module to suit my needs which I in no way did. Please, by all means, say you don't want to do it. But if you'd like to elicit good feedback and suggestions from people, then put as much thought and courtesy into your response as those who have taken their time to look at your module and offer you their own thoughtful suggestions and thoughts.

If you'd like to point me to resources or make suggestions for the first two, please, point me in the right direction, because that's something I would like to add. I'll do my best and even share back the completed results with the forum if I succeed. I'm not interested in doing the third, at least with the race-less cities mod; I've never used it and I prefer having my cities tied to racial origin. If you don't want to do that, that's fine, just tell me you don't want to do it, and I'll leave it at that, but please don't treat me as if I was demanding it from you; you offered your suggestions, and I'm asking you how you would suggest I proceed with them. I've looked through the forums and the tutorials, used the search engine, and I've edited pieces of mods to customize them for my own uses before, but my abilities are not great or even good and I would really need a module that did something similar to use as a guide before proceeding. I wouldn't know where to start as far as restricting travel access to a place based on dragon kills as the only mods I have looked over the code of that restrict access based on DK's are the race modules and the dwellings modules, and those aren't really travel modules. Thanks.
Logged
~Ender~
Captain of the Guard
***
Offline Offline

Posts: 185


Google is our savior!


View Profile
« Reply #10 on: December 23, 2012, 07:30:48 PM »

Quote
Meaning, for example, you could force people to stay on Newbie Island until they completed their first DK.

You can use and IF/THEN statement for this.
I'm pretty sure there's a module for this, anywho.

Quote
Or you could allow people access to a race's particular city [...] race became available based on DK.

Again, you can use an IF/THEN statement.

For the third one: You should be able to use User Editor
« Last Edit: December 23, 2012, 07:33:02 PM by Cedric » Logged

insert sympathy here

Message me!
Aeo
Mod God
*****
Offline Offline

Posts: 1079


Doctor.. Who?


View Profile WWW
« Reply #11 on: December 23, 2012, 09:57:38 PM »

I wonder why you chose to be curt with me when I was doing as you asked. You said "Bugs, opinions and suggestions welcome." Your response indicates that your feelings about this are otherwise. I was not rude nor demanding nor impolite in any way towards you. I was simply offering my opinions and suggestions. My own view, which was freely offered and not demanded, is that what I suggested would allow your mod to control a little bit more which would in turn simplify things for more people running servers, and be more helpful for more people running servers. It seems like what I suggested was something that was very related to what else your mod does. I agree, there is no need whatsoever for you to take more time and put more work in to have your mod do what I say, but I never said it needed to do those things, all I offered was my opinions and suggestions.

You could say, for example, "Thanks for taking the time to write your thoughts and suggestions, but that's not something I'd like to focus on." You could even say on top of it, "If you are interested in getting your hands dirty and do it yourself, here's a resource, check it out," or something else along those lines. The way you responded, however, treated me as if I had demanded you change your module to suit my needs which I in no way did. Please, by all means, say you don't want to do it. But if you'd like to elicit good feedback and suggestions from people, then put as much thought and courtesy into your response as those who have taken their time to look at your module and offer you their own thoughtful suggestions and thoughts.

If you'd like to point me to resources or make suggestions for the first two, please, point me in the right direction, because that's something I would like to add. I'll do my best and even share back the completed results with the forum if I succeed. I'm not interested in doing the third, at least with the race-less cities mod; I've never used it and I prefer having my cities tied to racial origin. If you don't want to do that, that's fine, just tell me you don't want to do it, and I'll leave it at that, but please don't treat me as if I was demanding it from you; you offered your suggestions, and I'm asking you how you would suggest I proceed with them. I've looked through the forums and the tutorials, used the search engine, and I've edited pieces of mods to customize them for my own uses before, but my abilities are not great or even good and I would really need a module that did something similar to use as a guide before proceeding. I wouldn't know where to start as far as restricting travel access to a place based on dragon kills as the only mods I have looked over the code of that restrict access based on DK's are the race modules and the dwellings modules, and those aren't really travel modules. Thanks.

My apologies, I did not mean to be curt. I simply don't mix humour with work (which is what I consider this, since I'm on holidays). I do thank you for your suggestions, though I am somewhat confused by them. Modifying one module to affect another is like modifying the Inn because you want something pretty in the Forest. I'd offer advice on how to go about your ideas, but Mr. Cedric seems to have already done that. Expanding on it, for the first and second ideas, use something such as:

Code:
if ($session['user']['dragonkills'] >= $dksneeded){
// Logic stuff here
}

If you're looking for the Newbie Island, you'll find that in the Core Modules package, found here.

For the third idea, you'll find that adding --

Code:
"allowedaccess" => "Does use have access to city?,bool|1",

-- into the _getmoduleinfo function, and --

Code:
if (get_module_pref("allowedaccess")){
// Logic stuff and addnav's here
}

-- into the travel hook will do what you want. As Cedric said, just go into UE if you require a player to have access.

Also, I will take your ideas into consideration when I return to this module, as my list of modules to code is quite long at the moment.
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
~Ender~
Captain of the Guard
***
Offline Offline

Posts: 185


Google is our savior!


View Profile
« Reply #12 on: December 25, 2012, 10:33:09 AM »

Quote
"allowedaccess" => "Does use have access to city?,bool|1",

Not sure if this is directly from the module--but if it is; then there is a typo. Should be user.
Logged

insert sympathy here

Message me!
Aeo
Mod God
*****
Offline Offline

Posts: 1079


Doctor.. Who?


View Profile WWW
« Reply #13 on: December 25, 2012, 08:10:52 PM »

Quote
"allowedaccess" => "Does use have access to city?,bool|1",

Not sure if this is directly from the module--but if it is; then there is a typo. Should be user.

It was a typo. >.> I typed that whole reply on my phone.
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

Support Us
$100 raised this year
Your help is greatly appreciated!
Who's Online
23 Guests, 0 Users
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search