Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Release] Spiegelmann's Marveltastic Spectacular (Marvel Machine)

Divine Celestial
Member
Joined
Sep 29, 2008
Messages
804
Reaction score
219
HHmHWOI - [Release] Spiegelmann's Marveltastic Spectacular (Marvel Machine) - RaGEZONE Forums
It's that time of year for gifts and the like and I can't wait to tell you about my latest and greatest invention, the Spiegelmann's Marveltastic Spectacular. Why, yes, it's a mouthful but boy is it a joy and it's free from me--something you'll probably never see from me (I need to make money somehow, right?). I thank you for coming and visiting and I can't wait to get started to show you how it works!

The best thing to showcase my invention is--you guessed it! A video! This is how my invention functions, I'm sure you humans are smart enough to figure it out without me needing to explain it in great detail.

Nonetheless, there will be the handful of you "snails" out there that don't quite grasp what it is! It's essentially a recreation of the original MapleStory's Marvel Machine! Spend some money, get some items in return--a website gachapon if you will.

You may be thinking... "Spiegelmann, you're a horrible and ruthless person! You're probably the Black Mage himself!"
While it may be true [STRIKE]that I'm the Black Mage[/STRIKE] that I like to use people for money, this time... I want to try something new. Give something away for free! Why are you complaining? You don't like free? Free is my kind of price. Also, the code is messy and it was rushed to completion.

Onwards, ho! Let's get on to integrating this invention into MapleBit and your server.
Prerequisites: Must have a version with the 'Rewards' system (in video) already available.
Getting the files
First, you need to get the files! This would be a pain in the butt if I were to post the code for each and every single one of them.
Add the files to the corresponding folders in the .zip, (if a file is in the assets folder, add it in the assets folder).

Modifying it so it works for you
Now, time to modify the files!
sources/ucp/main.php
After
PHP:
	<li><a href=\"?base=ucp&page=ticket\">Tickets</a></li>
Add
PHP:
	<li><a href=\"?base=ucp&page=marvel\">Marvel Machine</a></li>
---
After
PHP:
			}elseif($ucp == "characters"){
				include('sources/ucp/characters.php');
Add
PHP:
			}elseif($ucp == "marvel"){
				include('sources/ucp/marvel.php');
assets/config/afuncs.php
After (optional, this will work pretty much anywhere else within reason)
PHP:
function ago($time)
{
   $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
   $lengths = array("60","60","24","7","4.35","12","10");

   $now = time();

       $difference     = $now - $time;
       $tense         = "ago";

   for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
       $difference /= $lengths[$j];
   }

   $difference = round($difference);

   if($difference != 1) {
       $periods[$j].= "s";
   }

   return "$difference $periods[$j] ago";
}
Add
PHP:
/*maplefreak26 Marveltastic Spectacular Begin*/
function getPrice($nxorvp) { //get the price for marvel
	$nx_price = 4900;
	$vp_price = 2;//vote point price (not functional)
	$basePriceNX = $nx_price;
	$basePriceVP = $vp_price;
	if ($nxorvp == "nx") {
		$price = $basePriceNX;
	}
	if ($nxorvp == "vp") {
		$price = $basePriceVP;
	}
	return $price;
}
function getName($itemID, $fordisplay) { //lol, version 4 of this, a bit more efficient than the previous
	$url_path = "";//must add trailing slash
	$data = file_get_contents("http://".$_SERVER['HTTP_HOST']."/".$url_path."sources/marvel/getItem?id=".$itemID."");
	if ($fordisplay == false) {
		$data_escaped = addslashes($data);
	} else {
		$data_escaped = $data;
	}
	return $data_escaped;
}
function generateCSCode() {//supposed to be used for Cash Shop code generation, but used for identifying the item instead because Cash Shop doesn't work
	$characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	$charactersLength = strlen($characters);
	$randomString = 'SMS';//[S]piegelmann's [M]arveltastic [S]pectacular
	for ($i = 0; $i < 15; $i++) {
		$randomString .= $characters[rand(0, $charactersLength - 1)];
	}
	return $randomString;
}
function doTheMath($currentNX, $price) {//simple calculation for price
	$result1 = $currentNX - $price;
	return $result1;
}

