Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random map in 1vs1 #36

Open
RocoWayne opened this issue Feb 10, 2016 · 30 comments
Open

Random map in 1vs1 #36

RocoWayne opened this issue Feb 10, 2016 · 30 comments

Comments

@RocoWayne
Copy link

Create a system with random map so the users dont fight every time in the fist map that you add. I think that is a simple feature

@robske110
Copy link
Contributor

I do have that on my server! (You can test it on robskebueba.no-ip.biz:3114)

@robske110
Copy link
Contributor

But as @Minifixio doesn't accept PRs i can't help you

@RocoWayne
Copy link
Author

can you share your phar maybe?

@robske110
Copy link
Contributor

I can compile it for you

@RocoWayne
Copy link
Author

oh, that will be great :D

@XiangZhao969
Copy link

can you share it @robske110

@Landy005
Copy link

Landy005 commented Mar 3, 2016

@robske110 Would you be able to show me the changes you made? (show commit)

Thanks

@robske110
Copy link
Contributor

Ok, here it is:
<Searching...>

@robske110
Copy link
Contributor

    private function launchNewRounds(){

        // Check that there is at least 2 players in the queue
        if(count($this->queue) < 2){
            Server::getInstance()->getLogger()->debug("There is not enough players to start a duel : " . count($this->queue));
            return;
        }

        // Check if there is any arena free (not active)
        Server::getInstance()->getLogger()->debug("Check ".  count($this->arenas) . " arenas");

        $freeArena = NULL;
        $freeArenaCount = 0;
        foreach ($this->arenas as $arena){
            if(!$arena->active){
                $freeArenaCount++;
                $freeArena[$freeArenaCount] = $arena;
            }
        }

        if($freeArena == NULL){
            Server::getInstance()->getLogger()->debug("[1vs1] - No free arena found");
            return;
        }

        //Randomize
        $freeArenas = count($freeArena);
        var_dump($freeArenas);
        $finalArena = mt_rand(1, $freeArenas);
        var_dump($finalArena);
        $freeArenafinal = $freeArena[$finalArena];

        // Send the players into the arena (and remove them from queues)
        $roundPlayers = array();
        array_push($roundPlayers, array_shift($this->queue), array_shift($this->queue));
        Server::getInstance()->getLogger()->debug("[1vs1] - Starting duel : " . $roundPlayers[0]->getName() . " vs " . $roundPlayers[1]->getName());
        $freeArenafinal->startRound($roundPlayers);
    }

@robske110
Copy link
Contributor

Just replace the function launchNewRounds with this in Arena Manager

@Landy005
Copy link

Landy005 commented Mar 3, 2016

ily

@robske110
Copy link
Contributor

What?

@Landy005
Copy link

Landy005 commented Mar 3, 2016

'i love you' :p and how do you edit the amount of blocks that you spawn from each other? 5 isn't really enough.

@robske110
Copy link
Contributor

Somewhere is an constant
It is quite obvious search it lol

@robske110
Copy link
Contributor

In arena.php there is player_offset...

@Landy005
Copy link

Landy005 commented Mar 3, 2016

i changed that, gave me an error lol rip

@Landy005
Copy link

Landy005 commented Mar 3, 2016

const PLAYER_1_OFFSET_X = 5;
const PLAYER_2_OFFSET_X = -5;

gives error if i took it for 30 and idk why cus it's normally possible

@ghost
Copy link

ghost commented Mar 4, 2016

Robske. Can you upload yout code ffor random map.

@ghost
Copy link

ghost commented Mar 4, 2016

Ive got it

@XiangZhao969
Copy link

Can anyone share the phar with random arena? I tried robske's but it crashed

@robske110
Copy link
Contributor

You cannot use the github version, its broken

@XiangZhao969
Copy link

Can you share the working phar? I used your code above and it crashed too

@robske110
Copy link
Contributor

I do not have an phar

@robske110
Copy link
Contributor

Wait, I'll make an fork (stay tuned, could take some time)

@XiangZhao969
Copy link

Nice

@Landy005
Copy link

Landy005 commented Mar 6, 2016

i have a version with all the changes of the other guys who forked + with mine, youreturn in creative mode though :P fork mine and make a phar out of it here: http://pmt.mcpe.me/ but i haven't tested if it works but i hope it does :D

@XiangZhao969
Copy link

@robske110

@robske110
Copy link
Contributor

What

@ghost
Copy link

ghost commented Mar 22, 2016

Any news in TeamVsTeam ?

@Landy005
Copy link

^ :D also adding points for economic? killrate doest work for some reason while this plugin is running a match..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants