|
You last visited: Today at 13:46
Advertisement
Lucky Box
Discussion on Lucky Box within the SRO Private Server forum part of the Silkroad Online category.
02/15/2019, 23:41
|
#1
|
elite*gold: 0
Join Date: Mar 2012
Posts: 677
Received Thanks: 29
|
Lucky Box
Hello
i want to make a lucky box
but as this% chance
sample: Lucky Box
I want 50% successful 50% fail when pressed
will not give anything when it fails
|
|
|
02/16/2019, 00:45
|
#2
|
elite*gold: 0
Join Date: Aug 2017
Posts: 121
Received Thanks: 9
|
Channel discord
|
|
|
02/16/2019, 02:00
|
#3
|
elite*gold: 100
Join Date: Sep 2017
Posts: 1,097
Received Thanks: 889
|
Ain't hard to implement as an SQL side only.
Code:
declare $LinesCC int = (select count(*) from $MainTable where ScrollObjID = $ItemRefID)
if ($LinesCC > 0)
begin
declare $idx int = 1
declare $LuckTable table (ItemCode varchar(128), ItemCount int, ItemOptLevel int)
while ($idx <= $LinesCC)
begin
declare $Ratio int = 0
select $Ratio = Ratio from $MainTable where ScrollObjID = $ItemRefID and ID = $idx
if ($Ratio > 0)
begin
INSERT INTO $LuckTable
select MT.ItemCode, MT.ItemCount, MT.ItemOptLevel from $MainTable MT cross join
(select top 100 ROW_NUMBER() over(order by (select 1)) from sys.columns ) D(n) --Max ratio: 100
where ScrollObjID = $ItemRefID and ID = $idx and D.n <= MT.Ratio;
end
set $idx = $idx + 1
end
if ((select count(*) from $LuckTable) > 0)
begin
declare $RandomItemCode varchar(128), $RandomItemCount int, $RandomItemOptLevel int
select TOP 1 $RandomItemCode = LT.ItemCode, $RandomItemCount = LT.ItemCount, $RandomItemOptLevel = LT.ItemOptLevel from $LuckTable LT order by NEWID();
-- reward
end
end
While:
Code:
$MainTable table (ID int IDENTITY(1,1) NOT NULL, ScrollObjID int, ItemCode varchar(128), ItemCount int, ItemOptLevel int, Ratio int)
Hope Microsoft won't come to complain about my code, I am not an SQL coder, I am just giving this guy a hint to implement that thing.
|
|
|
02/16/2019, 07:52
|
#4
|
elite*gold: 0
Join Date: Mar 2012
Posts: 677
Received Thanks: 29
|
Thank you
I tried but still 100%
I want to fail or successful
will give nothing if it fails
Sample :
Box open > Items in premium > successful
10% chance premium give after using
Box open > Items in premium > fail
Box disappears and nothing gets lost
declare @ CC int = (select count(*) from _Box_Items where ScrollObjID = @ RefID)
if @ CC > 0)
begin
declare @ int = 1 declare @ able table (ItemID varchar(128), ItemCount int, ItemOptLevel int)
while @ <= @ CC)
begin
declare @ real = 0.001 select @ = Ratio from _Box_Items where ScrollObjID = @ RefID and ID = @
/*if @ > 0)
begin
INSERT INTO _Box_Items
select MT.ItemCode, MT.ItemCount, MT.ItemOptLevel from _Box_Items MT cross join
(select top 100 ROW_NUMBER() over(order by (select 1)) from sys.columns ) D(n) --Max ratio: 100
where ScrollObjID = @ RefID and ID = @ and D.n <= MT.Ratio;
end*/
set @ = @ + 1
end
if ((select count(*) from _Box_Items) > 0)
begin
declare @ ID int, @ Count int, @ mOptLevel int select TOP 1 @ ID = LT.ItemID, @ Count = LT.ItemCount, @ mOptLevel = LT.ItemOptLevel from _Box_Items LT order by NEWID();
-- reward
EXEC SRO_VT_SHARD.dbo._RoyalAddEquipment @ D @ ID @ Count,'0'
end
end
|
|
|
02/16/2019, 10:41
|
#5
|
elite*gold: 100
Join Date: Sep 2017
Posts: 1,097
Received Thanks: 889
|
Just think about it, put an item at your main table with a code like a fail code, item code example: "Failed", so this part will be like:
Code:
if ((select count(*) from $LuckTable) > 0)
begin
declare $RandomItemCode varchar(128), $RandomItemCount int, $RandomItemOptLevel int
select TOP 1 $RandomItemCode = LT.ItemCode, $RandomItemCount = LT.ItemCount, $RandomItemOptLevel = LT.ItemOptLevel from $LuckTable LT where LT.ItemCode not in ('Failed') order by NEWID();
-- reward
end
Also, you can make a condition to check if the random item is an actual item in your database.
|
|
|
02/17/2019, 03:57
|
#6
|
elite*gold: 0
Join Date: Mar 2012
Posts: 677
Received Thanks: 29
|
Thank you all for <3
|
|
|
|
Similar Threads
|
[Request] Hack for lucky streak/ lucky mode
03/27/2011 - Perfect World - 3 Replies
Is it possible to hack pwi, and give your self a lucky streak?
To get it the hard way you have to find Duke Blacke, keep talking to him until he tells u a certain gem merchant is feeling lucky. You go and trade with gem merchant, and then u have a chance to get a lucky streak. Some people say that there's a 5% chance that will happen, but im not sure about the credibility.
Also the lucky streak lasts untill u log off, and it will crit all lucky packs u get and stuff. I was just thinking it...
|
[Lucky Box] Hilfe
01/13/2011 - Flyff Private Server - 0 Replies
Hey ich und nen Freund machen uns im moment just for fun nen pserver für flyff für uns beide erstmal und wollen wissen wo das gespeichert ist was in den lucky boxen gesaugt wird.Bzw wie man die chancen von den items ändern kann die man saugt
Über eine antworte wäre ich sehr erfreut euer diablo3333
|
[Request]A Lucky Box Item.
09/18/2010 - EO PServer Hosting - 7 Replies
i thought of making a Pack that Gives 1 item out of 7 with same chances, that it randomly choose it, i will be called Lucky Box,
if anyone have the idea of making it please let me know PM me if you wont make it Public.
Thank you.
|
Lucky Time HACK, for when u get lucky time
10/24/2006 - CO2 Exploits, Hacks & Tools - 6 Replies
when u go sit in guys thing given lucky time, light off firecracker to do another emotion becuse when doing it, it wont let, so lightfirecracker, then sit, when he leaves, ull still be getting lucky time
|
All times are GMT +2. The time now is 13:46.
|
|