function createPassword($length) {//blabla 
    $chars = "abcdefghijkmnopqrstuvwxyz023456789";
    srand((double)microtime()*1000000);
    $i = 0;
    $pass = '' ;
    while ($i <= ($length - 1)) {
        $num = rand() % 33;
        $tmp = substr($chars, $num, 1);
        $pass = $pass . $tmp;
        $i++;
    }
    return $pass;
}
/* Marveltastic Spectacular End */
DO NOT FORGET TO ADD THE PROPER URL PATH FOR $url_path IF YOU AREN'T USING THE ROOT DIRECTORY
Working on the database!
Ok, now, we need to work on the database side. Again, the prerequisites are that you must have a working rewards system. If you don't know or aren't sure, please refer to the video above where I get the item from a list. Also, you can check out the Rewards system when GMS has a Hot Day.
If your rewards can't be shared with your entire account (only limited to one character), please continue. Otherwise, skip this following spoiler and move on to the next one.
Please verify that it is the exact same (other than aid and identifier) with your existing rewards table, modify it accordingly.
Code:
CREATE TABLE `rewards_account` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `aid` int(11) NOT NULL,
  `start` bigint(20) NOT NULL DEFAULT '-1',
  `end` bigint(20) NOT NULL DEFAULT '-1',
  `type` int(11) NOT NULL DEFAULT '0',
  `itemId` int(11) NOT NULL DEFAULT '0',
  `mp` int(11) NOT NULL DEFAULT '0',
  `meso` int(11) NOT NULL DEFAULT '0',
  `exp` int(11) NOT NULL DEFAULT '0',
  `desc` text NOT NULL,
  `identifier` varchar(18) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
