User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

Metin2 how to IngameShop

867356f6f95c493a9ccbad5ea14092bc.png

6b3d515093184f3fb8fed42573dc786a.png

a69d0278f7924373aa53c4f7c4ce2b24.png

 Buy Item

9b5e1577dc3b43edb692052a17865f94.png

a265a33e6ce8463cbc1e08749902824b.png

Historic

4e4db1a1b4b94427b7e12cf20c4096fa.png

 

Struct of tables

mall_categories ([id] = id, [categorieName] = Name of Category)

mall_historic_buys ( [conta] = account , [item] = item, [valorGasto] = amount spent, [dataBuy] = date of purchase )

mall_itens ([item_id] = ID of item in item_proto, [item_name] = Name of item, [item_desc] = Description of item, [item_img] = Relative to the path //assets//detail_view//item_img.png and path detail_view_full, [item_cat] = ID relative to the category, [item_type] = here is a enum(simple, expire or stackable), [item_count] = quantity, [socket0] = time for for items to of type expire, [socket1] and [socket2] do not fill.)

mall_pinusers ([accountName] = account login relative to the account.account, [pinCode] = pin security)

SQL 

-- MySQL dump --
-- ---------------------------------------------------------


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- ---------------------------------------------------------


-- CREATE DATABASE "ingamemall" ----------------------------
CREATE DATABASE IF NOT EXISTS `ingamemall` CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `ingamemall`;
-- ---------------------------------------------------------


-- CREATE TABLE "mall_categories" --------------------------
CREATE TABLE `mall_categories` ( 
	`id` Int( 11 ) AUTO_INCREMENT NOT NULL,
	`CategorieName` VarChar( 255 ) NOT NULL,
	PRIMARY KEY ( `id` ) )
ENGINE = InnoDB
AUTO_INCREMENT = 4;
-- ---------------------------------------------------------


-- CREATE TABLE "mall_historic_buys" -----------------------
CREATE TABLE `mall_historic_buys` ( 
	`id` Int( 11 ) AUTO_INCREMENT NOT NULL,
	`conta` VarChar( 255 ) NOT NULL,
	`item` VarChar( 255 ) NOT NULL,
	`valorGasto` VarChar( 255 ) NOT NULL,
	`dataBuy` DateTime NOT NULL,
	PRIMARY KEY ( `id` ) )
ENGINE = InnoDB
AUTO_INCREMENT = 11;
-- ---------------------------------------------------------


-- CREATE TABLE "mall_itens" -------------------------------
CREATE TABLE `mall_itens` ( 
	`id` Int( 11 ) AUTO_INCREMENT NOT NULL,
	`item_id` Int( 11 ) NOT NULL,
	`item_name` VarChar( 255 ) NOT NULL,
	`item_price` Int( 255 ) NOT NULL,
	`item_desc` VarChar( 255 ) NOT NULL,
	`item_img` VarChar( 255 ) NOT NULL,
	`item_cat` Int( 255 ) NOT NULL,
	`item_type` Enum( 'simple', 'expire', 'stackable' ) NOT NULL DEFAULT 'simple',
	`item_count` Int( 11 ) NOT NULL,
	`socket0` Int( 255 ) NULL DEFAULT '0',
	`socket1` Int( 255 ) NULL DEFAULT '0',
	`socket2` Int( 255 ) NULL DEFAULT '0',
	PRIMARY KEY ( `id` ) )
ENGINE = InnoDB
AUTO_INCREMENT = 4;
-- ---------------------------------------------------------


-- CREATE TABLE "mall_pinusers" ----------------------------
CREATE TABLE `mall_pinusers` ( 
	`id` Int( 11 ) AUTO_INCREMENT NOT NULL,
	`accountName` VarChar( 255 ) NOT NULL,
	`pinCode` VarChar( 255 ) NOT NULL,
	PRIMARY KEY ( `id` ) )
ENGINE = InnoDB
AUTO_INCREMENT = 3;
-- ---------------------------------------------------------


-- Dump data of "mall_categories" --------------------------
INSERT INTO `mall_categories`(`id`,`CategorieName`) VALUES ( '1', 'Swords' );
INSERT INTO `mall_categories`(`id`,`CategorieName`) VALUES ( '2', 'Costumes' );
INSERT INTO `mall_categories`(`id`,`CategorieName`) VALUES ( '3', 'Others' );
-- ---------------------------------------------------------


-- Dump data of "mall_historic_buys" -----------------------
INSERT INTO `mall_historic_buys`(`id`,`conta`,`item`,`valorGasto`,`dataBuy`) VALUES ( '14', 'mkIvi3', 'Traje do Deserto', '5000', '2016-07-31 20:52:53' );
INSERT INTO `mall_historic_buys`(`id`,`conta`,`item`,`valorGasto`,`dataBuy`) VALUES ( '15', 'mkIvi3', 'Esferas da Benção', '5000', '2016-07-31 21:05:25' );
INSERT INTO `mall_historic_buys`(`id`,`conta`,`item`,`valorGasto`,`dataBuy`) VALUES ( '16', 'mkIvi3', 'Espada +9', '2500', '2016-07-31 21:05:43' );
-- ---------------------------------------------------------


-- Dump data of "mall_itens" -------------------------------
INSERT INTO `mall_itens`(`id`,`item_id`,`item_name`,`item_price`,`item_desc`,`item_img`,`item_cat`,`item_type`,`item_count`,`socket0`,`socket1`,`socket2`) VALUES ( '1', '19', 'Espada +9', '2500', 'Espada +9 para Guerreiro', '00010', '1', 'simple', '1', '0', '0', '0' );
INSERT INTO `mall_itens`(`id`,`item_id`,`item_name`,`item_price`,`item_desc`,`item_img`,`item_cat`,`item_type`,`item_count`,`socket0`,`socket1`,`socket2`) VALUES ( '2', '41003', 'Traje do Deserto', '5000', 'Traje do Deserto', '41003', '2', 'expire', '1', '1470084001', '0', '0' );
INSERT INTO `mall_itens`(`id`,`item_id`,`item_name`,`item_price`,`item_desc`,`item_img`,`item_cat`,`item_type`,`item_count`,`socket0`,`socket1`,`socket2`) VALUES ( '3', '70024', 'Esferas da Benção', '5000', 'Esferas da Benção', '70024', '3', 'stackable', '200', '0', '0', '0' );
-- ---------------------------------------------------------


-- Dump data of "mall_pinusers" ----------------------------
INSERT INTO `mall_pinusers`(`id`,`accountName`,`pinCode`) VALUES ( '4', 'mkIvi3', '123456' );
-- ---------------------------------------------------------


/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- ---------------------------------------------------------

 

Game Source

In cmd_general.cpp (header includes)

add

#include <cryptopp/aes.h>
#include <cryptopp/modes.h>
#include <cryptopp/base64.h>
#include <boost/lexical_cast.hpp>

Search for 

ACMD(do_in_game_mall)

above add

std::string aes_encrypt(const std::string& str_in, const std::string& key, const std::string& iv)
{
    std::string str_out;
    CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption encryption((byte*)key.c_str(), key.length(), (byte*)iv.c_str());

    CryptoPP::StringSource encryptor(str_in, true,
        new CryptoPP::StreamTransformationFilter(encryption,
            new CryptoPP::Base64Encoder(
                new CryptoPP::StringSink(str_out),
                false
            )
        )
    );
    return str_out;
}

 

in function 

ACMD(do_in_game_mall)
//REPLACE 
		char buf[512+1];
		char sas[33];
		MD5_CTX ctx;
		const char sas_key[] = "GF9001";

		snprintf(buf, sizeof(buf), "%u%u%s", ch->GetPlayerID(), ch->GetAID(), sas_key);

		MD5Init(&ctx);
		MD5Update(&ctx, (const unsigned char *) buf, strlen(buf));
#ifdef __FreeBSD__
		MD5End(&ctx, sas);
#else
		static const char hex[] = "0123456789abcdef";
		unsigned char digest[16];
		MD5Final(digest, &ctx);
		int i;
		for (i = 0; i < 16; ++i) {
			sas[i+i] = hex[digest[i] >> 4];
			sas[i+i+1] = hex[digest[i] & 0x0f];
		}
		sas[i+i] = '\0';

// WITH THIS
		std::string GameKeyShop = "RZN942";
        std::string key = "96582146752486249517535915478532"; // 32 bytes
        std::string iv  = "5476325954125471"; // 16 bytes

        std::string encryptKeyAES = boost::lexical_cast<std::string>(ch->GetPlayerID()) + boost::lexical_cast<std::string>(ch->GetAID()) + GameKeyShop;

        std::string str_encrypted = aes_encrypt(encryptKeyAES, key, iv);

        char buffer[512+1];

        snprintf(buffer, sizeof(buffer), "mall http://%s/index.php?pid=%u&sas=%s",
                 g_strWebMallURL.c_str(), ch->GetPlayerID(), str_encrypted.c_str());

        //ch->ChatPacket(CHAT_TYPE_INFO, buffer); //Debug output
        ch->ChatPacket(CHAT_TYPE_COMMAND, buffer);

And remove the rest

snprintf(buf, sizeof(buf), "mall http://%s/ishop?pid=%u&c=%s&sid=%d&sas=%s", ......

PHP Files Config

//manage//Classes//Configurations//GameConfig.php
/* Defines for Connection*/

$SisDbHost = "192.168.25.57"; //IP SERVER
$SisDbUser = "root"; //user db
$SisDbPass = "password"; //password db
$SisDbTB = "account"; // db by default

//Game Tables
$Account_db = "account"; //YOUR GAME ACCOUNT DB (live_account, account, some_account)
$Player_db = "player"; //YOUR GAME PLAYER DB (live_player, player, some_player)

$GameKeyShop = "RZN942"; //KEY string, change this, and change in source game
$AES_IV = '5476325954125471'; //16 bytes   CHANGE HERE AND CHANGE in SOURCE GAME
$AES_KEY = '96582146752486249517535915478532'; //32 bytes CHANGE HERE AND CHANGE in SOURCE GAME

 

And Core CONFIG

MALL_URL: localhost/m2ingameshop

Column in account by default 'cash'

Download

https://mega.nz/#!usYGDAjR!VtT0ZKgSdrSlhJjRf6pVdPCj1CyEF-P8pa6spfPP-FA

Scan

https://www.virustotal.com/pt/file/40633dbf9e0df30d5ef39de30e197e4c9eea650b9a7ab545fb20bb7fb582b339/analysis/1470004085/

0
0
0
s2smodern

Metin2play.info Metin2 Global Community!