[Release] WebShop For 97d+99i Update 4

nelson25

Active Member
Joined
Apr 1, 2017
Messages
167
Reaction score
40
Screenshot by Lightshot

Module added
Pros:
- It is working and well secured
- It is dynamically created, so you could add an additional resource for sell
- Support the latest PHP versions

Cons:
- Needs a visual improvements
- Needs to be translated into the other added languages
- Adding option to sell all resources at once

Excellent module. I meant that our users can buy them, how they buy any item here.
 

dota-sdso

Well-Known Member
Joined
Apr 30, 2014
Messages
590
Reaction score
822
Excellent module. I meant that our users can buy them, how they buy any item here.

Well, I did not understand what you mean. I can not say that will do it as I have done such modules couple of times in different variations and there is no challenge to me and if there is no challenge, I have no interest.

But you can have a look on to DTweb 2.0 jewel depositor or box adder how they are written and take the part you need to implement it here.

If you do so, I will be very thankful if you share the module with others as we all do.
 
Last edited:

dota-sdso

Well-Known Member
Joined
Apr 30, 2014
Messages
590
Reaction score
822
Хайде от мен да мине, барем ме помните с добро. Няма да правим проблем за 30 реда код при положение, че Savoy всичко е направил и трябва само да до сглобим.

Screenshot by Lightshot

PHP:
<?php
iseedeadpeople();
$success = false;
switch (1) {
	default: 
/********** Buy Resources *************/
$webshop['buyres']        = true; // Start Stop Module			 
$webshop['buyres_temp']   = array(
	//         ItemName           HexMark   Credits
	   array("Box of Kundun + 1"  ,'CB40'     ,200),
	   array("Box of Kundun + 2"  ,'CB48'     ,300),
	   array("Box of Kundun + 3"  ,'CB50'     ,400),
	   array("Box of Kundun + 4"  ,'CB58'     ,500),
	   array("Box of Kundun + 5"  ,'CB60'     ,600),
       array("Jewel of Chaos"     ,'8F00'     ,600),
       array("Jewel of Life"      ,'D000'     ,600),
       array("Jewel of Bless"     ,'CD00'     ,600),
       array("Jewel of Soul"      ,'CE00'     ,600),	   
	 );	
	 
	require 'inc/function.iteminfo.php';
	foreach($webshop['sell_resources'] as $key => $values){
		$options .= "<form method='post'><option value='".$key."'>".$values[0]."</option>";
		$prices  .= "<tr><td>" .$values[0]. "</td><td> x" .$values[2]. " credits</td></tr>";
	}	
    if(isset($_POST['type']) && isset($_POST['count'])){
	   $type  = (int)$_POST['type'];
	   $count = (int)$_POST['count'];
	   if($type >=0 && $type < count($webshop['buyres_temp']) && $count > 0){
		  	if(mssql_num_rows(mssql_query("Select * from Memb_Stat where ConnectStat=0 and memb___id='" . htmlspecialchars($_COOKIE['WebShopUsername']. "'"))) == 1){
                if($mycreds >= bcmul($count,$webshop['buyres_temp'][$type][2])){
			        for($i=0;$i < $count; $i++){
					   	$mycuritems = '0x' . strtoupper(bin2hex(mssql_fetch_row(mssql_query("SELECT [Items] FROM [warehouse] WHERE [AccountID]='" . $GLOBALS['mu_user'] . "'"))[0]));		 
				        $ser_ex	    = mssql_fetch_row(mssql_query("exec WZ_GetItemSerial"));
				        $newitem    = $webshop['buyres_temp'][$type][1]."00".sprintf("%08X", $ser_ex[0],00000000)."800000";				        
			            $test		= 0;
			            $slot 	    = smartsearch($mycuritems,1,1); 
			            $test		= $slot*20;
						if ($slot == 1337)  { 
			            	print "<br>".phrase_no_slots;			            
			            }
						else{
							$mynewitems = substr_replace($mycuritems, $newitem, ($test+2), 20); 									
							$update_ware = mssql_query("Update warehouse set items = ".$mynewitems." where AccountID='".htmlspecialchars($_COOKIE['WebShopUsername'])."'");
                            if($update_ware){
			   	                mssql_query("Update Memb_Credits set credits = credits-".bcmul($count,$webshop['buyres_temp'][$type][2])." where memb___id='".htmlspecialchars($_COOKIE['WebShopUsername'])."'");        
			                    $message = "You have successfully bought x".$count." " . $webshop['buyres_temp'][$type][0] ." for " . bcmul($count,$webshop['buyres_temp'][$type][2]) . " credits " ;				   
				                echo '<meta http-equiv="refresh" content="1">';
								$success = true;
							}						
						}
			   	    }
					if($success){
						echo $message;
					}
				}
				else{
					print phrase_lack_credits;
				}
			}
		else{
			echo phrase_leave_the_game;
		}
	  }
	  else{
		echo "Please select the resource properly";  
	  }
	}
	
	print '<fieldset style="width: 350px;background-color: #DDDDDD;border: 1px solid #000000; font-family: arial; font-size: 12px;"><legend class="mu_style2" style="padding: 3px;font-weight:bold;background-color: #DDDDDD;border: 1px solid #000000;border-bottom:0px;">Sell Resources</legend>';	
	echo "
	<form method='post'>
	<table width=100% cellpadding='2' cellspacing='1'	border='1'>
        <tr style='background:#bbbbbb;font-weight:600'>
		   <td>Choose Resource</td>
		   <td>Amount</td>
		</tr>			
	    <tr>
		               <td><select name='type'>".$options."</select></td>
					   <td><input type='number' name='count'/></td>
					   <td align='center'>
					       <input class='button' type='submit' value='Buy Now' name='submit'/>
						</td>
			   </tr>";
		

echo '</table></br>
<fieldset style="width: 300px">
<legend class="mu_style2" style="padding: 0px;font-weight:bold;">Price Table</legend>
<div align="justify">
<table width=100% cellpadding="2" cellspacing="1" border=1>
<tr  style="background:#bbbbbb;font-weight:600"><td>Resource Name</td><td> Price Each</td></tr>
'.$prices.'
</table>
</div>
</fieldset>';
}

