Giter Club home page Giter Club logo

ultimaphp's Introduction

Build Status

UltimaPHP - Ultima Online OpenSource Server

UltimaPHP is a modern Ultima Online server written in PHP 7.0.

This server was created for those who ever wanted to create different adaptations on the core of your shard.

I decided to build this project for study propose I've re-scripted the entire socket server to understand how it works and after that i decided to create a lightweight standalone version of the server that runs in any OS easily.

Note: The server only works with the last updated Ultima Online client (7.0.74.28) and we will not spend time with older clients for now.

How to install?

First of all, you will need to install PHP 7.0 or greater and MongoDB 3.4+, I recommend you to use PHP 7.1 it's ultra-fast and lightweight, for that:

After installing PHP and MongoDB on the machine, edit the file ultimaphp.ini as you wish, create a MongoDB database named "ultimaphp" (or anyone, just need to change at the ultimaphp.ini) and create/import all collections from tools/Mongo Database/*.json (file name is the collection name) and follow the next steps to start the server:

Note 1: You can use some program to visualize and work with MongoDB like: RoboMongo or MongoChef

Note 2: The default owner account/password in the database is: test/test

Note 3: The default player account/password in the database is: test2/test

Note 4: Passwords is always stored in MD5 encryption both in the database and in server variables

Note 5: UltimaPHP only works (till now) with no-encrypted clients.

Linux

  • Open the terminal and navigate to the root folder of UltimaPHP project
  • Type: php7.0 startserver.php

Mac

  • Docker Stack is coming :)

Windows

  • Open the run dialog (SUPER+R) and type cmd then run
  • Navigate to PHP installation folder cd c:\php\installation\folder\
  • And start the server php.exe c:\ultimaphp\instalation\folder\startserver.php

Docker

  • With docker and docker-compose installed, clone that repository and run docker-compose up.
  • This will bring up uphp and mongo container.
  • 😄

Base PHP compilation

For those, like me, who preffer to use an most performatic standalone PHP, with only what it really needs

./configure --prefix=/usr --with-config-file-path=/etc --enable-sockets --enable-bcmath --enable-mbstring --enable-zip --enable-pcntl --enable-ftp --enable-exif --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-mcrypt --with-iconv --with-zlib-dir=/usr --with-xpm-dir=/usr --with-openssl --with-gettext=/usr --with-zlib=/usr --with-bz2=/usr
make
make install

What is already working?

  • Classic client
  • 3D Client
  • Login
  • Create Character
  • Open Paper doll (self/other players)
  • Open status bar (self/other players/mobiles)
  • Show all names (Players/other players/mobiles)
  • Add objects
  • Add mobiles
  • Login multiple chars
  • Equip multiple objects
  • PickUp / Drag / Drop item
  • Walk / Run in any of the 6 worlds
  • Send and receive Unicode Sysmessage
  • Where Command
  • Teleport command to any world
  • Invis command
  • Change the mobile name
  • Change player name (if is GM)
  • Click on players/mobiles/objects
  • DClick on players/mobiles/objects
  • Open skills info
  • Emote
  • Talk
  • Store objects inside multiple containers
  • Save the player objects
  • Save the world objects
  • Mobile walking using pathfinding (Still need to work on it, see issues)
  • Dialogs (With Gump Studio Exporter plugin already working, tools folder)
  • Containers
  • Many other things

Useful links that could help you code

Do you feel like you could help in any way this project?

Feel free to join us and help this project grow in whatever you can! We always like to hear new ideas and feedbacks, so why don't you create an issue to tell us what can you do to help us grow?

Coding standards

  • All .php files should start with <?php and end without ?>
  • All .php files should have the comment line header
  • All class names start with an UPPERCASE character, IE: class ClassName {...}
  • All method names must start with LOWERCASE character and all next words start with an UPPERCASE character with no space, IE: goodMethodName()
  • All codes must be indented with a tab
  • All codes must be formatted in K&R style before committed, manually or using your preferred tool

Authors

  • João Escribano - Brazil
  • Maurício Nunes - Brazil
  • Youri Theodorakopoulos - Brazil
  • Fábio Henrique - Brazil
  • Gökay Gürcan - Netherlands

ultimaphp's People

Contributors

fabiohvp avatar gokaygurcan avatar joaoescribano avatar mbnunes avatar mchekin avatar youhide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ultimaphp's Issues

Player won't render back after disappears

When 2+ players are together in the same render zone and chunk, if someone begins to hide or user invisibility command the server send the "delete object" to the players around the invisible player so nobody can see'em.

But when player goes out the shadows, the server seem to don't send drawPlayer / drawChar to the players around.. so nobody can see the player.

I've tryied to speech, add item, and everything works... i've notice that this behaviour also happens when 2+ players are together in the same render zone and chunk and some players goes out (like, using teleport) and returns, nobody sees anyone... so i'ts seem to de a desert place, but people can talk (appears like a sysmessage).

Tooltips

Now that char list flags is working propertly, we can now go ahead and start working with tooltips...

Sysmessage not sending unicode

I've notice that sysmessage don't send unicode fonts.

I've tryied to use unicode packet to send the sysmessage with no success.

Enable Locked Features for old clients < 6.0.13

Since this client version the packet (0xB9) has chenged to 5 bytes, we've made the IF to send the correct information for old clients but... seems that the server runs too fast and at this time server hasn't already received or stored the client version... and sometimes it sends the wrong version of the packet.

Old Walkign packet issues

The old walk packet has been disabled as default at UltimaPHP since we couldn't figure out how to propertly calculate the correct Z point of the player.

Mobiles still have this problem when walking (saying "goto x,y,z" closer to the mobile) since the walk happens server side and we need to calculate the Z based on the mul files.

ex: https://pastebin.com/Rp4u0qdH

Working with UsbWebServer

Hi. First i'm glad to find your project. I was realy thinking about same. But i've a problem with sockets i think. Here is;

16:39:18: Starting server 16:39:18: Loading file: ultimaphp.ini 16:39:18: Loading file: core/functions.core.php 16:39:18: Loading file: core/packets.core.php 16:39:18: Loading file: core/sockets.core.php 16:39:18: Server is listening on 127.0.0.1 at port 2593 16:39:18: Loading file: class/account.class.php 16:39:18: Loading file: class/baseObject.class.php 16:39:18: Loading file: class/compression.class.php 16:39:18: Loading file: class/encrypt.class.php 16:39:18: Loading file: class/player.class.php 16:39:18: Trying to connect to the database 16:39:20 (DANGER) : Server could not connect to the database with error: SQLSTATE[HY000] [2002] Hedef makine etkin olarak reddetti�inden ba�lant� kurulamad�. 16:39:20: Stoping server

How can i fix that? Have you any idea about that? Thank you so much.

UOtiledata.mul failed

client version ; 7.0.72.0
When starting the server, i'm stuck on this error:
12:46:28 (DANGER) : Loading file C:/UOtiledata.mul failed!

i'm using windows 10 x64
Any ideas ?

Parse error: syntax error, unexpected '[' in G:\xampp\htdocs\uop\core\sockets.co

When i run it,i got the message below:
G:\xampp\php>php.exe G:\xampp\htdocs\uop\startsever.php
23:57:50: Starting server
23:57:50: Loading file: ultimaphp.ini
23:57:50: Loading file: core/functions.core.php
23:57:50: Loading file: core/packets.core.php
23:57:50: Loading file: core/sockets.core.php

Parse error: syntax error, unexpected '[' in G:\xampp\htdocs\uop\core\sockets.co
re.php on line 125

G:\xampp\php>

Login Proccess not renderizing map/char

After server send all packets to the client, the map and the character isn't rendering...

I noticed that in SpyUO the package communication ends after server send this packet:
Decompress: BF 00 06 00 08 00
Compressed: 80 CE CE 03 40

But in wireshard and SocketSniff the communication keeps receiving and sending information...

Another strange thing on this packet, is that SpyUO show it different from sent packet (im sure of this... i monitored the communication with 3 programs and only in SpyUO this packet is different...), in spyuo (that only shows decompressed packets) shows this:
BF 06 00 00 08 00

The length byte shows inverted on SpyUO...
I don't know how! i don't know why! it just happen!

Detect land tile Z when walking

We have to discover how to ensure the Z position of player... I've been doing MANY tests on this issue but... I still have no clue about how to do it...

Example:

Target:
Array
(
    [id] => 6C
    [target] => 1
    [cursor] => 2
    [type] => 0
    [serial] => 00000000
    [x] => 1366
    [y] => 1754
    [z] => 10
    [graphic] => 0
)

Land tiles at target: 
Array
(
    [type] => land
    [flags] => 0
    [unknown] => 0
    [texture] => 5
    [name] => grass
    [tile] => 5
    [position] => Array
        (
            [x] => 1366
            [y] => 1754
            [z] => 13
        )
)

As you can see here, I've used .info at the land on 1366,1754,10 at map 0 (The Z position received came from the target response directly from the client)

So.. .the target has been called from the target at Z position 10 but reading the map file we got the Z position at 13..... DAFUCK?

90% of the tests works like a charm, but when walking at cliffs, hills, stairs, deformed lands.... we got this behaviour.

I don't know if there is some rule about the texture or at the flags like if the item has some flag (like climbable, or something like I dunno) we need to subtract from the land Z point the height of the item... (but land items has no height???)

We need to figure it out soon so we can back to work at NPC AI :)

UltimaPHP sending remove object from view from distance players

I've noticed that if you create an object on ground and walk far away, as each walk request the server will send the delete 0x1D packet to each client to remove the object from players view.

We need to create a check on map.core to send only if player still "seeing" the object.

Character list packet

Seens like Huffman.class.php is finally working and the packt is allready been sent to the client (as i monitored with SocketSniff.exe) but the client list didn't show on the client.

Login proccess on older clients

It seems that Ultima Online old clients can't deal with packet lots... this way, we need to create an if/else on the socket outgoing data method to treat this and send each packet alone

Support for encrypted clients

I've found some information about encrypted clients....

http://necrotoolz.sourceforge.net/kairpacketguide/encryption.htm
https://code.google.com/p/majesticuo/wiki/LoginEncryption

But only for the first connection communication... after that, we must decrypt messages before process packets using TWOFISH algorithm (probably with PHP mcrypt) as well encrypt before sending it to the client.

TODO LIST

  • First connection decrypt algorithm
  • Client key fully list
  • Client keys detecting
  • Decrypt the packet 0xA0 and others after client select server and so...
  • Second connection decrypt using TWOFISH algorithm (0%)

----------------------- 2019 update, 4 years later
I've been working on this issue, but as far I can tell the entire socket server need to be rewritten from scratch.

The bizarre thing that I can't figure out is that UltimaPHP is able to decode the first packet 0x80 and send the server list to the client as we can see here:
image

But after that, the decrypt goes crazy and don't work at all:
image

To me, it seems that the keys or the seed of the socket changes at the second socket connection to the client and I don't find a way to figure it out.

Problema no EquipRequest

Client Version
Client version 7.0.80.0

Describe the bug
Eu estava equipado com um Axe e ao arrastar ele para o chão, ele sumiu, e quando eu criei um outro Axe e equipei, ele foi para LAYER 2 e nao para LAYER 1, quando removi o segundo axe para o chão e dei dois cliques nele, o primeiro Axe apareceu no chao aonde eu estava qndo ele sumiu ai o segundo Axe comecou a ir para Layer 1

.tele command

Need to create the mapsize validation to ensure server wont try to render player outside the map boundaries.

Implement EquipRequest and DropRequest

English
The 0x13 package has been added and collecting the data correctly, the EquipRequest functions have been created but it is blank to be implemented, the creation of the container in the player is missing.

The DropRequest function is apparently implemented, but only needs to be tested when the EquipRequest function is ready.

Portuguese
Já foram adicionados o pacote 0x13 e coletando os dados corretamente, as funções EquipRequest foi criada porém está em branco para ser implementada, falta a criação do container no player.

A função DropRequest aparentemente está implementada, falta apenas testar quando a função EquipRequest estiver pronta.

Item names

@Mutilador can u please check the logic at the items sniffer for RunUO to make item names be stored with spaces and all lowercase?

It will help us later 👍

3D Client, problem opening the paperdoll

O usuario ao abrir o char no mapa, e clicar no papedoll, o UPHP entra em looping tentando enviar o pacote 0x88, porem nada é travado no cliente. Tudo funciona menos o abrir o Paperdoll

Reading .UOP files instead of .MUL

Now that server works only with newer clients, we need to properly read this game files:

  • Tiledata (readTiledata)
  • Maps (getTerrainLand)
  • Map Dif (readMaps)
  • Statics/Staidx (getTerrainStatics)

For now the server must read an old client version folder that contains .mul files (like version 7.0.20) to work..

Detect Z position from player when moving

After we propertly learn how to read the map muls/uop files... we need to create the logic to detect the "z" position from player to store on the map and database.

Starting location doing wrong

At the character creation, the server seams to ignore the selected city... need to test all locations and fix the logic if needed!

Detect top level item from map

Now that we're reading properly all mul files, we need to check now what's the "top level" item to set the right Z position and also to make many further tests.

Prioritize env var for ini configurations

Is your feature request related to a problem? Please describe.
For docker and CI is nice feature passing configuration with env vars.

Describe the solution you'd like
Prioritize env var like MONGO_HOST before parsing it on ini file.

Mac Os

Quem usa MacOs precisa rodar igual ao linux. Mas vale lembrar para verificar a versão primeiro.
php -v
se for maior que 7.0 ok, senão

brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install php71

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.