DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • March 28, 2017, 06:26:31 PM
Home Forums News Links Downloads Login Register Advanced Search
* *
DragonPrime Menu
Resource Pages
IRC Channels

  Show Posts
Pages: [1] 2 3 ... 18
1  Core Code Development Discussions / Core Development Discussion / Re: LotGD Rewrite (Daenerys) Weekly Updates on: March 14, 2017, 06:19:04 AM
Daenerys (LotGD Rewrite) Not-So-Weekly Update 03/14/2017

We've managed to wrap up the pre-release version v0.2.0-alpha. There are quite a few updates from different packages:

  • lotgd/core now has a basic Permission framework. Additionally, we've reworked the way scenes are connected to each other to be more explicitely and more intuitive. This change also allowed us to introduce ActionGroups properly.
  • lotgd/crate-graphql was updated to properly support the new connection api. Furthermore, the graphql scheme was reverted so that query.user.character is not a graphql edge anymore, but again a simple list of characters. Switching from relay to apollo on the client side gave as here more freedom in how we approach the graphql api.
  • Both example modules used to showcase our client, module-village and module-scene-bundle, have properly been updated to support the new scene connection api
  • lotgd/client-graphql-www has been reworked while switching from relay to apollo. We've cleaned up the code. The login-state and the selected character are now kept in LocalStorage, thus refreshing doesn't clear all the states anymore. Furthermore, instead of css directly, we now utilize a css preprocessor.

Please note that this pre-release is not ready for production. Currently, there is no control if the user doing the mutation is actually the owner of the character.

A big thank you @grrrilla_ninja who has copied MightyE's weapon module and converted it to Pegasus' armor module. He is also a great help in giving input for the story for the main server. Some thanks also go to @pharis who gives us input in our slack channel.

If anyone wants to help - Come join us! As always, there are
starter tasks, some of which can be completed even by programming n00bs:

There are also a few roles available if anyone wants one, some more accessible
than others:

  • Server sysadmin for our DigitalOcean instances. We need someone to add a
    script to support https via Let's Encrypt to our http://code.lot.gd instance.
  • Scene coder. Someone to help port over the key scenes (like village, inn, etc.)
    to our new formats.
  • Fantasy writer (non-techncial). Once we get the code done, we need to create a compelling story
    to attract players. I have some ideas but it would be helpful to have someone think about
    this more extensively, write up a story line, non-player characters, etc. Inspire us
    to finish the code!

Next Goals
Now that client/crate and core are running properly, we start to improve in different areas to get to a minimum viable version. This includes proper api protection against unauthorized access and more modules to emulate typical lotgd game flow.
2  Coding Support / Coding Support Desk / Re: New Template Issues on: February 24, 2017, 04:00:17 AM
I included the {content} tag in the <div class="content"> section, however, it still shows up at the end of everything, after the footer. That's why I was thinking there was something else I had missed.

Maybe I was a bit unclear in my post. There is no {content} tag. All content gets placed after the header part, and before the footer part. No template that I know of has this content tag.

As for the whole HTML5 thing, though, thank you for pointing that out. (Seriously.) I had no idea it had been recommended since 2014, until I looked it up, just now. I stopped being a developer in 2009, and I was using this project to dust off my coding skills, before trying to work as a developer, again. So, it looks like I have to learn a language, now. lol

You're welcome. It's always hard to come back when technology advances so fast - luckily for you, lotgd didn't advance at all ... Wink which we are going to change.
3  Coding Support / Coding Support Desk / Re: New Template Issues on: February 24, 2017, 12:41:44 AM
As such, I've been building a new, more modern template, using XHTML, and everything works great except for one nagging issue.

XHTML isn't modern, it's just HTML defined via XML instead of SGML. I recommend to not use XHTML since it is far more strict and you don't have the control over all the HTML part, except if you re-write all modules you use yourself. Besides, XHTML has been abandoned by the W3. Instead, use HTML5.

