refactor by opentibia server