(PS: I know, I know, with a little more work, I could've made it so that the entire account reward could've been read from the existing rewards table but being inefficient is what I do best.)
Table for Marvel Prize History
Execute this!
Code:
CREATE TABLE `marvel_history` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `accid` int(11) NOT NULL,
  `date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `exp_date` bigint(20) NOT NULL DEFAULT '0',
  `item_id` int(11) NOT NULL DEFAULT '0',
  `is_for_reward` int(11) NOT NULL DEFAULT '0',
  `coupon_code` int(11) NOT NULL DEFAULT '0',
  `identifier` varchar(18) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;
Wasn't that fun? Last step! The source!
I'm really tired at the moment and I can't be of much help with this one. Basically, all you do is look for the 'try' statements for every single method that executes an sql query for the Rewards system. An example would be updateReward() (I think!). Copy the try statement, paste it right under and change it so that it would work correctly for the reward_account table you added earlier. Also, remember, instead of id, it should be accountid because otherwise it would add the character id.

I MAY HAVE MISSED SOMETHING, PLEASE DON'T HESITATE TO ASK. IF YOU HAVE QUESTIONS, PLEASE KEEP IT IN THE HELP SECTION, THANKS.

Have fun, you filthy peasants.

maplefreak26's Note: This release is for the Xmas Challenge, I'm aware that I didn't formally accept it but hey, at least I released something, right? Anyway, the code for this is messy and very incomplete. I released this to get any other developers to help fix it up and improve it. You're free to use this, modify it in any way you see fit without any credits though it would be appreciated.
Speaking of credits, I'd like to personally thank Dynamik; and Tsundere for giving me motivational support and all kinds of help to do these kinds of things. Thanks!
I'm also really tired. I'm staying up waay too late as I'm writing this and just realized that this is my 1000th post. How fitting! :)
 

Attachments

You must be registered for see attachments list
Custom Title Activated
Member
Joined
Nov 14, 2008
Messages
1,025
Reaction score
641
why is it in php? why is it no using the latest webscale web technologies such as rails and django? it has to be webscale
 
Divine Celestial
Member
Joined
Sep 29, 2008
Messages
804
Reaction score
219
Does it really spins with animation integrated? cant see much based from the video.
Yeah, I think it's kind of cheap. I looked for a jquery slider that does vertical sliding and found one. The item images are also automatically upscaled using PixelPerfect. (I instantly feli in love with it when I saw it being used in )
Probably the best web release I've seen her in a long time. Good job. 10/10.
The only web release that's good in over so many years ^ Fraysa
Great work, buddy. I told you this release was amazing. But you didn't believe me...
Thanks!
why is it in php? why is it no using the latest webscale web technologies such as rails and django? it has to be webscale
It's in PHP and not using any other web technology because I don't know how to use those. I'd love to learn how to though.
I know the code is probably very inefficient and messy and I'm aware of that, if you would like to, you can help improve on it using any kind of new technologies or better optimization of the current code. It's all open and I'd love to learn from my mistakes. :)
 
Joined
Jul 12, 2011
Messages
1,229
Reaction score
475
why is it in php? why is it no using the latest webscale web technologies such as rails and django? it has to be webscale

Maplestory sites don't need to scale on the level where you'd notice any advantages. Also every site released in this section use an outdated way of writing PHP websites, so I wouldn't form any opinions based off of sites like MapleBit.
 
Skilled Illusionist
Joined
Feb 26, 2009
Messages
307
Reaction score
36
What was wrong with it? She said she fixed it before I could see what was wrong with it.

Small thing was the 'spins' column that was missing, and for me it's not loading the php files, and i don't know why.

Also the npc for collecting your items is something to make this marvel machine complete, however it's posted on the Alternative Languages section.



EHxUoj - [Release] Spiegelmann's Marveltastic Spectacular (Marvel Machine) - RaGEZONE Forums


stuffs like this



KvAOrIw - [Release] Spiegelmann's Marveltastic Spectacular (Marvel Machine) - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Divine Celestial
Member
Joined
Sep 29, 2008
Messages
804
Reaction score
219
and for me it's not loading the php files, and i don't know why.

I'm not sure why it would do that. How is your MapleBit setup? Is MapleBit in a directory (like, ) Or is it at the root ( ).

PHP:
function getName($itemID, $fordisplay) { //lol, version 4 of this, a bit more efficient than the previous
	$url_path = "";//must add trailing slash
	$data = file_get_contents("http://".$_SERVER['HTTP_HOST']."/".$url_path."sources/marvel/getItem?id=".$itemID."");
	if ($fordisplay == false) {
		$data_escaped = addslashes($data);
	} else {
		$data_escaped = $data;
	}
	return $data_escaped;
}

In assets/config/afuncs.php, you added this function. If MapleBit is in a different directory, add the directory in $url_path.
Right now, if it's blank, it's going to call for
If you added "bit/" in the $url_path for example, it will call for
 
Skilled Illusionist
Joined
Feb 26, 2009
Messages
307
Reaction score
36
I'm not sure why it would do that. How is your MapleBit setup? Is MapleBit in a directory (like, ) Or is it at the root ( ).

Oh hmm now you mention it......... i use /maplebit-master/



I changed this...
$data = file_get_contents("http://".$_SERVER['HTTP_HOST']."/".$url_path."sources/marvel/getItem?id=".$itemID."");

into this...

$data = file_get_contents("http://".$_SERVER['HTTP_HOST']."/maplebit-master/sources/marvel/getItem.php?id=".$itemID."");



But it still doesn't show any images :p
 
Divine Celestial
Member
Joined
Sep 29, 2008
Messages
804
Reaction score
219
But it still doesn't show any images :p
[strike]
In sources/ucp/marvel.php & sources/ucp/marvel.prize-list.php
Look for anything like this
PHP:
<script type="text/javascript" language="javascript" src="assets/js/jquery.pixelperfect.js"></script>
or
PHP:
<script type="text/javascript" language="javascript" src="/assets/js/jquery.pixelperfect.js"></script>
Make sure that these are correct and are properly hitting your the jquery.pixelperfect.js file.
PHP:
    <script type="text/javascript" language="javascript" src="/assets/js/jquery.bxslider.min.js"></script>
[/strike]
EDIT: If you see any slash before the word assets (example: /assets/js/jquery.pixelperfect.js or /assets/js/jquery.pixelperfect.js), remove that slash so it will be like (example: assets/js/jquery.pixelperfect.js)

if the images still don't show up and if you're on Chrome, hit F12 and then refresh the marvel machine page, there should be a log towards the bottom that tells you if anything is missing. Can you please show that to me?
Example:
foW8RuL - [Release] Spiegelmann's Marveltastic Spectacular (Marvel Machine) - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Last edited:
Skilled Illusionist
Joined
Feb 26, 2009
Messages
307
Reaction score
36
0vByHMP - [Release] Spiegelmann's Marveltastic Spectacular (Marvel Machine) - RaGEZONE Forums




add the $prefix; to your codes and it will fit in all maplebit sites.
 

Attachments

You must be registered for see attachments list
Back
Top