Namely, all of the content areas, like the login section, village descriptions, and comment section, are being passed onto the page without getting placed into the content section. I've gone over all of the hooks that should be in the template, and none of them seem to be pulling from where the content actually is (for instance, there is no village* or race* hook pulling the descriptions). I've gone through everything I can think of, like pageparts, commentary, source, etc., etc., but can't seem to figure out how the info is being served. I've also tried moving the commented sections, like the login area, into the main page code, but it breaks the template, if you do.

You write to put the content using a {content}-Tag. Did you actually find this tag in any of the supplied templates? A good starting point is http://dragonprime.net/index.php?page=skins#template.

In short, each template (and both the popup and the normal part) consists of 2 template-parts - the header and the footer, depicted by <!--!header--> (<!--popuphead-->) and <!--footer--> (<!--popupfoot-->). The template engine reads the template file and breaks it at every <!--!, then reads the stuff between ! and --> and puts it in an array. Then, the engine starts to put the stuff together again.

It is important to note that there is no {content} in this template-engine. Everything that gets written to output (with output(), rawoutput(), whatever else) put between the header-part and the footer-part.

<!DOCTYPE html>

After fragmentation and putting the template together, lotgd simply prints something along the lines of
print($header . $output . $footer)
. The file you look for is (if I recommend it correctly) is lib/pageparts.php.
4  Coding Support / Coding Support Desk / Re: Requesting assistance with nav modification on: February 24, 2017, 12:27:12 AM
JavaScript can only act on data you deliver to the browser. You *need* go have {stats} in your template, otherwise you can't extract any data anyway. So keep all stats part unmodified, otherwise you'll need to change your html - again. You can always hide the charstats with JavaScript (element.hide(), for example).

And yes, to insert the level where you would like to have it, you need to write-out the HTML part including self-defined levels by your own, which you then fill-in using JavaScript. And if you are using jQuery, it's much easier to write:


At this point, you should read up how JavaScript actually works and how it differs from PHP.
5  Coding Support / Coding Support Desk / Re: Requesting assistance with nav modification on: February 23, 2017, 06:18:43 AM
This is because $('.stat-row').text() gives you the text of everything that .stat-row matches (So the joined text of an array containing every charstats row). Better (kinda pseudo-code, it was a long time since I last used jQuery, but the api should be something along those lines):

var level = null;
$('.stat-row').each(function(element) {
  if ($('.charinfo', element)[0].text() === "Level" and level !== null) {
    level = $('.charinfo', element)[1].text();

Edit: I got the arguments of the callback for the each-function wrong, it's key, element. Thus, making a working example:

var level = null;
$(".char-row").each(function(key, element) {
cols = $(".char-col", element);
if (cols[0].textContent == "Level") {
   level = cols[1].textContent;

alert("Level is" + level);

For the HTML snippet:

  <tr class="char-row">
    <td class="char-col">Name</td>
    <td class="char-col">Eliwood</td>
  <tr class="char-row">
    <td class="char-col">Level</td>
    <td class="char-col">16</td>

The second argument of the $-function restricts your search for a certain element to the given argument. Without it, jQuery searches through document.

Btw - console.log() is much better at debugging than alert(). Console.log() prints the value of the argument to the webbrowser console (which you find in the developer tools, for Firefox it's Ctrl+Shift+I). If the argument is an object or an array, you'll get additional debug information about it.

Edit 2:
Interactive example at https://jsfiddle.net/L91u71bv/3/
6  Coding Support / Coding Support Desk / Re: Requesting assistance with nav modification on: February 20, 2017, 12:33:19 AM
This stuff is pure html/css/maybe a bit of javascript. Have a look at jade.htm in the template directory, for example.

The template is parted into fragments. Everything after <!--!popuphead--> belongs to the "popuphead" until the next comment starting with <!--!.

For navigation, the important stuff is here:

<span class="navhead">&#151;{title}&#151;</span><br clear='all'>
<span class="navhelp">{text}</span><br clear='all'>
<a href="{link}"{accesskey}class='nav' {popup}>{text}</a><br clear='all'>

And, in the header section, it's here:

<div align="center">{nav}</div>

Instead of using autogenerated ID's, you can use simple hierarchy tricks to achieve what you want. Let's say you would like to have the following structure in the end:

  <div class="nav-container">
    <span class="nav-head">{title}</span>
    <ul class="nav-items">
       <li class="nav-item"><a href="{link}" {accesskey}class='nav' {popup}>{text}</a></li>
       <li class="nav-item"><a href="{link}" {accesskey}class='nav' {popup}>{text}</a></li>
       <li class="nav-item"><a href="{link}" {accesskey}class='nav' {popup}>{text}</a></li>
  <div class="nav-container">
    <span class="nav-head">{title}</span>
    <ul class="nav-items">
       <li class="nav-item"><a href="{link}" {accesskey}class='nav' {popup}>{text}</a></li>
       <li class="nav-item"><a href="{link}" {accesskey}class='nav' {popup}>{text}</a></li>
       <li class="nav-item"><a href="{link}" {accesskey}class='nav' {popup}>{text}</a></li>

The main issue is, that we don't have a "nav-title-open" portion and a "nav-title-close" portion. The most obvious part are the navigation items themself:
<li class="nav-item">{text}</li>
<li class="nav-item"><a href="{link}" {accesskey}class='nav' {popup}>{text}</a></li>

The more difficult part is now navtitle. We need to put both the opening and the closing part into one navtitle:
  <div class="nav-container">
    <span class="nav-head">{title}</span>
    <ul class="nav-items">

This leaves us with 1 issue - the nav title closes a bunch of tags that where never opened, and opens some that are never closed. We can trick here with the part of <!--!header--> where we define {nav}:

  <div class="nav-container">
    <ul class="nav-items">

To answer your second question - no, you can't. But you could write some javascript that searches for these parts and reads the values out. To ease this, you could also make modifications to the template (again, this is from jade.htm):

Instead, but a class to the row
<tr><td class='charinfo'><b>{title}</b></td><td class='charinfo'>{value}</td></tr>

By putting a class to the whole row (<tr class="stat-row"> ... </tr>), you can just select all elements with the stat-row-class with, let's say, jQuery, loop through them until the first part matches "Level", then take the value from the second part and write it in $level.
7  Coding Support / Coding Support Desk / Re: Table Help on: February 09, 2017, 04:08:56 AM
What is the aim of the table? Is it an interface where the player has to select the skills? Or just to provide an overview?

Tables are awesome to provide quick comparison of the result of you change a variable, or to show physical rows of a database table. What you intend to do doesn't sound like a table to me, more like 7 lists in 7 columns. Do the columns in the row have any relationship at all?
8  Coding Support / Coding Support Desk / Re: Table Help on: February 03, 2017, 07:27:09 AM
Depends on what exactly you like to achieve. I (or someone else) might be able to give you a more fitting suggestion if you describe more what the interface should do.

For example, instead of putting everything in one table, use two separate ones. Or, since it's a table anyway, add a column which contains the information for what it's for. You could also make use of a select-element that allows multiple selections if you need interaction.
9  Coding Support / Coding Support Desk / Re: Table Help on: February 01, 2017, 11:38:59 PM
Classically, text which is intended for screen readers only are moved "away" with CSS from the visible area:


I would, however, think again about the design of your interface.
10  Core Code Development Discussions / Version 1.2.0 Development / Re: Current/Active Revival Attempts on: January 02, 2017, 06:47:54 AM
The daenerys core doesn't use a complete framework. It just uses doctrine for database and different framework components (monolog, symfony/console and symfony/yaml) for smaller stuff.

The crate, on the other hand, uses the complete symfony stack for a very simple reason: It was one of the frameworks that had a graphql plugin ready. And we are using a framework for a very simple reason: Time contraint. We didn't want to spent weeks developing a graphql addon for a smaller framework so we just took what's around.
11  Core Code Development Discussions / Version 1.2.0 Development / Re: DragonPrime Team on: November 01, 2016, 06:16:46 AM
Your overhaul sounds good though, it's not bad to have a port to a different system - eliwood also release info on anpera.net if I recall correctly.

Yes I do. It's important to me to bring back these two diverged communities (or what's left of it).
12  Important Stuff - You need to read this! / Forum Forum / Re: Petition to Upgrade this Forum on: September 07, 2016, 06:00:52 AM
The odd, outdated registration method really stops people from joining here - fresh blood that might want to contribute and are put off by the registration procecure. LotGD needs something new, and it needs to be open to newcomers.
13  Coding Support / Coding Support Desk / Re: Proper SQL output on: September 05, 2016, 04:18:46 AM
Please let yourself display the finished SQL query (rawoutput("<pre>$sql</pre>"); before db_query($sql)Wink, run that query in your database management software (most probably phpMyAdmin) and check if the results you get there are what you'd expected.

Edit: Oh, and please remove the 5 definitions of the same function. If you don't change the inside of a function, do not copy it around. This makes code hard to maintain. A function is there to get reused to prevent code duplication.
14  Coding Support / Coding Support Desk / Re: Proper SQL output on: September 02, 2016, 05:46:32 AM
What's the different between iview_inventory_showform and iview_inventory_showform 1? If you want to reuse a function you don't need copy and rename it. Just reusing it is enough. Except if you changed something. Did you?

What I can say is that iview_inventory_showform 1 (if it is the same as iview_inventory_showform) does walk trough the following array:

$layout1 = array(

For each array element, it takes the key and value - in this case, there is only 1 array entry where the key is 0 (numerical array) and $val is "Unequippables".

Then, it splits the value at a comma, leading to the array $info (again, this is done for every array entry), leading to:

$info == array(
, which is the same as before. It  then proceeds to set $info[1] to "" since it doesn't exist.

A trhead line is not added since $info[1] is empty and not "title" which means that it executes the code after line 191 (} else {). Looking through the code, it probably leads to the creation of a table containing all unequippables and adding for every item a row.

Another tablehead is created whenever the class changes, which means that here should be at least 1 tablehead with "Food", except if there is no food row found.

Now that I'm thinking about... you still have not answered my questions.
- what do you mean by "in the first instance it works wonderfully, the second doesn't"?
- what do you expect the result to be?
- what is the result you get? How differs it from the expected output?
- how does your data set look like? (please provide a minimum dataset that reproduces the issue you have)
- if you are just copying and modifying stuff - has the original code worked for you as expected?
- what do you want to do
- why is there a iview_inventory_showform 1() as well as a iview_inventory_showform()? Which is the original one, what did you modify in your copy and why?

And please provide a more verbose code attachment than some page content and a function. In all honesty, I like to help, but I do not like to invest an hour in trying to figure out what you meant when you just can tell me (us) the details.
15  Coding Support / Coding Support Desk / Re: Proper SQL output on: September 02, 2016, 01:51:58 AM
If I understand you correctly, the sql query delivers the expected results (=list of ingredients)? And what exactly do you mean with "the first instance works wonderfully, the second doesn't"? What's the "first instance", whats "the second"? The query you posted looks like the first code block from your original post, which would mean it works? Or.. what?

It would be helpful to see the context where the sql query is actually called. Again - I do not now the module nor what you indent to do with it. Is the function you posted unmodified from the original one? The error might lie in the $layout1 argument which I do not now but seems to be important.

And yeah, sure, there is probably an easier and cleaner way to write the output you'd like to have. You could probably use JQuery to get rid of the javascript generation, but since you currently struggling with php and sql it's a bad idea to try to change that part as well, especially since it has it owns pitfalls.

A general tip: If something does not work, try to understand why by trying to understand the affected code. Compare it with something that works. Try to work out the difference between the two examples. That way you'll learn how everything works.
Pages: [1] 2 3 ... 18

DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

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