|
You last visited: Today at 06:27
Advertisement
Boosters in shop not working
Discussion on Boosters in shop not working within the DarkOrbit forum part of the Browsergames category.
09/16/2020, 17:12
|
#1
|
elite*gold: 0
Join Date: Feb 2018
Posts: 21
Received Thanks: 0
|
Boosters in shop not working
Hi I want to ask why it doesn't work for me to join the game when I buy a booster. In emulator 10.
tell me that
Code:
Failed loading user ship / ShipInitializationHandler ERROR
but when I throw it in a chat game it works.
I would like to ask if this code is spelled correctly.
Code:
try{
if ($_SERVER['REQUEST_METHOD'] === 'POST' && Functions::IsLoggedIn()) {
$player = Functions::GetPlayer();
$notOnlineOrOnlineAndInEquipZone = (!Socket::Get('IsOnline', array('UserId' => $player['userId'], 'Return' => false)));
if ($notOnlineOrOnlineAndInEquipZone) {
if ($shop['items'][$itemId]['category'] == 'boosters') {
if ($shop['items'][$itemId]['category'] == 'boosters') { // Ships
//array_push($boosters->Type, $shop['items'][$itemId]['shipId']);
//1 mysql_fetch_object($boosters,$shop['items'][$itemId]['shipId']);
$boosters= $shop['items'][$itemId]['shipId'];
$status = true;
}
}
} else {
$json['message'] = 'ERROR, you are logged in, please log out';
}
}
}
|
|
|
09/16/2020, 18:10
|
#2
|
elite*gold: 0
Join Date: Sep 2015
Posts: 1,135
Received Thanks: 535
|
It's hard to tell as the PHP code that you've provided inherits variables that isn't included
Both the $shop and $itemId isn't declared any where in the code and I also noticed
PHP Code:
if ($shop['items'][$itemId]['category'] == 'boosters') { if ($shop['items'][$itemId]['category'] == 'boosters') { // Ships
Is duplicated
However I'm not sure this code will change anything but I've cleaned the code a bit so the if statements isnt nested like before
PHP Code:
try{ if (! $_SERVER['REQUEST_METHOD'] === 'POST' && ! Functions::IsLoggedIn()) { die("Method wasn't a POST and you aren't logged in"); }
$player = Functions::GetPlayer(); $notOnlineOrOnlineAndInEquipZone = (!Socket::Get('IsOnline', array('UserId' => $player['userId'], 'Return' => false)));
if (! $notOnlineOrOnlineAndInEquipZone) { $json['message'] = 'ERROR, you are logged in, please log out'; exit; }
if (! $shop['items'][$itemId]['category'] == 'boosters') { // Ships die("Not a booster"); }
//array_push($boosters->Type, $shop['items'][$itemId]['shipId']); //1 mysql_fetch_object($boosters,$shop['items'][$itemId]['shipId']); $boosters= $shop['items'][$itemId]['shipId']; $status = true; }
|
|
|
09/16/2020, 18:14
|
#3
|
elite*gold: 0
Join Date: Feb 2018
Posts: 21
Received Thanks: 0
|
Now i have tried your code and it doesn't work to buy me a booster.
I'm sorry but I'm learning now in codes: D
|
|
|
09/16/2020, 18:20
|
#4
|
elite*gold: 0
Join Date: Sep 2015
Posts: 1,135
Received Thanks: 535
|
Quote:
Originally Posted by KnightCreeper023
Now i have tried your code and it doesn't work to buy me a booster.
I'm sorry but I'm learning now in codes: D
|
Do you still get the same error? I've never tried to look into Darkorbit stuff private server stuff, so I have no clue on how your CMS or other stuff is coded
**PS** I just noticed i forgot to paste the ending of the try phrase. So i've updated the code
|
|
|
09/16/2020, 18:22
|
#5
|
elite*gold: 0
Join Date: Feb 2018
Posts: 21
Received Thanks: 0
|
yeah i have infinityorbit files but everything there works like me but stupid boosters.
and now it doesn't even tell me I bought a booster.
|
|
|
09/16/2020, 18:27
|
#6
|
elite*gold: 0
Join Date: Sep 2015
Posts: 1,135
Received Thanks: 535
|
Quote:
Originally Posted by KnightCreeper023
yeah i have infinityorbit files but everything there works like me but stupid boosters.
and now it doesn't even tell me I bought a booster.
|
Try the code again after I've remembered to include the ending of the try phrase
And please return here with the error you received when trying to buy
|
|
|
09/16/2020, 21:04
|
#7
|
elite*gold: 0
Join Date: Feb 2018
Posts: 21
Received Thanks: 0
|
I tried it so I had it at the beginning but I didn't want to connect it to the server
|
|
|
09/17/2020, 08:56
|
#8
|
elite*gold: 0
Join Date: Sep 2015
Posts: 1,135
Received Thanks: 535
|
Quote:
Originally Posted by KnightCreeper023
I tried it so I had it at the beginning but I didn't want to connect it to the server
|
Did you try the updated Code as i stated? There shouldbt be a difference in how it works just easier to read + removal of the duplicate
Ofc you have to replace your old code with it
|
|
|
09/17/2020, 14:11
|
#9
|
elite*gold: 0
Join Date: Feb 2018
Posts: 21
Received Thanks: 0
|
yes i tried your code now but i buy booster.
But still have error in server console.
Code:
[17.09.2020 14:10:31] - Failed loading user ship / ShipInitializationHandler ERROR
Or I want to ask if this code you gave me would be done in such a way that it would automatically happen even without turning off the game
|
|
|
09/17/2020, 14:26
|
#10
|
elite*gold: 0
Join Date: Sep 2015
Posts: 1,135
Received Thanks: 535
|
Quote:
Originally Posted by KnightCreeper023
yes i tried your code now but i buy booster.
But still have error in server console.
Code:
[17.09.2020 14:10:31] - Failed loading user ship / ShipInitializationHandler ERROR
Or I want to ask if this code you gave me would be done in such a way that it would automatically happen even without turning off the game
|
Where do you get that Error - on the site or in the emulator?
|
|
|
09/17/2020, 14:30
|
#11
|
elite*gold: 0
Join Date: Feb 2018
Posts: 21
Received Thanks: 0
|
Emulator
|
|
|
09/17/2020, 14:45
|
#12
|
elite*gold: 0
Join Date: Sep 2015
Posts: 1,135
Received Thanks: 535
|
Quote:
Originally Posted by KnightCreeper023
Emulator
|
Then you'll have to find the code that produces the error in the emulgator i would assume
|
|
|
09/17/2020, 14:55
|
#13
|
elite*gold: 0
Join Date: Feb 2018
Posts: 21
Received Thanks: 0
|
i found file "boostermanager" but idk if that's it: /
I'll send you all the code here and check it out because I'm not sure if it's here
Code:
namespace Ow.Game.Objects.Players.Managers
{
public class BoosterBase
{
public short Type { get; set; }
public int Seconds { get; set; }
public BoosterBase(short type, int seconds)
{
Type = type;
Seconds = seconds;
}
}
class BoosterManager : AbstractManager
{
public Dictionary<short, List<BoosterBase>> Boosters = new Dictionary<short, List<BoosterBase>>();
public BoosterManager(Player player) : base(player) { }
private DateTime boosterTime = new DateTime();
public void Tick()
{
if (boosterTime.AddSeconds(5) < DateTime.Now)
{
for (short i = 0; i < Boosters.ToList().Count; i++)
{
var boosters = Boosters.ToList()[i].Value;
for (short k = 0; k < boosters.Count; k++)
{
boosters[k].Seconds -= 5;
if (boosters[k].Seconds <= 0)
Remove((BoosterType)boosters[k].Type);
}
}
boosterTime = DateTime.Now;
}
}
public void Add(BoosterType boosterType, int hours)
{
Player.SendPacket($"0|A|STM|booster_found|%BOOSTERNAME%|{boosterType.ToString()}|%HOURS%|{hours}");
var seconds = (int)TimeSpan.FromHours(hours).TotalSeconds;
short boostedAttributeType = GetBoosterType((short)boosterType);
if (boostedAttributeType != 0)
{
if (!Boosters.ContainsKey((short)boostedAttributeType))
Boosters[boostedAttributeType] = new List<BoosterBase>();
if (Boosters[boostedAttributeType].Where(x => x.Type == (short)boosterType).Count() <= 0)
Boosters[boostedAttributeType].Add(new BoosterBase((short)boosterType, seconds));
else
Boosters[boostedAttributeType].Where(x => x.Type == (short)boosterType).FirstOrDefault().Seconds += seconds;
Update();
QueryManager.SavePlayer.Boosters(Player);
}
}
public void Remove(BoosterType boosterType)
{
short boostedAttributeType = GetBoosterType((short)boosterType);
if (boostedAttributeType != 0)
{
if (Boosters.ContainsKey(boostedAttributeType))
Boosters[boostedAttributeType].Remove(Boosters[boostedAttributeType].Where(x => x.Type == (short)boosterType).FirstOrDefault());
if (Boosters[boostedAttributeType].Count == 0)
Boosters.Remove(boostedAttributeType);
Update();
QueryManager.SavePlayer.Boosters(Player);
}
}
public void Update()
{
var boostedAttributes = new List<BoosterUpdateModule>();
if (Boosters.ContainsKey((short)BoostedAttributeType.DAMAGE) && Boosters[(short)BoostedAttributeType.DAMAGE].Count >= 1)
boostedAttributes.Add(new BoosterUpdateModule(new BoostedAttributeTypeModule(BoostedAttributeTypeModule.DAMAGE), GetPercentage(BoostedAttributeType.DAMAGE), Boosters[(short)BoostedAttributeType.DAMAGE].Select(x => new BoosterTypeModule(x.Type)).ToList()));
if (Boosters.ContainsKey((short)BoostedAttributeType.SHIELD) && Boosters[(short)BoostedAttributeType.SHIELD].Count >= 1)
boostedAttributes.Add(new BoosterUpdateModule(new BoostedAttributeTypeModule(BoostedAttributeTypeModule.SHIELD), GetPercentage(BoostedAttributeType.SHIELD), Boosters[(short)BoostedAttributeType.SHIELD].Select(x => new BoosterTypeModule(x.Type)).ToList()));
if (Boosters.ContainsKey((short)BoostedAttributeType.MAXHP) && Boosters[(short)BoostedAttributeType.MAXHP].Count >= 1)
boostedAttributes.Add(new BoosterUpdateModule(new BoostedAttributeTypeModule(BoostedAttributeTypeModule.MAXHP), GetPercentage(BoostedAttributeType.MAXHP), Boosters[(short)BoostedAttributeType.MAXHP].Select(x => new BoosterTypeModule(x.Type)).ToList()));
if (Boosters.ContainsKey((short)BoostedAttributeType.REPAIR) && Boosters[(short)BoostedAttributeType.REPAIR].Count >= 1)
boostedAttributes.Add(new BoosterUpdateModule(new BoostedAttributeTypeModule(BoostedAttributeTypeModule.REPAIR), GetPercentage(BoostedAttributeType.REPAIR), Boosters[(short)BoostedAttributeType.REPAIR].Select(x => new BoosterTypeModule(x.Type)).ToList()));
if (Boosters.ContainsKey((short)BoostedAttributeType.HONOUR) && Boosters[(short)BoostedAttributeType.HONOUR].Count >= 1)
boostedAttributes.Add(new BoosterUpdateModule(new BoostedAttributeTypeModule(BoostedAttributeTypeModule.HONOUR), GetPercentage(BoostedAttributeType.HONOUR), Boosters[(short)BoostedAttributeType.HONOUR].Select(x => new BoosterTypeModule(x.Type)).ToList()));
if (Boosters.ContainsKey((short)BoostedAttributeType.EP) && Boosters[(short)BoostedAttributeType.EP].Count >= 1)
boostedAttributes.Add(new BoosterUpdateModule(new BoostedAttributeTypeModule(BoostedAttributeTypeModule.EP), GetPercentage(BoostedAttributeType.EP), Boosters[(short)BoostedAttributeType.EP].Select(x => new BoosterTypeModule(x.Type)).ToList()));
Player.SendCommand(AttributeBoosterUpdateCommand.write(boostedAttributes));
Player.SendCommand(AttributeHitpointUpdateCommand.write(Player.CurrentHitPoints, Player.MaxHitPoints, Player.CurrentNanoHull, Player.MaxNanoHull));
Player.SendCommand(AttributeShieldUpdateCommand.write(Player.CurrentShieldPoints, Player.MaxShieldPoints));
//TODO dont need every time
Player.SettingsManager.SendMenuBarsCommand();
}
public int GetPercentage(BoostedAttributeType boostedAttributeType)
{
var percentage = 0;
if (Boosters.ContainsKey((short)boostedAttributeType))
foreach (var booster in Boosters[(short)boostedAttributeType])
percentage += GetBoosterPercentage(booster.Type);
return percentage;
}
private short GetBoosterType(short boosterType)
{
short boostedAttributeType = 0;
switch (boosterType)
{
case BoosterTypeModule.DMG_B01:
case BoosterTypeModule.DMG_B02:
boostedAttributeType = (short)BoostedAttributeType.DAMAGE;
break;
case BoosterTypeModule.SHD_B01:
case BoosterTypeModule.SHD_B02:
boostedAttributeType = (short)BoostedAttributeType.SHIELD;
break;
case BoosterTypeModule.HP_B01:
case BoosterTypeModule.HP_B02:
boostedAttributeType = (short)BoostedAttributeType.MAXHP;
break;
case BoosterTypeModule.REP_B01:
case BoosterTypeModule.REP_B02:
case BoosterTypeModule.REP_S01:
boostedAttributeType = (short)BoostedAttributeType.REPAIR;
break;
case BoosterTypeModule.HON_B01:
case BoosterTypeModule.HON_B02:
case BoosterTypeModule.HON50:
boostedAttributeType = (short)BoostedAttributeType.HONOUR;
break;
case BoosterTypeModule.EP_B01:
case BoosterTypeModule.EP_B02:
case BoosterTypeModule.EP50:
boostedAttributeType = (short)BoostedAttributeType.EP;
break;
}
return boostedAttributeType;
}
private int GetBoosterPercentage(short boosterTypeModule)
{
var percentage = 0;
switch (boosterTypeModule)
{
case BoosterTypeModule.DMG_B01:
case BoosterTypeModule.DMG_B02:
case BoosterTypeModule.HP_B01:
case BoosterTypeModule.HP_B02:
case BoosterTypeModule.REP_B01:
case BoosterTypeModule.REP_B02:
case BoosterTypeModule.REP_S01:
case BoosterTypeModule.HON_B01:
case BoosterTypeModule.HON_B02:
case BoosterTypeModule.EP_B01:
case BoosterTypeModule.EP_B02:
percentage = 10;
break;
case BoosterTypeModule.SHD_B01:
case BoosterTypeModule.SHD_B02:
percentage = 25;
break;
case BoosterTypeModule.HON50:
case BoosterTypeModule.EP50:
percentage = 50;
break;
}
return percentage;
}
}
}
|
|
|
09/17/2020, 15:04
|
#14
|
elite*gold: 0
Join Date: Mar 2020
Posts: 24
Received Thanks: 2
|
go to phpMyadmin -> server database -> Player_equipment -> boosters table
Copy this into PhpMyadmin---->{"2":[{"Type":1,"Seconds":3600}]}
the problem with parentheses is the emulator is not able to define the parentheses
|
|
|
09/17/2020, 15:30
|
#15
|
elite*gold: 0
Join Date: Feb 2018
Posts: 21
Received Thanks: 0
|
This is working.but i buy booster in shop and i donīt go to spacemap.
friends, I found out that I had the endings set "" and you don't have to be there because the beginning must be {and I had "" so that's why it didn't work, but thank you for your help.
so I figured it out when I took it off so I can't get the page
I have this code
Code:
[
'id' => 22,
'shipId' => '{"2":[{"Type":1,"Seconds":36000}]}',
'category' => 'boosters',
'description'=> '(10 HOURS PLAYING )',
'name' => 'DMG 10%',
'price' => 2500000,
'priceType' => 'uridium',
'amount' => false,
'image' => 'do_img/global/items/booster_dmg-b02_100x100.png',
'active' => true
]
and i have a question. How to remove from the player's mini map to 4-4?
|
|
|
 |
|
Similar Threads
|
[Buying] [HIRING BOOSTERS] for RankedBoosters, Boosters and Junior Boosters
09/13/2019 - League of Legends Trading - 0 Replies
Hiring new Boosters for our Eloboosting website https://www.rankedboosters.com.
All Regions.
You will be tested on a smurf account, and will need to provide your main account as proof with screen share. Otherwise DO NOT apply.
Open positions:
Normal Boosters (Must be Diamond 1+)
Junior Boosters (Must be DIamond 3+)
|
[Selling] Boosters Club | ELO Boosting by Diamonds boosters
04/21/2014 - League of Legends Trading - 214 Replies
NEW PRICES !!! ADD to ASK ! SO CHEAP http://imageshack.us/a/img19/4007/j3tg.jpg
VOUCHES
|
Offering CMS based website for division boosters/team boosters/ref sellers
02/19/2013 - League of Legends Trading - 1 Replies
Ok so i will be offering CMS based website with also with the ability to run it and set everything for you.Here you can see one of the example page:
http://www.zaslike.com/files/pezu1z7dqlndr1teup4x .jpg
Example of pages:
http://www.zaslike.com/files/04e5b38lxcng1qcrfq5t .jpg
http://www.zaslike.com/files/o8u6h3dm8vs1ge6lzu.j pg
Send me a pm if you are interested so you can ask me for skype for more details.
|
ALERT = NOT WORKING EDITED Barny - Wallhack NOT Working
12/05/2009 - Soldier Front Hacks, Bots, Cheats & Exploits - 4 Replies
please closed the thread below of this thread...
threading that edited barny is working hack,....
its an spam!!!!!
|
All times are GMT +1. The time now is 06:28.
|
|