Created
November 7, 2012 20:15
-
-
Save volgar1x/4034111 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.shivas.core.config | |
import org.joda.time.Duration | |
import org.shivas.data.Containers | |
import org.shivas.data.entity.MapTemplate | |
import org.shivas.protocol.client.enums.FightTypeEnum | |
/** | |
* Created with IntelliJ IDEA. | |
* User: Blackrush | |
* Date: 07/11/12 | |
* Time: 20:49 | |
*/ | |
inline fun ConfigProvider.group(name: String, handler: Group.() -> Unit) { | |
val group = Group(this, name) | |
group.handler() | |
} | |
inline fun Group.group(name: String, handler: Group.() -> Unit) { | |
val group = group(name)!! | |
group.handler() | |
} | |
inline fun Int.seconds(): Duration = Duration.standardSeconds(toLong())!! | |
inline fun Int.minutes(): Duration = Duration.standardMinutes(toLong())!! | |
public class DefaultConfigProvider : AbstractConfigProvider() { | |
protected override fun configure() { | |
group("database") { | |
put("datasource", "jdbc:mysql://localhost/shivas") | |
put("user", "root") | |
put("password", "") | |
group("options") { | |
put("flush_delay", 30.seconds()) | |
put("save_delay", 15.minutes()) | |
put("refresh_rate", 1.minutes()) | |
} | |
} | |
group("data") { | |
put("path", "./data/") | |
put("extension", "xml") | |
} | |
group("mods") { | |
put("path", "./mods/") | |
} | |
group("commands") { | |
put("enabled", true) | |
put("prefix", "!") | |
} | |
group("login") { | |
put("port", 5555) | |
} | |
group("game") { | |
put("id", 1) | |
put("address", "127.0.0.1") | |
put("port", 5556) | |
} | |
group("world") { | |
put("client_version", "1.29.1") | |
put("motd", "Welcome on Shivas DEVMOD") | |
put("max_players_per_account", 5) | |
put("delete_answer_level_needed", 10) | |
put("add_all_waypoints", true) | |
put("npc_buy_coefficient", 10) | |
group("start") { | |
put("size", 100) | |
put("level", 200) | |
put("kamas", 1000000) | |
put("map", 7411) | |
put("cell", 255) | |
group("stats") { | |
put("action_points", 12) | |
put("movement_points", 6) | |
put("vitality", 101) | |
put("wisdom", 50) | |
put("strength", 101) | |
put("intelligence", 101) | |
put("chance", 101) | |
put("agility", 101) | |
} | |
} | |
} | |
group("loggers") { | |
group("info") { | |
put("name", "Informations") | |
put("color", "#vert") | |
} | |
group("error") { | |
put("name", "Erreur") | |
put("color", "#rouge") | |
} | |
group("warn") { | |
put("name", "Avertissement") | |
put("color", "#orange") | |
} | |
} | |
group("fights") { | |
put("workers", 2) | |
put("turn_duration", { (fightType: FightTypeEnum) -> | |
when(fightType) { | |
FightTypeEnum.AGRESSION -> 51.seconds() | |
FightTypeEnum.DUEL -> 46.seconds() | |
else -> 31.seconds() | |
} | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment