DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • December 13, 2017, 06:14:49 PM
Home Forums News Downloads Login Register Advanced Search
* *
DragonPrime Menu
Login
 
 
Resource Pages
Search

  Show Posts
Pages: [1] 2 3 ... 24
1  Modules, Themes and other customizations for your game / Completed Modules for version 1.x.x / Re: Site Backup (Database & Files) v2.0 : File Submission/Discussion on: Today at 01:12:29 AM
In this case, if you want to be able to restore directly from the backup without having to first initialize the database (or at least the now-missing accounts_output table), I think it'd be a good idea to split the database export into two statements.

Code:
<?php

exec
('mysqldump --no-data -h'.$DB_HOST.' -u'.$DB_USER.' -p'.$DB_PASS.' '.$DB_NAME.' > '.$_SERVER['DOCUMENT_ROOT'].'/'.$filename.'_schema.sql'$output=array(), $worked);

exec('mysqldump --no-create-info --opt -h'.$DB_HOST.' -u'.$DB_USER.' -p'.$DB_PASS.' '.$DB_NAME.' --ignore-table='.$DB_NAME.'.accounts_output > '.$_SERVER['DOCUMENT_ROOT'].'/'.$filename.'_data.sql'$output=array(), $worked);
Warning: These exec statements are not safe. A good password is likely to contain special characters, and dropping those into a command like this will likely result in failure. Ideally, this would be where something like a parameterized function call would be used; this being PHP, that probably doesn't exist, which is presumably why escapeshellcmd exists.

It'd need to be tested, but something like this should be safer:

Code:
<?php

exec
(escapeshellcmd('mysqldump ...'));

An excellent suggestion! It is nice to see someone take security into account. The exec commands will work, since it is just executing the command - noting seems out of place there. Also, escapeshellcmd() will (should) break any special character passwords if the server is running on Windows.
2  Game Administration, Installation and Configuration / The Idea Place / Re: scenario's for new modules? on: Today at 12:57:43 AM
Sorry, but what do you mean with "So meme'd up"? Firstly, what do you think about introducing a new degree of difficulty in the forest? On Hogwartslive, I don't know if this is the same on dragonprime, you can "look for something" =monsters have same level as player; "go thrillseeking" =monsters are 2 levels higher than player; "go slumming" =monster is one level below player; "search suicidally" =monsters are 3 levels higher than player (only available after 50 dk's :ve's in hl ve =Voldemort encounters. But what about a level "hunt for horrors"? This level I should make available after 300 dk's or ve's; monsters in this section of the forest could be 6 levels higher than player; and Voldemort or dragon you only can fight at level 15 has not level 18 but at level 22. I'm only puzzling how to do the latter: player could opt in into "hunt for horrors" section and accepts the difficulty degree of dragon/voldemort when player reaches level 15, or you could introduce a badges module and only after obtaining the "horrorhunt-badge the player could battle this though dragon/Voldemort and other though opponents. This is my first proposal. I have more at my desk. Best, WW

That is just a tagline, and is not applicable to any sort of post that I make. It is rather off-topic, really.

I would not suggest making that sort of an edit, but it is possible to write a module that will just grab creatures that will instead be higher levels. You need to fill out the full level stack (16 - ~23) with creatures then. I do not believe that just throwing levels at a player will exactly fix the power-creep issue that is native in the DragonPrime core. This sort of model would make sense if you rewarded the players with a formidable experience gain - but your idea of badges will perfectly negate the need to introduce higher levels. It's all about what you want for your server. A stronger set of creatures to attack would mean a little more strategy, but it's hardly any different. A badge to show accomplishment would be nice, but there are hall of fame lists for that exact reason. It's best to view which angle will bring more value to your server.
3  Game Administration, Installation and Configuration / The Idea Place / Re: scenario's for new modules? on: December 10, 2017, 11:57:38 AM
Hi I'm new here, so if I make some faults please tell me how to behave over here. Is this the correct board to post some ideas for new modules? If yes, I have some ideas and scenario's in draft phases. Programming isn't my piece of cake. Best, WW

You can post your ideas here and it will more than likely be made quickly. Most ideas these days are a breeze to design.
4  Coding Support / Coding Support Desk / Re: Question About Item System on: November 06, 2017, 04:35:58 AM
I have not looked at the item system module at all, and you did not provide a full snippet of the _dohook() function, so I am going to assume that this is in a switch case. It is better to just add a break for those under 100 Dragon kills - it will look a lot nicer in the code, rather than wrapping everything in an if statement.

Code:
<?php
        
global $session;
        if (
$session['user']['dragonkills'] <= 100) {
            break;
        }
require_once("lib/itemhandler.php");
$inventory get_inventory();
$count=0;
while ($item db_fetch_assoc($inventory)) {
$destroyed 0;
for($c=0;$c<$item['quantity'];$c++) {
if($item['dkloosechance'] >= e_rand(1,100)) $destroyed++;

}
if ($destroyedremove_item((int)$item['itemid'], $destroyed);
$count+=$destroyed;
}
if ($count == 1) {
output("`n`2Shattered around you lie the remains of a once mighty item destroyed by the power of the dragon's flames. ");
} else if ($count 1) {
output("`n`2Shattered around you lie the remains of once mighty items destroyed by the power of the dragon's flames. ");
output("It seems `^%s items`2 have been destroyed."$count);
}
5  Game Administration, Installation and Configuration / Installation and Configuration Assistance / Re: HELP!! PHP 5.5 on: October 29, 2017, 02:53:06 PM
This is a great reason to keep your stuff upgraded.
6  Coding Support / Coding Support Desk / Re: MYSQL Connect Error on: October 19, 2017, 10:53:28 AM
I have searched on here for answers but all pertain to installation. My error is post installation. Every once in awhile when my site goes to process this function in the dbwrapper_mysql.php file I get the following error.


Function processed:
Code:
function db_connect($host,$user,$pass){
$fname = DBTYPE."_connect";
$r = $fname($host,$user,$pass);
return $r;


Error that happens:

Code:
PHP Warning:  mysql_connect(): Access denied for user 'thecomz2'@'localhost' (using password: NO) in /home/thecomz2/public_html/lib/dbwrapper_mysql.php on line 204


Can someone tell my why this happens and where Id look to fix it? Id greatly appreciate it.

It's happening because the argument passed for your $pass (database password) is blank. You can tell from the "access denied for user 'redacted'@'localhost' (using password: NO)" bit, which unfortunately gives away your database username... Not the best of security management there, maybe you should edit your post. Look for any db_connect functions - that's where your issue lies. Since it's 'every once in a while', maybe check items hooked into newday_runonce.
7  Coding Support / Coding Support Desk / Re: How Do I Remove Color-Coding Notations From Page Headers? on: October 13, 2017, 08:08:35 AM
I do not believe that was in any way edited or why I would.

I will look for another declaration of page_header then.

Just looked, I do not see another declaration.  I am stumped.

Do you have to somewhere require_once /lib/sanitize.php or something?

That is the only thing I can think of...

You shouldn't have to. There should have been a fatal error because of the undeclared function if you didn't require the file. You should probably try that out before posting about it o.O.
8  Coding Support / Coding Support Desk / Re: How Do I Remove Color-Coding Notations From Page Headers? on: October 12, 2017, 09:26:32 AM
Where the dwellings code uses the page_header function when you enter a dwelling, use the sanitize function first on the dwelling name, then pass that into page_header.

Humm...not sure I get it.  It LOOKS like the sanitize is already being used, nevertheless, I still get unwanted stuff in my page headers.

Here is the code snip for case_enter on dwellins:
Code:
<?php
if (
$session['user']['location'] != get_module_setting("logoutlocation"))
set_module_pref("location_saver"$session['user']['location']);
$sql "SELECT name,description,ownerid FROM ".db_prefix("dwellings")." WHERE dwid=$dwid";
$result db_query($sql);
$row db_fetch_assoc($result); 
if($row['name'] == ""){
$name translate_inline("Unnamed");
}else{
$name $row['name'];
}
page_header("%s",sanitize($name));

Is that not supposed to sanitize the name and get the bold and color codes out of the page header?

Or am I missing something here?


You should look for another declaration of page_header() then. Unless your lib/sanitize.php functions are edited - yes, that should remove the backtick character and anything in the set of [1234567890!@#\$%^&)~QqRVvGgTtjJeElLxXyYkKpPmM?*AabicnHw] (as of 1.2).
9  Village Square / General Discussion Area / Re: What was the fastest playthrough For the first dragonkill on: October 12, 2017, 09:20:24 AM
LevelExp per FightExp for LevelExp DiffRounds
1141001007.14
22440030012.5
334100260217.71
445191291020.22
5553140122822.33
6664707156723.74
7776641193425.12
8898985234426.34
910111795281027.82
10113.315143334829.55
11126.819121397831.37
12140.423840471933.64
1315629437559735.88
1417236071663438.57
1518943930785941.58
=393.51

That would make about 400 rounds for the first dragonkill. Seems like quite a lot just now, maybe exp gain is a little increased in battle (haven't checked the scripts). Also there might be fights vs multiple enemies that give more exp and so on and so on.  Wink
[/quote]
oh lol, thank you... THAT sir is really high end Information Cheesy thanks man. It helps a lot Cheesy

This assumes that players start with no gems, or that they won't find any during fights, it seems. Buying vitality through the inn can seriously effect your gameplay - in higher kill counts, it's not surprising to get a new dragon kill in less than a minute on most servers. Also need to keep in mind that there is the chance of death or loss of experience. Balance and timing is something that's more specific to the server, and the modules in the server.
10  Core Code Development Discussions / Core Development Discussion / Re: AJAX based chat on: September 29, 2017, 07:20:06 AM
Hey, i was just wondering if anyone came up with a solution without tampering with the core code ?
Is this still a thing ?

Yes, there is a solution without editing the core code - but it is not through this module, since it relies on core editing. All you would need to do is to make an API hook, for your javascript to obtain a JSON of all recent commentary, and display it through your javascript.
11  Coding Support / Coding Support Desk / Re: Is It Possible To.... on: September 27, 2017, 12:22:07 PM
That is a very neat idea for something such as a highwayman that targets women. It very much is possible - however without a module to prevent the fight from starting, the creature has a chance to hit once, through the surprise attack mechanic. This can be done through an AI script (Be careful who you give creature editor). You would have to decide on what conditions the creature should attack. If you want it to attack women, you would want to check if $session['user']['sex'] is the constant SEX_FEMALE.

Code:
<?php
global $session$enemies$badguy;
if (
$session['user']['sex'] == SEX_FEMALE) {
    
//We want our highwayman to attack women, but not men. Return to continue the next round of fighting.
    
return;
}
foreach (
$enemies as $id => $enemy) {
    if (
$enemy['creaturename'] == $badguy['creaturename']) {
        unset(
$enemies[$id]);
        
//Remove the highwayman from the fight array. He should flee in group combat.
    
}
}
$badguy['creaturegold'] = 0;
$badguy['creatureexp'] = 0;
$badguy['dead'] = true;
// Remove the rewards, remove the creature from the fight.
output("The Highwayman notices a little too late that you are a male and flees!`n");

Neat.  so this is not a module, but something which goes in the Creature Editor, right?

Because that is what I am looking for.

I am looking to create a few creatures that only attack men...and a few that attack only women.

As an extension to this, I also wanted to create a creature that only attacks a certain race...for example, only Elves or only Trolls, or only Humans or whatever.
Yes, you can drop this script into a creatures 'AI Script' field. Anyone with creature editor can edit an AI - so be VERY, VERY careful who you give creature editor to. It should be treated like the 'Run Raw SQL' or 'Megauser' superuser flags.
12  Coding Support / Coding Support Desk / Re: Is It Possible To.... on: September 26, 2017, 09:55:09 AM
That is a very neat idea for something such as a highwayman that targets women. It very much is possible - however without a module to prevent the fight from starting, the creature has a chance to hit once, through the surprise attack mechanic. This can be done through an AI script (Be careful who you give creature editor). You would have to decide on what conditions the creature should attack. If you want it to attack women, you would want to check if $session['user']['sex'] is the constant SEX_FEMALE.

Code:
<?php
global $session$enemies$badguy;
if (
$session['user']['sex'] == SEX_FEMALE) {
    
//We want our highwayman to attack women, but not men. Return to continue the next round of fighting.
    
return;
}
foreach (
$enemies as $id => $enemy) {
    if (
$enemy['creaturename'] == $badguy['creaturename']) {
        unset(
$enemies[$id]);
        
//Remove the highwayman from the fight array. He should flee in group combat.
    
}
}
$badguy['creaturegold'] = 0;
$badguy['creatureexp'] = 0;
$badguy['dead'] = true;
// Remove the rewards, remove the creature from the fight.
output("The Highwayman notices a little too late that you are a male and flees!`n");
13  Game Administration, Installation and Configuration / The Idea Place / Re: Account ID on: September 22, 2017, 02:44:30 AM
OK...I could try.

What I am actually doing...

Is setting up so that in, let's say, in the hook for village (where my modue would show up)

While it is in the testing stage, I only want it to access certain values and add the nav ONLY for those values.  Everyone else would not have the nav, thus would not stumble into what is not fully tested.

The reason why this first came up in the multi-poke thread, was because that one has setting in it where you can allow ONLY certain account ID's to use certain pokes.

I wanted to know how I would set that up within a module, as a temporary thing, so that, once fully tested, it could then be taken out and thus everyone would get the nav, see?

Now, the way I had done this in the past would be something like this:

Code:
if ($session['user']['id'] <= 10) {
addnav whatever
} else {}

That way only users with an account ID 10 or lower would see the nav.

So, without setting superuser tags on someone...how would I make a player a betatester on something...so that they could still see the nav where other players could not?

THAT is where I am trying to get.  I do not want to give someone Grotto Access just in order to allow them to beta test.  I have some longer-term players that I normally would consider for use for beta-testing, but their account ID's are all over the place and I wanted to order those players so that everything was in the same rage, so that my above coding would work.

I am being told this is not a good plan.  So what I am looking for then....is code that would allow access only to certain players...and without giving them Grotto Access.

Oh, alright. If you are going to give certain users, including non-superuser accounts, access I would use DarknessFall's method or use the 'beta' tag in user editor (Misc Info > Willing to participate in beta). The beta feature will make it so that you don't have a lot of modules where you assign specific access (less preferences saved in the database). Just keep in mind that the beta flag is for beta testing, meaning they have access to all beta features you provide, not just one module. If you are going to flag people as beta testers, then the code would be:

Code:
if ($session['user']['beta']) {
// Code for beta users to access.
}
14  Game Administration, Installation and Configuration / The Idea Place / Re: Account ID on: September 17, 2017, 07:31:57 PM
I heavily advise against this. The acctid is unique for a reason, it's how other tables sync properly. Why not just check for superuser values, or a module setting/pref? Those will be safer than changing the acctid.

If it is for the purpose of letting staff test things, or making a superuser only module, I would rather you go ahead and check against the user's superuser value ($session['user']['superuser']). You can do this with:

Code:
<?php
global $session;
if (
$session['user']['superuser'] & SU_CONSTANT) {
// Functionality
}

Replace SU_CONSTANT with any of the constants prefaced with SU_ in lib/constants.php. The constants are rather autological in that their name is the option you can set in the user editor.
15  Game Administration, Installation and Configuration / Installation and Configuration Assistance / Re: Test Server on: September 09, 2017, 07:23:39 AM
Friendly reminder that phpinfo(); should show your Apache/Nginx version as well as your phone version.
Pages: [1] 2 3 ... 24

*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
13 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search