questions

Forum > Questions > Stuff
Reply To Thread (login)
Alan [62]
2011-01-30 21:09:20
[13 years, 101 days ago]

1 - In some of your pages Ender, you have prototype.js being used twice. Like the battle page and showroom.
<script src='prototype.js'></script>
<script src='battle.js'></script>
<script src='prototype.js'></script>

Not sure if that is on purpose or not

2 - Do you have every item in one database?
Going through the showroom script, it says dagger id 1, but then quilted armor id 364. With weapons having "block":0 and shields have "mindmg": 0.
haha

3 - For the rarity formula and showing random items in the database, how do you do that?
Something like
----------
var i = 0;
while(i<50) { // show 50 items
var rand = Math.rand() * 3;
for(items) { if(rand < items["chance"]) { //show } }
}
----------

-Alan


 
Ender [26]
Administrator
2011-01-31 01:48:15
[13 years, 101 days ago]

1. Good catch Alan, thanks a lot. Before the moving sidebar was added, I only loaded the Prototype library on pages that needed it. The sidebar code is on every page now though and it uses Prototype, so when that was added, the manual loads became redundant and I forgot to remove them. This is fixed now.

2. I assume you meant table instead of database, in which case the answer is yes, all items are stored in the same table. This means it is indeed possible to have a weapon with block, a shield with damage, etc., though this should never actually happen. This representation makes it a little easier to deal with items as uniform objects in the backend. It would probably be a good idea for me to strip nonsense attributes from items before serializing them to JS in order to cut down on bandwidth, but that's a low-priority optimization.

3. There is no predetermined number of items that get stocked. The restock script that runs every 90 seconds just rolls a dice for each item and adds it to the showroom stock or not based on each item's shop chance. You could theoretically have every item in the game stocked in the showroom at once, but the probability of this event occurring is likely on par with the chance of all the oxygen in the room you're currently sitting in deciding to cluster in one corner and suffocate you (sorry to anyone who has actually lost someone this way).


 
Shadowfax [11]
2011-01-31 03:34:28
[13 years, 101 days ago]

thank you for your apologizes Ender... my mother (may her soul rest in peace) never stood a chance.


 
Intsecuris [55]
2011-01-31 12:10:09
[13 years, 101 days ago]

I create vaccum when I pass gas.


 
Alan [62]
2011-01-31 18:39:38
[13 years, 100 days ago]

Ok, so it rolls a dice, how does that work?

I just can't get my head around it.


 
Ender [26]
Administrator
2011-02-01 00:36:34
[13 years, 100 days ago]

http://php.net/lcg_value


 
Jans [40]
2011-02-01 06:10:42
[13 years, 100 days ago]

Ender installed one of these in his server
http://tinyurl.com/6fn7f7v


 
Alan [62]
2011-02-01 15:54:13
[13 years, 99 days ago]

^ Funny jans.


 
Forum > Questions > Stuff
Reply To Thread (login)