?>
 

Attachments

  • Webshop 0.9 with Resource Sell and Buy.rar
    722.5 KB · Views: 38
  • Like
Reactions: Ivaylo99

herjuni

Member
Joined
May 27, 2015
Messages
47
Reaction score
2
you have some correction when you buy an error item that the character is connected to the server that is disconnected so do not dupe items
 

EddyM

New Member
Joined
Feb 2, 2019
Messages
17
Reaction score
0
Verifying required extensions:OK

Parse error
: parse error in C:\xampp\htdocs\shop\inc\mssql2sqlsrv.php on line 10



How to fix this error ? I use xampp 1.7.1
 

DemonuMu

Well-Known Member
Joined
May 26, 2011
Messages
1,053
Reaction score
220
Update 4:
Fixed buy resets, points and zen vulnerability

DarkMaster i have problems with the new update WebShop 97d99i Update 4 not working to install

qnvgbs.png
 

kennrj93

New Member
Joined
Oct 27, 2018
Messages
9
Reaction score
0
How we can fix the problem of "You do not not have free slots in your vault to add this item" when infact my vault is clean and no items is there.
 

DemonuMu

Well-Known Member
Joined
May 26, 2011
Messages
1,053
Reaction score
220
How we can fix the problem of "You do not not have free slots in your vault to add this item" when infact my vault is clean and no items is there.

Connect to the game and open just once your vault and then is work
 

kennrj93

New Member
Joined
Oct 27, 2018
Messages
9
Reaction score
0
Connect to the game and open just once your vault and then is work
I try it already sir still thesame. i think those error pops up on selected items. special the Absolute Sword of Archangel . it always says that "You do not not have free slots in your vault to add this item "
 

nelson25

Active Member
Joined
Apr 1, 2017
Messages
167
Reaction score
40
When trying to buy items, vault appears full. I have it empty, without items. Any solution?
 

dota-sdso

Well-Known Member
Joined
Apr 30, 2014
Messages
590
Reaction score
822
Does it happen to all items or only items that take 1x4, 2x4 slots?
 

dota-sdso

Well-Known Member
Joined
Apr 30, 2014
Messages
590
Reaction score
822
any fix ? thank you

