ztizzlegaming / CSGOWinBig

Open-source Counter-Strike: Global Offensive jackpot betting website.
MIT License
174 stars 105 forks source link

[IDEA] #90

Closed Xeroner closed 8 years ago

Xeroner commented 8 years ago

i need to do canvas animation with images inside and centered border line on skinsprojekt.pl . It need to be infinited spining horizontaly. Any ideas how to do it ?

Stuffa1991 commented 8 years ago

Can you maybe explain a little more in detail or maybe make a quick sketch?

Xeroner commented 8 years ago
  1. Need to be with images based on win chanse % (When user have bigger % then there should be more images of him).
  2. Need to be infinited spining.
  3. Need to adding avatars when someone join the pot.
  4. Need to stop on winner.
Xeroner commented 8 years ago

@Stuffa1991 any idea?

Xeroner commented 8 years ago

@Stuffa1991

The will be winner animation ? @ztizzlegaming I found 2 files, meaby will help u

http://pastebin.com/pdfH4yaq http://pastebin.com/TAtayr6z

Stuffa1991 commented 8 years ago

The first one uses socket which is node.js

Only looked at it briefly, havent had time all week

I'll take a look at it tonight

Currently i just made edits to history.html

-Players in pot -Players deposited x$ -Players chances

You can see the changes here http://www.faagavekort.dk/history.php You can take the changes directly for the source or i can make a tutorial later :)

Xeroner commented 8 years ago

Realy cool dude ! :) Can you Pullrequest?

Stuffa1991 commented 8 years ago

My files are altered to .php and i use .htaccess to remove the .php on the website So a pull request wouldnt make sense :)

Xeroner commented 8 years ago

So i'm waiting for tutorial :))

Stuffa1991 commented 8 years ago
//Sorting the arrays so we dont get duplicates of the same player - To get number of actual players in the pot and not a person per item
                    var arr = [], //to collect id values 
                        collection = []; //collect unique object

                    $.each(allItems, function (index, value) {
                        if ($.inArray(value.itemSteamOwnerInfo.steamid, arr) == -1) { //check if id value not exits than add it
                            arr.push(value.itemSteamOwnerInfo.steamid);//push id value in arr
                            collection.push(value); //put object in collection to access it's all values
                        }
                    });

                    //Calculating persons in the pot
                    for (var i2 = 0; i2 < collection.length; i2++) {
                    var item = collection[i2];

                    var itemOwner = item['itemSteamOwnerInfo'];

                    var itemOwnerInfo = itemOwner['personaname'];
                    var itemOwnerAvatar = itemOwner['avatarfull'];
                    var itemOwnerId = itemOwner['steamid'];

                    var itemPlayerPrice = 0;
                        //Calculating each persons total price
                        for (var i3 = 0; i3 < allItems.length; i3++){
                            var itemPriceTotal = allItems[i3];

                            var itemOwner = itemPriceTotal['itemSteamOwnerInfo'];

                            var itemPriceTotalOwner = itemOwner['steamid'];

                            if(itemOwnerId == itemPriceTotalOwner){
                            itemPlayerPrice += parseFloat(itemPriceTotal['itemPrice']);
                            }
                        }
                    //Getting players chance
                    var itemOwnerChance = (itemPlayerPrice / potPrice * 100).toFixed(2);

                    str += '<img title="' + itemOwnerInfo + ' - ' + getFormattedPrice(itemPlayerPrice) + ' - ' + itemOwnerChance + '%" src="' + itemOwnerAvatar + '" width="60px" height="60px" class="img-rounded showTooltip">';

                    }

This is the function that calculates Total players in the pot Price put in by player - itemPlayerPrice Chance of winning - itemOwnerChance

Now do it with it what you want :) and make it your own

Xeroner commented 8 years ago

Iv'e made it :)) Closed.