Use PHP version older than 5.6, rewrite the smartsearch function or replace it with the code written by @Dea7h from https://darksteam.net/threads/nyxweb-muonline-website-currently-only-season-1-support.24498/. I have adjusted it slightly to work with the webshop.

PHP:
function smartsearch($warehouse, $_x, $_y) {
        $slots = str_repeat(0, 120);   //Creating 120 slots of 0's
        for ($i = 0; $i < 120; $i++) { //Setting all taken slots to 1
            $hex = substr($warehouse, $i * 20, 20);
            if (strtoupper($hex) != str_repeat('F', 20)) {
                $decode = ItemInfo($hex);
                $slots = substr_replace($slots, str_repeat(1, $decode['X']), $i, $decode['Y']);
                if ($decode['Y'] > 1) {
                    for ($r = 0; $r < $decode['Y'] - 1; $r++) {
                        $slots = substr_replace($slots, str_repeat(1, $decode['X']), $i + 8 + $r * 8, $decode['Y']);
                    }
                }
            }
        }

        for ($i = 0; $i < 120; $i++) { //Going through $slots and checking if there are any empty slots that matches our item
            if ((ceil(($i + 1) / 8) * 8) >= ($i + $_x) && substr($slots, $i, $_x) === str_repeat(0, $_x)) { //First empty row found
                if ($_y > 1) { //If the item is bigger than 1 slot vertically (Y)
                    if ((ceil(($i + 1) / 8) + $_y - 1) <= 15) {
                        $row = 0;
                        for ($r = 0; $r < $_y - 1; $r++) {
                            if (substr($slots, $i + 8 + $r * 8, $_x) === str_repeat(0, $_x)) {
                                $row++;
                            }
                        }

                        if ($row == $_y - 1) {
                            return $i;
                        }
                    }
                } else {
                    return $i;
                }
            }
        }
        return 1337;
    }
 
Last edited:
  • Love
  • Like
Reactions: WebShok and Dea7h

WebShok

New Member
Joined
Mar 26, 2019
Messages
15
Reaction score
2
Use PHP version older than 5.6, rewrite the smartsearch function or replace it with the code written by @Dea7h from https://darksteam.net/threads/nyxweb-muonline-website-currently-only-season-1-support.24498/. I have adjusted it slightly to work with the webshop.

PHP:
function smartsearch($warehouse, $_x, $_y) {
        $slots = str_repeat(0, 120);   //Creating 120 slots of 0's
        for ($i = 0; $i < 120; $i++) { //Setting all taken slots to 1
            $hex = substr($warehouse, $i * 20, 20);
            if (strtoupper($hex) != str_repeat('F', 20)) {
                $decode = ItemInfo($hex);
                $slots = substr_replace($slots, str_repeat(1, $decode['X']), $i, $decode['Y']);
                if ($decode['Y'] > 1) {
                    for ($r = 0; $r < $decode['Y'] - 1; $r++) {
                        $slots = substr_replace($slots, str_repeat(1, $decode['X']), $i + 8 + $r * 8, $decode['Y']);
                    }
                }
            }
        }

        for ($i = 0; $i < 120; $i++) { //Going through $slots and checking if there are any empty slots that matches our item
            if ((ceil(($i + 1) / 8) * 8) >= ($i + $_x) && substr($slots, $i, $_x) === str_repeat(0, $_x)) { //First empty row found
                if ($_y > 1) { //If the item is bigger than 1 slot vertically (Y)
                    if ((ceil(($i + 1) / 8) + $_y - 1) <= 15) {
                        $row = 0;
                        for ($r = 0; $r < $_y - 1; $r++) {
                            if (substr($slots, $i + 8 + $r * 8, $_x) === str_repeat(0, $_x)) {
                                $row++;
                            }
                        }

                        if ($row == $_y - 1) {
                            return $i;
                        }
                    }
                } else {
                    return $i;
                }
            }
        }
        return 1337;
    }
any chance to make it usable with php 5.6 ? thank you.
 

WebShok

New Member
Joined
Mar 26, 2019
Messages
15
Reaction score
2
The function I have paste works with any PHP version so say big thanks to @Dea7h and use it.
I replaced the function and now when I buy something it takes my credits and i don't get the item, I tried with every item in the shop. No errors.