diff --git a/Dockerfile b/Dockerfile index 70178f3236..070ffa17cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,4 +6,4 @@ WORKDIR /mnt COPY ./ ./ RUN sh ./posix-compile.sh EXPOSE 8484 7575 7576 7577 -CMD exec tini -- sh ./docker-launch.sh \ No newline at end of file +CMD exec tini -- sh ./posix-launch.sh \ No newline at end of file diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000000..5156641d7f --- /dev/null +++ b/config.yaml @@ -0,0 +1,458 @@ +#World Name: (0 "Scania", 1 "Bera", 2 "Broa", 3 "Windia", 4 "Khaini", 5 "Bellocan", 6 "Mardia", 7 "Kradia", 8 "Yellonde", 9 "Demethos", 10 "Galicia", 11 "El Nido", 12 "Zenith", 13 "Arcenia", 14 "Kastia", 15 "Judis", 16 "Plana", 17 "Kalluna", 18 "Stius", 19 "Croa", 20 "Medere") +#Flag types: (0 = nothing, 1 = event, 2 = new, 3 = hot) +#Recommended to use only up to 15 worlds +worlds: + #Properties for Scania 0 + - flag: 0 + server_message: Welcome to Scania! + event_message: Scania! + why_am_i_recommended: Welcome to Scania! + channels: 3 + exp_rate: 10 + meso_rate: 10 + drop_rate: 10 + boss_drop_rate: 10 #NOTE: Boss drop rate OVERRIDES common drop rate, for bosses-only. + quest_rate: 5 #Multiplier for Exp & Meso gains when completing a quest. Only available when USE_QUEST_RATE is true. Stacks with server Exp & Meso rates. + fishing_rate: 10 #Multiplier for success likelihood on meso thrown during fishing. + travel_rate: 10 #Means of transportation rides/departs using 1/N of the default time. + + #Properties for Bera 1 + - flag: 0 + server_message: Welcome to Bera! + event_message: Bera! + why_am_i_recommended: Welcome to Bera! + channels: 3 + + #Properties for Broa 2 + - flag: 0 + server_message: Welcome to Broa! + event_message: Broa! + why_am_i_recommended: Welcome to Broa! + channels: 3 + + #Properties for Windia 3 + - flag: 0 + server_message: Welcome to Windia! + event_message: Windia! + why_am_i_recommended: Welcome to Windia! + channels: 3 + + #Properties for Khaini 4 + - flag: 0 + server_message: Welcome to Khaini! + event_message: Khaini! + why_am_i_recommended: Welcome to Khaini! + channels: 3 + + #Properties for Bellocan 5 + - flag: 0 + server_message: Welcome to Bellocan! + event_message: Bellocan! + why_am_i_recommended: Welcome to Bellocan! + channels: 3 + + #Properties for Mardia 6 + - flag: 0 + server_message: Welcome to Mardia! + event_message: Mardia! + why_am_i_recommended: Welcome to Mardia! + channels: 3 + + #Properties for Kradia 7 + - flag: 0 + server_message: Welcome to Kradia! + event_message: Kradia! + why_am_i_recommended: Welcome to Kradia! + channels: 3 + + #Properties for Yellonde 8 + - flag: 0 + server_message: Welcome to Yellonde! + event_message: Yellonde! + why_am_i_recommended: Welcome to Yellonde! + channels: 3 + + #Properties for Demethos 9 + - flag: 0 + server_message: Welcome to Demethos! + event_message: Demethos! + why_am_i_recommended: Welcome to Demethos! + channels: 3 + + #Properties for Galicia 10 + - flag: 0 + server_message: Welcome to Galicia! + event_message: Galicia! + why_am_i_recommended: Welcome to Galicia! + channels: 3 + + #Properties for El Nido 11 + - flag: 0 + server_message: Welcome to El Nido! + event_message: El Nido! + why_am_i_recommended: Welcome to El Nido! + channels: 3 + + #Properties for Zenith 12 + - flag: 0 + server_message: Welcome to Zenith! + event_message: Zenith! + why_am_i_recommended: Welcome to Zenith! + channels: 3 + + #Properties for Arcenia 13 + - flag: 0 + server_message: Welcome to Arcenia! + event_message: Arcenia! + why_am_i_recommended: Welcome to Arcenia! + channels: 3 + + #Properties for Kastia 14 + - flag: 0 + server_message: Welcome to Kastia! + event_message: Kastia! + why_am_i_recommended: Welcome to Kastia! + channels: 3 + + #Properties for Judis 15 + - flag: 0 + server_message: Welcome to Judis! + event_message: Judis! + why_am_i_recommended: Welcome to Judis! + channels: 3 + + #Properties for Plana 16 + - flag: 0 + server_message: Welcome to Plana! + event_message: Plana! + why_am_i_recommended: Welcome to Plana! + channels: 3 + + #Properties for Kalluna 17 + - flag: 0 + server_message: Welcome to Kalluna! + event_message: Kalluna! + why_am_i_recommended: Welcome to Kalluna! + channels: 3 + + #Properties for Stius 18 + - flag: 0 + server_message: Welcome to Stius! + event_message: Stius! + why_am_i_recommended: Welcome to Stius! + channels: 3 + + #Properties for Croa 19 + - flag: 0 + server_message: Welcome to Croa! + event_message: Croa! + why_am_i_recommended: Welcome to Croa! + channels: 3 + + #Properties for Medere 20 + - flag: 0 + server_message: Welcome to Medere! + event_message: Medere! + why_am_i_recommended: Welcome to Medere! + channels: 3 + + +server: + #Thread Tracker Configuration + USE_THREAD_TRACKER: true #[SEVERE] This deadlock auditing thing will bloat the memory as fast as the time frame one takes to lose track of a raindrop on a tempesting day. Only for debugging purposes. + + #Database Configuration + DB_URL: "" + DB_USER: "" + DB_PASS: "" + DB_CONNECTION_POOL: true #Installs a connection pool to hub DB connections. Set false to default. + + #Login Configuration + WLDLIST_SIZE: 21 #Max possible worlds on the server. + CHANNEL_SIZE: 20 #Max possible channels per world (which is 20, based on the channel list on login phase). + CHANNEL_LOAD: 100 #Max players per channel (limit actually used to calculate the World server capacity). + CHANNEL_LOCKS: 20 #Total number of structure management locks each channel has. + + RESPAWN_INTERVAL: 10000 #10 seconds, 10000. + PURGING_INTERVAL: 300000 #5 minutes, 300000. + RANKING_INTERVAL: 3600000 #60 minutes, 3600000. + COUPON_INTERVAL: 3600000 #60 minutes, 3600000. + UPDATE_INTERVAL: 777 #Dictates the frequency on which the "centralized server time" is updated. + + ENABLE_PIC: false #Pick true/false to enable or disable Pic. Delete character requires PIC available. + ENABLE_PIN: false #Pick true/false to enable or disable Pin. + + BYPASS_PIC_EXPIRATION: 20 #Enables PIC bypass, which will remain active for that account by that client machine for N minutes. Set 0 to disable. + BYPASS_PIN_EXPIRATION: 15 #Enables PIN bypass, which will remain active for that account by that client machine for N minutes. Set 0 to disable. + + AUTOMATIC_REGISTER: true #Automatically register players when they login with a nonexistent username. + BCRYPT_MIGRATION: true #Performs a migration from old SHA-1 and SHA-512 password to bcrypt. + COLLECTIVE_CHARSLOT: false #Available character slots are contabilized globally rather than per world server. + DETERRED_MULTICLIENT: false #Enables detection of multi-client and suspicious remote IP on the login system. + #Besides blocking logging in with several client sessions on the same machine, this also blocks suspicious login attempts for players that tries to login on an account using several diferent remote addresses. + + #Multiclient Coordinator Configuration + MAX_ALLOWED_ACCOUNT_HWID: 4 #Allows up to N concurrent HWID's for an account. HWID's remains linked to an account longer the more times it's used to login. + MAX_ACCOUNT_LOGIN_ATTEMPT: 15 #After N tries on an account, login on that account gets disabled for a short period. + LOGIN_ATTEMPT_DURATION: 120 #Period in seconds the login attempt remains registered on the system. + + #Ip Configuration + HOST: 127.0.0.1 + LOCALSERVER: true + GMSERVER: false + + #Other configuration + SHUTDOWNHOOK: true + + #Server Flags + USE_CUSTOM_KEYSET: true #Enables auto-setup of the HeavenMS's custom keybindings when creating characters. + USE_DEBUG: false #Will enable some text prints on the client, oriented for debugging purposes. + USE_DEBUG_SHOW_INFO_EQPEXP: false #Prints on the cmd all equip exp gain info. + USE_DEBUG_SHOW_RCVD_PACKET: false #Prints on the cmd all received packet ids. + USE_DEBUG_SHOW_RCVD_MVLIFE: false #Prints on the cmd all received move life content. + USE_DEBUG_SHOW_PACKET: false + USE_SUPPLY_RATE_COUPONS: true #Allows rate coupons to be sold through the Cash Shop. + USE_IP_VALIDATION: true #Enables IP checking when logging in. + + USE_MAXRANGE: true #Will send and receive packets from all events on a map, rather than those of only view range. + USE_MAXRANGE_ECHO_OF_HERO: true + USE_MTS: false + USE_CPQ: true #Renders the CPQ available or not. + USE_AUTOHIDE_GM: false #When enabled, GMs are automatically hidden when joining. Thanks to Steven Deblois (steven1152). + USE_BUYBACK_SYSTEM: true #Enables the HeavenMS-builtin buyback system, to be used by dead players when clicking the MTS button. + USE_FIXED_RATIO_HPMP_UPDATE: true #Enables the HeavenMS-builtin HPMP update based on the current pool to max pool ratio. + USE_FAMILY_SYSTEM: true + USE_DUEY: true + USE_RANDOMIZE_HPMP_GAIN: true #Enables randomizing on MaxHP/MaxMP gains and INT accounting for the MaxMP gain on level up. + USE_STORAGE_ITEM_SORT: true #Enables storage "Arrange Items" feature. + USE_ITEM_SORT: true #Enables inventory "Item Sort/Merge" feature. + USE_ITEM_SORT_BY_NAME: false #Item sorting based on name rather than id. + USE_PARTY_FOR_STARTERS: true #Players level 10 or below can create/invite other players on the given level range. + USE_AUTOASSIGN_STARTERS_AP: false #Beginners level 10 or below have their AP autoassigned (they can't choose to levelup a stat). Set true ONLY if the localhost doesn't support AP assigning for beginners level 10 or below. + USE_AUTOASSIGN_SECONDARY_CAP: true #Prevents AP autoassign from spending on secondary stats after the player class' cap (defined on the autoassign handler) has been reached. + USE_STARTING_AP_4: true #Use early-GMS 4/4/4/4 starting stats. To overcome AP shortage, this gives 4AP/5AP at 1st/2nd job advancements. + USE_AUTOBAN: false #Commands the server to detect infractors automatically. + USE_AUTOBAN_LOG: true #Log autoban related messages. Still logs even with USE_AUTOBAN disabled. + USE_AUTOSAVE: true #Enables server autosaving feature (saves characters to DB each 1 hour). + USE_SERVER_AUTOASSIGNER: true #HeavenMS-builtin autoassigner, uses algorithm based on distributing AP accordingly with required secondary stat on equipments. + USE_REFRESH_RANK_MOVE: true + USE_ENFORCE_ADMIN_ACCOUNT: false #Forces accounts having GM characters to be treated as a "GM account" by the client (localhost). Some of the GM account perks is the ability to FLY, but unable to TRADE. + USE_ENFORCE_NOVICE_EXPRATE: false #Hardsets experience rate 1x for beginners level 10 or under. Ideal for roaming on novice areas without caring too much about losing some stats. + USE_ENFORCE_HPMP_SWAP: false #Forces players to reuse stats (via AP Resetting) located on HP/MP pool only inside the HP/MP stats. + USE_ENFORCE_MOB_LEVEL_RANGE: true #Players N levels below the killed mob will gain no experience from defeating it. + USE_ENFORCE_JOB_LEVEL_RANGE: false #Caps the player level on the minimum required to advance their current jobs. + USE_ENFORCE_JOB_SP_RANGE: false #Caps the player SP level on the total obtainable by their current jobs. After changing jobs, missing SP will be retrieved. + USE_ENFORCE_ITEM_SUGGESTION: false #Forces the Owl of Minerva and the Cash Shop to always display the defined item array instead of those featured by the players. + USE_ENFORCE_UNMERCHABLE_CASH: true #Forces players to not sell CASH items via merchants, drops of it disappears. + USE_ENFORCE_UNMERCHABLE_PET: true #Forces players to not sell pets via merchants, drops of it disappears. (since non-named pets gets dirty name and other possible DB-related issues) + USE_ENFORCE_MERCHANT_SAVE: true #Forces automatic DB save on merchant owners, at every item movement on shop. + USE_ENFORCE_MDOOR_POSITION: false #Forces mystic door to be spawned near spawnpoints. + USE_SPAWN_CLEAN_MDOOR: false #Makes mystic doors to be spawned without deploy animation. This clears disconnecting issues that may happen when trying to cancel doors a couple seconds after deployment. + USE_SPAWN_LOOT_ON_ANIMATION: false #Makes loot appear some time after the mob has been killed (following the mob death animation, instead of instantly). + USE_SPAWN_RELEVANT_LOOT: true #Forces to only spawn loots that are collectable by the player or any of their party members. + USE_ERASE_PERMIT_ON_OPENSHOP: true #Forces "shop permit" item to be consumed when player deploy his/her player shop. + USE_ERASE_UNTRADEABLE_DROP: true #Forces flagged untradeable items to disappear when dropped. + USE_ERASE_PET_ON_EXPIRATION: false #Forces pets to be removed from inventory when expire time comes, rather than converting it to a doll. + USE_BUFF_MOST_SIGNIFICANT: true #When applying buffs, the player will stick with the highest stat boost among the listed, rather than overwriting stats. + USE_BUFF_EVERLASTING: false #Every applied buff on players holds expiration time so high it'd be considered permanent. Suggestion thanks to Vcoc. + USE_MULTIPLE_SAME_EQUIP_DROP: true #Enables multiple drops by mobs of the same equipment, number of possible drops based on the quantities provided at the drop data. + USE_BANISHABLE_TOWN_SCROLL: true #Enables town scrolls to act as if it's a "player banish", rendering the antibanish scroll effect available. + USE_ENABLE_FULL_RESPAWN: true #At respawn task, always respawn missing mobs when they're available. Spawn count doesn't depend on how many players are currently there. + USE_ENABLE_CHAT_LOG: false #Write in-game chat to log + USE_REBIRTH_SYSTEM: false #Flag to enable/disable rebirth system + USE_MAP_OWNERSHIP_SYSTEM: true #Flag to enable/disable map ownership system + USE_FISHING_SYSTEM: true #Flag to enable/disable custom fishing system + USE_NPCS_SCRIPTABLE: true #Flag to enable/disable serverside predefined script NPCs. + + #Events/PQs Configuration + USE_OLD_GMS_STYLED_PQ_NPCS: true #Enables PQ NPCs with similar behaviour to old GMS style, that skips info about the PQs and immediately tries to register the party in. + USE_ENABLE_SOLO_EXPEDITIONS: true #Enables start expeditions with any number of players. This will also bypass all the Zakum prequest. + USE_ENABLE_DAILY_EXPEDITIONS: false #Enables daily entry limitations in expeditions. + USE_ENABLE_RECALL_EVENT: false #Enables a disconnected player to reaccess the last event instance they were in before logging out. Recall only works if the event isn't cleared or disposed yet. Suggestion thanks to Alisson (Goukken). + + #Announcement Configuration + USE_ANNOUNCE_SHOPITEMSOLD: false #Automatic message sent to owner when an item from the Player Shop or Hired Merchant is sold. + USE_ANNOUNCE_CHANGEJOB: false #Automatic message sent to acquantainces when changing jobs. + + #Cash Shop Configuration + USE_JOINT_CASHSHOP_INVENTORY: true #Enables usage of a same cash shop inventory for explorers, cygnus and legends. Items from exclusive cash shop inventories won't show up on the shared inventory, though. + USE_CLEAR_OUTDATED_COUPONS: true #Enables deletion of older code coupon registry from the DB, freeing so-long irrelevant data. + ALLOW_CASHSHOP_NAME_CHANGE: true #Allows players to buy name changes in the cash shop. + ALLOW_CASHSHOP_WORLD_TRANSFER: true #Allows players to buy world transfers in the cash shop. + + #Maker Configuration + USE_MAKER_PERMISSIVE_ATKUP: true #Allows players to use attack-based strengthening gems on non-weapon items. + USE_MAKER_FEE_HEURISTICS: true #Apply compiled values for stimulants and reagents into the Maker fee calculations (max error revolves around 50k mesos). Set false to use basic constant values instead (results are never higher than requested by the client-side). + + #Custom Configuration + USE_ENABLE_CUSTOM_NPC_SCRIPT: true #Enables usage of custom HeavenMS NPC scripts (Agent E, Coco, etc). Will not disable Abdula (it's actually useful for the gameplay) or quests. + USE_STARTER_MERGE: false #Allows any players to use the Equipment Merge custom mechanic (as opposed to the high-level, Maker lv3 requisites). + + #Commands Configuration + BLOCK_GENERATE_CASH_ITEM: false #Prevents creation of cash items with the item/drop command. + USE_WHOLE_SERVER_RANKING: false #Enables a ranking pool made from every character registered on the server for the "ranks" command, instead of separated by worlds. + + EQUIP_EXP_RATE: 1.0 #Rate for equipment exp gain, grows linearly. Set 1.0 for default (about 100~200 same-level range mobs killed to pass equip from level 1 to 2). + PQ_BONUS_EXP_RATE: 0.5 #Rate for the PQ exp reward. + + EXP_SPLIT_LEVEL_INTERVAL: 5 #Non-contributing players must be within N level between the mob to receive EXP. + EXP_SPLIT_LEECH_INTERVAL: 5 #Non-contributing players must be within N level between any contributing party member to receive EXP. + EXP_SPLIT_MVP_MOD: 0.2 + EXP_SPLIT_COMMON_MOD: 0.8 + PARTY_BONUS_EXP_RATE: 1.0 #Rate for the party exp bonus reward. + + #Miscellaneous Configuration + TIMEZONE: GMT-3 + USE_DISPLAY_NUMBERS_WITH_COMMA: true #Enforce comma on displayed strings (use this when USE_UNITPRICE_WITH_COMMA is active and you still want to display comma-separated values). + USE_UNITPRICE_WITH_COMMA: true #Set this accordingly with the layout of the unitPrices on Item.wz XML's, whether it's using commas or dots to represent fractions. + MAX_MONITORED_BUFFSTATS: 5 #Limits accounting for "dormant" buff effects, that should take place when stronger stat buffs expires. + MAX_AP: 32767 #Max AP allotted on the auto-assigner. + MAX_EVENT_LEVELS: 8 #Event has different levels of rewarding system. + BLOCK_NPC_RACE_CONDT: 500 # (0.5 * 1000) Time the player client must wait before reopening a conversation with an NPC. + PET_LOOT_UPON_ATTACK: 700 # (0.7 * 1000) Time the pet must wait before trying to pick items up. + TOT_MOB_QUEST_REQUIREMENT: 77 #Overwrites old 999-mobs requirement for the ToT questline with new requirement value, set 0 for default. + MOB_REACTOR_REFRESH_TIME: 30000 # (30 * 1000) Overwrites refresh time for those reactors oriented to inflict damage to bosses (Ice Queen, Riche), set 0 for default. + PARTY_SEARCH_REENTRY_LIMIT: 10 #Max amount of times a party leader is allowed to persist on the Party Search before entry expiration (thus needing to manually restart the Party Search to be able to search for members). + NAME_CHANGE_COOLDOWN: 2592000000 # (30*24*60*60*1000) Cooldown for name changes, default (GMS) is 30 days. + WORLD_TRANSFER_COOLDOWN: 2592000000 # (30*24*60*60*1000) Cooldown for world tranfers, default is same as name change (30 days). + INSTANT_NAME_CHANGE: false #Whether or not to wait for server restart to apply name changes. Does on reconnect otherwise (requires queries on every login). + + #Dangling Items/Locks Configuration + ITEM_EXPIRE_TIME: 180000 # (3 * 60 * 1000) Time before items start disappearing. Recommended to be set up to 3 minutes. + KITE_EXPIRE_TIME: 3600000 # (60 * 60 * 1000) Time before kites (cash item) disappears. + ITEM_MONITOR_TIME: 300000 # (5 * 60 * 1000) Interval between item monitoring tasks on maps, which checks for dangling (null) item objects on the map item history. + LOCK_MONITOR_TIME: 30000 # (30 * 1000) Waiting time for a lock to be released. If it reaches timeout, a critical server deadlock has made present. + + #Map Monitor Configuration + ITEM_EXPIRE_CHECK: 10000 # (10 * 10000) Interval between item expiring tasks on maps, which checks and makes disappear expired items. + ITEM_LIMIT_ON_MAP: 200 #Max number of items allowed on a map. + MAP_VISITED_SIZE: 5 #Max length for last mapids visited by a player. This is used to recover and update drops on these maps accordingly with player actions. + MAP_DAMAGE_OVERTIME_INTERVAL: 5000 #Interval in milliseconds between map environment damage (e.g. El Nath and Aqua Road surrondings). + + #Channel Mob Disease Monitor Configuration + MOB_STATUS_MONITOR_PROC: 200 #Frequency in milliseconds between each proc on the mob disease monitor schedule. + MOB_STATUS_MONITOR_LIFE: 84 #Idle proc count the mob disease monitor is allowed to be there before closing it due to inactivity. + MOB_STATUS_AGGRO_PERSISTENCE: 2 #Idle proc count on aggro update for a mob to keep following the current controller, given him/her is the leading damage dealer. + MOB_STATUS_AGGRO_INTERVAL: 5000 #Interval in milliseconds between aggro logistics update. + + #Some Gameplay Enhancing Configurations + #Scroll Configuration + USE_PERFECT_GM_SCROLL: true #Scrolls from GMs never uses up slots nor fails. + USE_PERFECT_SCROLLING: true #Scrolls doesn't use slots upon failure. + USE_ENHANCED_CHSCROLL: true #Equips even more powerful with chaos upgrade. + USE_ENHANCED_CRAFTING: true #Apply chaos scroll on every equip crafted. + USE_ENHANCED_CLNSLATE: true #Clean slates can be applied to recover successfully used slots as well. + SCROLL_CHANCE_RATE: 10 #Number of rolls for success on a scroll, set 1 for default. + CHSCROLL_STAT_RATE: 3 #Number of rolls of stat upgrade on a successfully applied chaos scroll, set 1 for default. + CHSCROLL_STAT_RANGE: 6 #Stat upgrade range (-N, N) on chaos scrolls. + + #Beginner Skills Configuration + USE_ULTRA_NIMBLE_FEET: true #Massive speed & jump upgrade. + USE_ULTRA_RECOVERY: true #Massive recovery amounts overtime. + USE_ULTRA_THREE_SNAILS: true #Massive damage on shell toss. + + #Other Skills Configuration + USE_FULL_ARAN_SKILLSET: false #Enables starter availability to all Aran job skills. Suggestion thanks to Masterrulax. + USE_FAST_REUSE_HERO_WILL: true #Greatly reduce cooldown on Hero's Will. + USE_ANTI_IMMUNITY_CRASH: true #Crash skills additionally removes the mob's invincibility buffs. Suggestion thanks to Celestial. + USE_UNDISPEL_HOLY_SHIELD: true #Holy shield buff also prevents players from suffering dispel from mobs. + USE_FULL_HOLY_SYMBOL: true #Holy symbol doesn't require EXP sharers to work in full. + + #Character Configuration + USE_ADD_SLOTS_BY_LEVEL: true #Slots are added each 20 levels. + USE_ADD_RATES_BY_LEVEL: true #Rates are added each 20 levels. + USE_STACK_COUPON_RATES: false #Multiple coupons effects builds up together. + USE_PERFECT_PITCH: true #For lvl 30 or above, each lvlup grants player 1 perfect pitch. + + #Quest Configuration + USE_QUEST_RATE: false #Exp/Meso gained by quests uses fixed server exp/meso rate times quest rate as multiplier, instead of player rates. + + #Quest Points Configuration + QUEST_POINT_REPEATABLE_INTERVAL: 24 #Minimum interval between repeatable quest completions for quest points to be awarded. + QUEST_POINT_REQUIREMENT: 16 #Exchange factor between N quest points to +1 fame, set 0 to disable the entire quest point mechanism. + QUEST_POINT_PER_QUEST_COMPLETE: 4 #Each completed quest awards N quest points, set 0 to disable. + QUEST_POINT_PER_EVENT_CLEAR: 1 #Each completed event instance awards N quest points, set 0 to disable. + + #Guild Configuration + CREATE_GUILD_MIN_PARTNERS: 6 #Minimum number of members on Guild Headquarters to establish a new guild. + CREATE_GUILD_COST: 1500000 + CHANGE_EMBLEM_COST: 5000000 + EXPAND_GUILD_BASE_COST: 500000 + EXPAND_GUILD_TIER_COST: 1000000 + EXPAND_GUILD_MAX_COST: 5000000 + + #Family Configuration + FAMILY_REP_PER_KILL: 4 #Amount of rep gained per monster kill. + FAMILY_REP_PER_BOSS_KILL: 20 #Amount of rep gained per boss kill. + FAMILY_REP_PER_LEVELUP: 200 #Amount of rep gained upon leveling up. + FAMILY_MAX_GENERATIONS: 1000 #Maximum depth of family tree. (Distance from leader to farthest junior) + + #Equipment Configuration + USE_EQUIPMNT_LVLUP_SLOTS: true #Equips can upgrade slots at level up. + USE_EQUIPMNT_LVLUP_POWER: true #Enable more powerful stat upgrades at equip level up. + USE_EQUIPMNT_LVLUP_CASH: true #Enable equip leveling up on cash equipments as well. + USE_SPIKES_AVOID_BANISH: true #Shoes equipped with spikes prevents mobs from banishing wearer. + MAX_EQUIPMNT_LVLUP_STAT_UP: 10000 #Max stat upgrade an equipment can have on a levelup. + MAX_EQUIPMNT_STAT: 32767 #Max stat on an equipment by leveling up. + USE_EQUIPMNT_LVLUP: 7 #All equips lvlup at max level of N, set 1 to disable. + + #Map-Chair Configuration + USE_CHAIR_EXTRAHEAL: true #Enable map chairs to further recover player's HP and MP (player must have the Chair Mastery skill). + CHAIR_EXTRA_HEAL_MULTIPLIER: 10 #Due to only being able to be send up-to-255 heal values, values being actually updated is the one displayed times this. + CHAIR_EXTRA_HEAL_MAX_DELAY: 21 #Players are expected to recover fully after using this skill for N seconds. + + #Player NPC Configuration + PLAYERNPC_INITIAL_X: 262 #Map frame width for putting PlayerNPCs. + PLAYERNPC_INITIAL_Y: 262 #Map frame height for putting PlayerNPCs. + PLAYERNPC_AREA_X: 320 #Initial width gap between PlayerNPCs. + PLAYERNPC_AREA_Y: 160 #Initial height gap between PlayerNPCs. + PLAYERNPC_AREA_STEPS: 4 #Max number of times gap is shortened to comport PlayerNPCs. + PLAYERNPC_ORGANIZE_AREA: true #Automatically rearranges PlayerNPCs on the map if there is no space set the new NPC. Current distance gap between NPCs is decreased to solve this issue. + PLAYERNPC_AUTODEPLOY: true #Makes PlayerNPC automatically deployed on the Hall of Fame at the instant one reaches max level. If false, eligible players must talk to 1st job instructor to deploy a NPC. + + #Pet Auto-Pot Configuration + USE_COMPULSORY_AUTOPOT: true #Pets will consume as many potions as needed to fulfill the AUTOHP/MP ratio threshold. + USE_EQUIPS_ON_AUTOPOT: true #Player MaxHP and MaxMP check values on autopot handler will be updated by the HP/MP bonuses on equipped items. + PET_AUTOHP_RATIO: 0.99 #Will automatically consume potions until given ratio of the MaxHP/MaxMP is reached. + PET_AUTOMP_RATIO: 0.99 + + #Pet & Mount Configuration + PET_EXHAUST_COUNT: 3 #Number of proc counts (1 per minute) on the exhaust schedule for fullness. + MOUNT_EXHAUST_COUNT: 1 #Number of proc counts (1 per minute) on the exhaust schedule for tiredness. + + #Pet Hunger Configuration + PETS_NEVER_HUNGRY: false #If true, pets and mounts will never grow hungry. + GM_PETS_NEVER_HUNGRY: true #If true, pets and mounts owned by GMs will never grow hungry. + + #Event Configuration + EVENT_MAX_GUILD_QUEUE: 10 #Max number of guilds in queue for GPQ. + EVENT_LOBBY_DELAY: 10 #Cooldown duration in seconds before reopening an event lobby. + + #Dojo Configuration + USE_FAST_DOJO_UPGRADE: true #Reduced Dojo training points amount required for a belt upgrade. + USE_DEADLY_DOJO: false #Should bosses really use 1HP,1MP attacks in dojo? + DOJO_ENERGY_ATK: 100 #Dojo energy gain when deal attack + DOJO_ENERGY_DMG: 20 #Dojo energy gain when recv attack + + #Wedding Configuration + WEDDING_RESERVATION_DELAY: 3 #Minimum idle slots before processing a wedding reservation. + WEDDING_RESERVATION_TIMEOUT: 10 #Limit time in minutes for the couple to show up before cancelling the wedding reservation. + WEDDING_RESERVATION_INTERVAL: 60 #Time between wedding starts in minutes. + WEDDING_BLESS_EXP: 30000 #Exp gained per bless count. + WEDDING_GIFT_LIMIT: 1 #Max number of gifts per person to same wishlist on marriage instances. + WEDDING_BLESSER_SHOWFX: true #Pops bubble sprite effect on players blessing the couple. Setting this false shows the blessing effect on the couple instead. + + #Buyback Configuration + USE_BUYBACK_WITH_MESOS: true #Enables usage of either mesos or NX for the buyback fee. + BUYBACK_FEE: 77.70 #Sets the base amount needed to buyback (level 30 or under will use the base value). + BUYBACK_LEVEL_STACK_FEE: 85.47 #Sets the level-stacking portion of the amount needed to buyback (fee will sum up linearly until level 120, when it reaches the peak). + BUYBACK_MESO_MULTIPLIER: 1000 #Sets a multiplier for the fee when using meso as the charge unit. + BUYBACK_RETURN_MINUTES: 1 #Sets the maximum amount of time the player can wait before decide to buyback. + BUYBACK_COOLDOWN_MINUTES: 7 #Sets the time the player must wait before using buyback again. + + # Login timeout by shavit + TIMEOUT_DURATION: 3600000 # Kicks clients who don't send any packet to the game server in due time (in millisseconds). + + #Event End Timestamp + EVENT_END_TIMESTAMP: 1428897600000 + diff --git a/configuration.ini b/configuration.ini deleted file mode 100644 index 9a80eeb0b9..0000000000 --- a/configuration.ini +++ /dev/null @@ -1,5 +0,0 @@ -HOST=127.0.0.1 -URL=jdbc:mysql://localhost:3306/heavenms -DB_USER=root -DB_PASS= -SHUTDOWNHOOK=true \ No newline at end of file diff --git a/cores/jackson-annotations-2.9.9.jar b/cores/jackson-annotations-2.9.9.jar new file mode 100644 index 0000000000..8e059d9711 Binary files /dev/null and b/cores/jackson-annotations-2.9.9.jar differ diff --git a/cores/jackson-core-2.9.9.jar b/cores/jackson-core-2.9.9.jar new file mode 100644 index 0000000000..02bd446ddf Binary files /dev/null and b/cores/jackson-core-2.9.9.jar differ diff --git a/cores/jackson-databind-2.9.9.3.jar b/cores/jackson-databind-2.9.9.3.jar new file mode 100644 index 0000000000..5bf4ba88d1 Binary files /dev/null and b/cores/jackson-databind-2.9.9.3.jar differ diff --git a/cores/jackson-dataformat-yaml-2.9.9.jar b/cores/jackson-dataformat-yaml-2.9.9.jar new file mode 100644 index 0000000000..36829fc6f9 Binary files /dev/null and b/cores/jackson-dataformat-yaml-2.9.9.jar differ diff --git a/cores/snakeyaml-1.25.jar b/cores/snakeyaml-1.25.jar new file mode 100644 index 0000000000..0004985059 Binary files /dev/null and b/cores/snakeyaml-1.25.jar differ diff --git a/docker-launch.sh b/docker-launch.sh deleted file mode 100644 index 654a2c088c..0000000000 --- a/docker-launch.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -sed -i "s/HOST=.*/HOST=${HOST}/" configuration.ini -sed -i "s|URL=.*|URL=${URL}|" configuration.ini -sed -i "s/DB_USER=.*/DB_USER=${DB_USER}/" configuration.ini -sed -i "s/DB_PASS=.*/DB_PASS=${DB_PASS}/" configuration.ini - -exec sh ./posix-launch.sh \ No newline at end of file diff --git a/linux-compile.sh b/linux-compile.sh old mode 100644 new mode 100755 diff --git a/scripts/npc/2020008.js b/scripts/npc/2020008.js index ce8ab3516e..dcaec7b027 100644 --- a/scripts/npc/2020008.js +++ b/scripts/npc/2020008.js @@ -142,7 +142,7 @@ function action(mode, type, selection){ if (cm.getPlayer().getLevel() >= 50){ cm.sendOk("The Chief's Residence Council grants you #bconcession#k to make part of the #rcounteroffensive team against Zakum#k. Good luck on your journey ahead."); if(!(cm.isQuestStarted(100200) || cm.isQuestCompleted(100200))) cm.startQuest(100200); - if(Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS && !cm.isQuestCompleted(100201)) cm.completeQuest(100201); + if(Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS && !cm.isQuestCompleted(100201)) cm.completeQuest(100201); }else cm.sendOk("You're way too weak to make part of the #rcounteroffensive team against Zakum#k. Reach at least #blevel 50#k, then talk to me."); cm.dispose(); diff --git a/scripts/npc/2020009.js b/scripts/npc/2020009.js index 5e759803ef..17273222ae 100644 --- a/scripts/npc/2020009.js +++ b/scripts/npc/2020009.js @@ -114,7 +114,7 @@ function action(mode, type, selection){ if (cm.getPlayer().getLevel() >= 50){ cm.sendOk("The Chief's Residence Council grants you #bconcession#k to make part of the #rcounteroffensive team against Zakum#k. Good luck on your journey ahead."); if(!(cm.isQuestStarted(100200) || cm.isQuestCompleted(100200))) cm.startQuest(100200); - if(Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS && !cm.isQuestCompleted(100201)) cm.completeQuest(100201); + if(Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS && !cm.isQuestCompleted(100201)) cm.completeQuest(100201); }else cm.sendOk("You're way too weak to make part of the #rcounteroffensive team against Zakum#k. Reach at least #blevel 50#k, then talk to me."); cm.dispose(); diff --git a/scripts/npc/2020010.js b/scripts/npc/2020010.js index b4de6203d5..7716da2276 100644 --- a/scripts/npc/2020010.js +++ b/scripts/npc/2020010.js @@ -115,7 +115,7 @@ function action(mode, type, selection){ if (cm.getPlayer().getLevel() >= 50){ cm.sendOk("The Chief's Residence Council grants you #bconcession#k to make part of the #rcounteroffensive team against Zakum#k. Good luck on your journey ahead."); if(!(cm.isQuestStarted(100200) || cm.isQuestCompleted(100200))) cm.startQuest(100200); - if(Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS && !cm.isQuestCompleted(100201)) cm.completeQuest(100201); + if(Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS && !cm.isQuestCompleted(100201)) cm.completeQuest(100201); }else cm.sendOk("You're way too weak to make part of the #rcounteroffensive team against Zakum#k. Reach at least #blevel 50#k, then talk to me."); cm.dispose(); diff --git a/scripts/npc/2020011.js b/scripts/npc/2020011.js index 811ca153f2..670f76d8f6 100644 --- a/scripts/npc/2020011.js +++ b/scripts/npc/2020011.js @@ -114,7 +114,7 @@ function action(mode, type, selection){ if (cm.getPlayer().getLevel() >= 50){ cm.sendOk("The Chief's Residence Council grants you #bconcession#k to make part of the #rcounteroffensive team against Zakum#k. Good luck on your journey ahead."); if(!(cm.isQuestStarted(100200) || cm.isQuestCompleted(100200))) cm.startQuest(100200); - if(Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS && !cm.isQuestCompleted(100201)) cm.completeQuest(100201); + if(Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS && !cm.isQuestCompleted(100201)) cm.completeQuest(100201); }else cm.sendOk("You're way too weak to make part of the #rcounteroffensive team against Zakum#k. Reach at least #blevel 50#k, then talk to me."); cm.dispose(); diff --git a/scripts/npc/2020013.js b/scripts/npc/2020013.js index f18199331d..8e593311d4 100644 --- a/scripts/npc/2020013.js +++ b/scripts/npc/2020013.js @@ -113,7 +113,7 @@ function action(mode, type, selection){ if (cm.getPlayer().getLevel() >= 50){ cm.sendOk("The Chief's Residence Council grants you #bconcession#k to make part of the #rcounteroffensive team against Zakum#k. Good luck on your journey ahead."); if(!(cm.isQuestStarted(100200) || cm.isQuestCompleted(100200))) cm.startQuest(100200); - if(Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS && !cm.isQuestCompleted(100201)) cm.completeQuest(100201); + if(Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS && !cm.isQuestCompleted(100201)) cm.completeQuest(100201); }else cm.sendOk("You're way too weak to make part of the #rcounteroffensive team against Zakum#k. Reach at least #blevel 50#k, then talk to me."); cm.dispose(); diff --git a/scripts/npc/2042000.js b/scripts/npc/2042000.js index e6bf0728c6..8d2e7c27bd 100644 --- a/scripts/npc/2042000.js +++ b/scripts/npc/2042000.js @@ -30,8 +30,8 @@ var feeMultiplier = 7.0; function start() { status = -1; - if (!Packages.constants.ServerConstants.USE_CPQ) { - if (Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (!Packages.config.YamlConfig.config.server.USE_CPQ) { + if (Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { status = 0; action(1, 0, 4); } else { @@ -221,9 +221,9 @@ function action(mode, type, selection) { } } else { var party = cm.getParty().getMembers(); - if ((selection >= 0 && selection <= 3) && party.size() < (Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 2)) { + if ((selection >= 0 && selection <= 3) && party.size() < (Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 2)) { cm.sendOk("You need at least 2 players to participate in the battle!"); - } else if ((selection >= 4 && selection <= 5) && party.size() < (Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 3)) { + } else if ((selection >= 4 && selection <= 5) && party.size() < (Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 3)) { cm.sendOk("You need at least 3 players to participate in the battle!"); } else { cm.cpqLobby(selection); @@ -236,7 +236,7 @@ function action(mode, type, selection) { } else { if (status == 0) { var talk = "What would you like to do? If you have never participate in the Monster Carnival, you will need to know a few things before participating! \r\n#b#L0# Go to the Monster Carnival 1.#l \r\n#L3# Go to the Monster Carnival 2.#l \r\n#L1# Learn about the Monster Carnival.#l\r\n#L2# Trade #t4001129#.#l"; - if (Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { talk += "\r\n#L4# ... Can I just refine my ores?#l"; } cm.sendSimple(talk); diff --git a/scripts/npc/2042001.js b/scripts/npc/2042001.js index d055d281e2..e8d284d80f 100644 --- a/scripts/npc/2042001.js +++ b/scripts/npc/2042001.js @@ -29,8 +29,8 @@ var feeMultiplier = 7.0; function start() { status = -1; - if (!Packages.constants.ServerConstants.USE_CPQ) { - if (Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (!Packages.config.YamlConfig.config.server.USE_CPQ) { + if (Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { status = 0; action(1, 0, 4); } else { @@ -220,9 +220,9 @@ function action(mode, type, selection) { } } else { var party = cm.getParty().getMembers(); - if ((selection >= 0 && selection <= 3) && party.size() < (Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 2)) { + if ((selection >= 0 && selection <= 3) && party.size() < (Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 2)) { cm.sendOk("You need at least 2 players to participate in the battle!"); - } else if ((selection >= 4 && selection <= 5) && party.size() < (Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 3)) { + } else if ((selection >= 4 && selection <= 5) && party.size() < (Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 3)) { cm.sendOk("You need at least 3 players to participate in the battle!"); } else { cm.cpqLobby(selection); @@ -235,7 +235,7 @@ function action(mode, type, selection) { } else { if (status == 0) { var talk = "What would you like to do? If you have never participate in the Monster Carnival, you will need to know a few things before participating! \r\n#b#L0# Go to the Monster Carnival 1.#l \r\n#L3# Go to the Monster Carnival 2.#l \r\n#L1# Learn about the Monster Carnival.#l\r\n#L2# Trade #t4001129#.#l"; - if (Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { talk += "\r\n#L4# ... Can I just refine my ores?#l"; } cm.sendSimple(talk); diff --git a/scripts/npc/2042002.js b/scripts/npc/2042002.js index dac501d13b..7d0a3251d6 100644 --- a/scripts/npc/2042002.js +++ b/scripts/npc/2042002.js @@ -29,8 +29,8 @@ var feeMultiplier = 7.0; function start() { status = -1; - if (!Packages.constants.ServerConstants.USE_CPQ) { - if (Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (!Packages.config.YamlConfig.config.server.USE_CPQ) { + if (Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { status = 0; action(1, 0, 4); } else { @@ -235,7 +235,7 @@ function action(mode, type, selection) { } else { if (status == 0) { var talk = "What would you like to do? If you have never participate in the Monster Carnival, you will need to know a few things before participating! \r\n#b#L0# Go to the Monster Carnival 1.#l \r\n#L3# Go to the Monster Carnival 2.#l \r\n#L1# Learn about the Monster Carnival.#l\r\n#L2# Trade #t4001129#.#l"; - if (Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { talk += "\r\n#L4# ... Can I just refine my ores?#l"; } cm.sendSimple(talk); diff --git a/scripts/npc/2042005.js b/scripts/npc/2042005.js index 5008b8ef80..efb085c16a 100644 --- a/scripts/npc/2042005.js +++ b/scripts/npc/2042005.js @@ -77,9 +77,9 @@ function action(mode, type, selection) { } } else { var party = cm.getParty().getMembers(); - if ((selection === 0 || selection === 1 ) && party.size() < (Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 2)) { + if ((selection === 0 || selection === 1 ) && party.size() < (Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 2)) { cm.sendOk("You need at least 2 players to participate in the battle!"); - } else if ((selection === 2 ) && party.size() < (Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 3)) { + } else if ((selection === 2 ) && party.size() < (Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS ? 1 : 3)) { cm.sendOk("You need at least 3 players to participate in the battle!"); } else { cm.cpqLobby2(selection); diff --git a/scripts/npc/2082014.js b/scripts/npc/2082014.js index 297419a158..60614d44a9 100644 --- a/scripts/npc/2082014.js +++ b/scripts/npc/2082014.js @@ -39,7 +39,7 @@ function action(mode, type, selection) { status--; if(status == 0) { - if (Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { cm.openShopNPC(2082014); } else if (cm.isQuestStarted(3749)) { cm.sendOk("We've already located the enemy's ultimate weapon! Follow along the ship's bow area ahead and you will find my sister #b#p2082013##k. Report to her for futher instructions on the mission."); diff --git a/scripts/npc/2083000.js b/scripts/npc/2083000.js index f59c817e1e..ee3b07b2f6 100644 --- a/scripts/npc/2083000.js +++ b/scripts/npc/2083000.js @@ -45,7 +45,7 @@ function action(mode, type, selection) { if (status == 0) { if(cm.haveItem(4001086)) { cm.sendYesNo("Do you want to access #b#m240050400##k right now?"); - } else if(Packages.constants.ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS) { + } else if(Packages.config.YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS) { if(canBypassHTPQ()) { cm.sendYesNo("Do you want to access #b#m240050400##k right now?"); } else { diff --git a/scripts/npc/2091005.js b/scripts/npc/2091005.js index 57ad24c0ce..b49cb7aff8 100644 --- a/scripts/npc/2091005.js +++ b/scripts/npc/2091005.js @@ -25,7 +25,7 @@ * @Map(s): Dojo Hall */ -importPackage(Packages.constants); +importPackage(Packages.config); var disabled = false; var belts = Array(1132000, 1132001, 1132002, 1132003, 1132004); @@ -44,7 +44,7 @@ function start() { return; } - belt_points = ServerConstants.USE_FAST_DOJO_UPGRADE ? Array(10, 90, 200, 460, 850) : Array(200, 1800, 4000, 9200, 17000); + belt_points = YamlConfig.config.server.USE_FAST_DOJO_UPGRADE ? Array(10, 90, 200, 460, 850) : Array(200, 1800, 4000, 9200, 17000); belt_on_inventory = new Array(); for (var i = 0; i < belts.length; i++) { diff --git a/scripts/npc/9000017.js b/scripts/npc/9000017.js index 57e58dde3c..18083f6e33 100644 --- a/scripts/npc/9000017.js +++ b/scripts/npc/9000017.js @@ -51,7 +51,7 @@ function action(mode, type, selection) { } if (status == 0) { - if (!Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (!Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { cm.sendOk("Hi, I'm #b#p" + cm.getNpc() + "##k."); cm.dispose(); return; diff --git a/scripts/npc/9000036.js b/scripts/npc/9000036.js index 255befc3fd..97b7327b88 100644 --- a/scripts/npc/9000036.js +++ b/scripts/npc/9000036.js @@ -39,7 +39,7 @@ var equip; var maxEqp = 0; function start() { - if (!Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (!Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { cm.sendOk("Hi, I'm #b#p" + cm.getNpc() + "##k."); cm.dispose(); return; diff --git a/scripts/npc/9000040.js b/scripts/npc/9000040.js index 004ba79aab..ecb1b32681 100644 --- a/scripts/npc/9000040.js +++ b/scripts/npc/9000040.js @@ -25,7 +25,7 @@ */ importPackage(Packages.client.processor); -importPackage(Packages.constants); +importPackage(Packages.config); var status; var mergeFee = 50000; @@ -50,7 +50,7 @@ function action(mode, type, selection) { status--; if(status == 0) { - if (!Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (!Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { cm.sendOk("The medal ranking system is currently unavailable..."); cm.dispose(); return; @@ -59,7 +59,7 @@ function action(mode, type, selection) { var levelLimit = !cm.getPlayer().isCygnus() ? 160 : 110; var selStr = "The medal ranking system is currently unavailable... Therefore, I am providing the #bEquipment Merge#k service! "; - if (!ServerConstants.USE_STARTER_MERGE && (cm.getPlayer().getLevel() < levelLimit || MakerProcessor.getMakerSkillLevel(cm.getPlayer()) < 3)) { + if (!YamlConfig.config.server.USE_STARTER_MERGE && (cm.getPlayer().getLevel() < levelLimit || MakerProcessor.getMakerSkillLevel(cm.getPlayer()) < 3)) { selStr += "However, you must have #rMaker level 3#k and at least #rlevel 110#k (Cygnus Knight), #rlevel 160#k (other classes) and a fund of #r" + cm.numberWithCommas(mergeFee) + " mesos#k to use the service."; cm.sendOk(selStr); cm.dispose(); diff --git a/scripts/npc/9000041.js b/scripts/npc/9000041.js index 1d2cc250ef..666e3616b5 100644 --- a/scripts/npc/9000041.js +++ b/scripts/npc/9000041.js @@ -42,7 +42,7 @@ function action(mode, type, selection) { } if (status == 0) { - if (!Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (!Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { cm.sendOk("The medal ranking system is currently unavailable..."); cm.dispose(); return; diff --git a/scripts/npc/9010021.js b/scripts/npc/9010021.js index 2d1177d94d..0abd074218 100644 --- a/scripts/npc/9010021.js +++ b/scripts/npc/9010021.js @@ -26,7 +26,7 @@ function start() { status = -1; - if (!Packages.constants.ServerConstants.USE_REBIRTH_SYSTEM) { + if (!Packages.config.YamlConfig.config.server.USE_REBIRTH_SYSTEM) { cm.sendOk("... I came from distant planes to assist the fight against the #rBlack Magician#k. Right now I search my master, have you seen him?"); cm.dispose(); return; diff --git a/scripts/npc/9201002.js b/scripts/npc/9201002.js index 8a9341aa87..40faa47cff 100644 --- a/scripts/npc/9201002.js +++ b/scripts/npc/9201002.js @@ -21,7 +21,7 @@ Marriage NPC */ -importPackage(Packages.constants); +importPackage(Packages.config); importPackage(Packages.net.server.channel.handlers); importPackage(Packages.tools); importPackage(Packages.tools.packets); @@ -32,7 +32,7 @@ var eim; var weddingEventName = "WeddingCathedral"; var cathedralWedding = true; var weddingIndoors; -var weddingBlessingExp = ServerConstants.WEDDING_BLESS_EXP; +var weddingBlessingExp = YamlConfig.config.server.WEDDING_BLESS_EXP; function isWeddingIndoors(mapid) { return mapid >= 680000100 && mapid <= 680000500; @@ -304,7 +304,7 @@ function action(mode, type, selection) { if (state == 0) { // give player blessings eim.gridInsert(cm.getPlayer(), 1); - if (ServerConstants.WEDDING_BLESSER_SHOWFX) { + if (YamlConfig.config.server.WEDDING_BLESSER_SHOWFX) { var target = cm.getPlayer(); target.announce(MaplePacketCreator.showSpecialEffect(9)); target.getMap().broadcastMessage(target, MaplePacketCreator.showForeignEffect(target.getId(), 9), false); diff --git a/scripts/npc/9201011.js b/scripts/npc/9201011.js index b81902eab3..0cb2c189b3 100644 --- a/scripts/npc/9201011.js +++ b/scripts/npc/9201011.js @@ -21,7 +21,7 @@ Marriage NPC */ -importPackage(Packages.constants); +importPackage(Packages.config); importPackage(Packages.net.server.channel.handlers); importPackage(Packages.tools); importPackage(Packages.tools.packets); @@ -32,7 +32,7 @@ var eim; var weddingEventName = "WeddingChapel"; var cathedralWedding = false; var weddingIndoors; -var weddingBlessingExp = ServerConstants.WEDDING_BLESS_EXP; +var weddingBlessingExp = YamlConfig.config.server.WEDDING_BLESS_EXP; function detectPlayerItemid(player) { for (var x = 4031357; x <= 4031364; x++) { @@ -174,7 +174,7 @@ function action(mode, type, selection) { if(state == 0) { // give player blessings eim.gridInsert(cm.getPlayer(), 1); - if(ServerConstants.WEDDING_BLESSER_SHOWFX) { + if(YamlConfig.config.server.WEDDING_BLESSER_SHOWFX) { var target = cm.getPlayer(); target.announce(MaplePacketCreator.showSpecialEffect(9)); target.getMap().broadcastMessage(target, MaplePacketCreator.showForeignEffect(target.getId(), 9), false); diff --git a/scripts/npc/9201101.js b/scripts/npc/9201101.js index c2fecb4580..c424e7dcd9 100644 --- a/scripts/npc/9201101.js +++ b/scripts/npc/9201101.js @@ -4,7 +4,7 @@ */ function start() { - if (Packages.constants.ServerConstants.USE_ENABLE_CUSTOM_NPC_SCRIPT) { + if (Packages.config.YamlConfig.config.server.USE_ENABLE_CUSTOM_NPC_SCRIPT) { cm.openShopNPC(9201101); } else { //cm.sendOk("The patrol in New Leaf City is always ready. No creatures are able to break through to the city."); diff --git a/scripts/quest/21101.js b/scripts/quest/21101.js index e59c0bb9a6..05636b3cbc 100644 --- a/scripts/quest/21101.js +++ b/scripts/quest/21101.js @@ -20,7 +20,7 @@ along with this program. If not, see . */ importPackage(Packages.client); -importPackage(Packages.constants); +importPackage(Packages.config); status = -1; @@ -48,7 +48,7 @@ function start(mode, type, selection) { qm.changeJobById(2100); qm.resetStats(); - if (ServerConstants.USE_FULL_ARAN_SKILLSET) { + if (YamlConfig.config.server.USE_FULL_ARAN_SKILLSET) { qm.teachSkill(21000000, 0, 10, -1); //combo ability qm.teachSkill(21001003, 0, 20, -1); //polearm booster } diff --git a/scripts/quest/21201.js b/scripts/quest/21201.js index db80f5d8e1..f03e71968e 100644 --- a/scripts/quest/21201.js +++ b/scripts/quest/21201.js @@ -20,7 +20,7 @@ along with this program. If not, see . */ importPackage(Packages.client); -importPackage(Packages.constants); +importPackage(Packages.config); var status = -1; @@ -66,7 +66,7 @@ function end(mode, type, selection) { qm.gainItem(1142130, true); qm.changeJobById(2110); - if (ServerConstants.USE_FULL_ARAN_SKILLSET) { + if (YamlConfig.config.server.USE_FULL_ARAN_SKILLSET) { qm.teachSkill(21100000, 0, 20, -1); //polearm mastery qm.teachSkill(21100002, 0, 30, -1); //final charge qm.teachSkill(21100004, 0, 20, -1); //combo smash diff --git a/scripts/quest/21302.js b/scripts/quest/21302.js index 69a40ee7b7..4719a4a61f 100644 --- a/scripts/quest/21302.js +++ b/scripts/quest/21302.js @@ -20,7 +20,7 @@ along with this program. If not, see . */ importPackage(Packages.client); -importPackage(Packages.constants); +importPackage(Packages.config); var status = -1; @@ -51,7 +51,7 @@ function end(mode, type, selection) { qm.gainItem(1142131, true); qm.changeJobById(2111); - if (ServerConstants.USE_FULL_ARAN_SKILLSET) { + if (YamlConfig.config.server.USE_FULL_ARAN_SKILLSET) { qm.teachSkill(21110002, 0, 20, -1); //full swing } diff --git a/src/client/AbstractMapleCharacterObject.java b/src/client/AbstractMapleCharacterObject.java index 03c2c1a492..5d95db4bb9 100644 --- a/src/client/AbstractMapleCharacterObject.java +++ b/src/client/AbstractMapleCharacterObject.java @@ -19,6 +19,7 @@ */ package client; +import config.YamlConfig; import constants.GameConstants; import constants.ServerConstants; import java.util.Arrays; @@ -635,19 +636,19 @@ public abstract class AbstractMapleCharacterObject extends AbstractAnimatedMaple } int newStr = str + deltaStr, newDex = dex + deltaDex, newInt = int_ + deltaInt, newLuk = luk + deltaLuk; - if (newStr < 4 && deltaStr != Short.MIN_VALUE || newStr > ServerConstants.MAX_AP) { + if (newStr < 4 && deltaStr != Short.MIN_VALUE || newStr > YamlConfig.config.server.MAX_AP) { return false; } - if (newDex < 4 && deltaDex != Short.MIN_VALUE || newDex > ServerConstants.MAX_AP) { + if (newDex < 4 && deltaDex != Short.MIN_VALUE || newDex > YamlConfig.config.server.MAX_AP) { return false; } - if (newInt < 4 && deltaInt != Short.MIN_VALUE || newInt > ServerConstants.MAX_AP) { + if (newInt < 4 && deltaInt != Short.MIN_VALUE || newInt > YamlConfig.config.server.MAX_AP) { return false; } - if (newLuk < 4 && deltaLuk != Short.MIN_VALUE || newLuk > ServerConstants.MAX_AP) { + if (newLuk < 4 && deltaLuk != Short.MIN_VALUE || newLuk > YamlConfig.config.server.MAX_AP) { return false; } diff --git a/src/client/MapleCharacter.java b/src/client/MapleCharacter.java index 54d913fc2f..bfb185898f 100644 --- a/src/client/MapleCharacter.java +++ b/src/client/MapleCharacter.java @@ -52,6 +52,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicBoolean; import java.util.regex.Pattern; +import config.YamlConfig; import net.server.PlayerBuffValueHolder; import net.server.PlayerCoolDownValueHolder; import net.server.Server; @@ -462,7 +463,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { int[] selectedType; int[] selectedAction; - if(ServerConstants.USE_CUSTOM_KEYSET) { + if(YamlConfig.config.server.USE_CUSTOM_KEYSET) { selectedKey = GameConstants.getCustomKey(true); selectedType = GameConstants.getCustomType(true); selectedAction = GameConstants.getCustomAction(true); @@ -1169,7 +1170,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { spGain += 2; } - if (ServerConstants.USE_ENFORCE_JOB_SP_RANGE) { + if (YamlConfig.config.server.USE_ENFORCE_JOB_SP_RANGE) { spGain = getChangedJobSp(newJob); } } @@ -1183,12 +1184,12 @@ public class MapleCharacter extends AbstractMapleCharacterObject { if (this.isCygnus()) { gainAp(7, true); } else { - if (ServerConstants.USE_STARTING_AP_4 || newJob.getId() % 10 >= 1) { + if (YamlConfig.config.server.USE_STARTING_AP_4 || newJob.getId() % 10 >= 1) { gainAp(5, true); } } } else { // thanks Periwinks for noticing an AP shortage from lower levels - if (ServerConstants.USE_STARTING_AP_4 && newJob.getId() % 1000 >= 1) { + if (YamlConfig.config.server.USE_STARTING_AP_4 && newJob.getId() % 1000 >= 1) { gainAp(4, true); } } @@ -1278,7 +1279,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { createDragon(); } - if (ServerConstants.USE_ANNOUNCE_CHANGEJOB) { + if (YamlConfig.config.server.USE_ANNOUNCE_CHANGEJOB) { if (!this.isGM()) { broadcastAcquaintances(6, "[" + GameConstants.ordinal(GameConstants.getJobBranch(newJob)) + " Job] " + name + " has just become a " + GameConstants.getJobName(this.job.getId()) + "."); // thanks Vcoc for noticing job name appearing in uppercase here } @@ -1379,7 +1380,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void changeMapBanish(int mapid, String portal, String msg) { - if(ServerConstants.USE_SPIKES_AVOID_BANISH) { + if(YamlConfig.config.server.USE_SPIKES_AVOID_BANISH) { for(Item it: this.getInventory(MapleInventoryType.EQUIPPED).list()) { if((it.getFlag() & ItemConstants.SPIKES) == ItemConstants.SPIKES) { return; @@ -1733,7 +1734,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { int idx = getVisitedMapIndex(map); if(idx == -1) { - if(lastVisitedMaps.size() == ServerConstants.MAP_VISITED_SIZE) { + if(lastVisitedMaps.size() == YamlConfig.config.server.MAP_VISITED_SIZE) { lastVisitedMaps.remove(0); } } else { @@ -2468,10 +2469,10 @@ public class MapleCharacter extends AbstractMapleCharacterObject { private static Pair> getChairTaskIntervalRate(int maxhp, int maxmp) { float toHeal = Math.max(maxhp, maxmp); - float maxDuration = ServerConstants.CHAIR_EXTRA_HEAL_MAX_DELAY * 1000; + float maxDuration = YamlConfig.config.server.CHAIR_EXTRA_HEAL_MAX_DELAY * 1000; int rate = 0; - int minRegen = 1, maxRegen = (256 * ServerConstants.CHAIR_EXTRA_HEAL_MULTIPLIER) - 1, midRegen = 1; + int minRegen = 1, maxRegen = (256 * YamlConfig.config.server.CHAIR_EXTRA_HEAL_MULTIPLIER) - 1, midRegen = 1; while (minRegen < maxRegen) { midRegen = (int) ((minRegen + maxRegen) * 0.94); @@ -2553,7 +2554,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { final int healMP = localchairmp; if(MapleCharacter.this.getHp() < localmaxhp) { - byte recHP = (byte) (healHP / ServerConstants.CHAIR_EXTRA_HEAL_MULTIPLIER); + byte recHP = (byte) (healHP / YamlConfig.config.server.CHAIR_EXTRA_HEAL_MULTIPLIER); client.announce(MaplePacketCreator.showOwnRecovery(recHP)); getMap().broadcastMessage(MapleCharacter.this, MaplePacketCreator.showRecovery(id, recHP), false); @@ -2625,7 +2626,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void dispel() { - if(!(ServerConstants.USE_UNDISPEL_HOLY_SHIELD && this.hasActiveBuff(Bishop.HOLY_SHIELD))) { + if(!(YamlConfig.config.server.USE_UNDISPEL_HOLY_SHIELD && this.hasActiveBuff(Bishop.HOLY_SHIELD))) { List mbsvhList = getAllStatups(); for (MapleBuffStatValueHolder mbsvh : mbsvhList) { if (mbsvh.effect.isSkill()) { @@ -2860,7 +2861,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public void run() { doHurtHp(); } - }, ServerConstants.MAP_DAMAGE_OVERTIME_INTERVAL, ServerConstants.MAP_DAMAGE_OVERTIME_INTERVAL - lastHpTask); + }, YamlConfig.config.server.MAP_DAMAGE_OVERTIME_INTERVAL, YamlConfig.config.server.MAP_DAMAGE_OVERTIME_INTERVAL - lastHpTask); } public void resetHpDecreaseTask() { @@ -2869,7 +2870,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } long lastHpTask = Server.getInstance().getCurrentTime() - lastHpDec; - startHpDecreaseTask((lastHpTask > ServerConstants.MAP_DAMAGE_OVERTIME_INTERVAL) ? ServerConstants.MAP_DAMAGE_OVERTIME_INTERVAL : lastHpTask); + startHpDecreaseTask((lastHpTask > YamlConfig.config.server.MAP_DAMAGE_OVERTIME_INTERVAL) ? YamlConfig.config.server.MAP_DAMAGE_OVERTIME_INTERVAL : lastHpTask); } public void dropMessage(String message) { @@ -4090,7 +4091,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { for(Entry it : stats.entrySet()) { boolean uniqueBuff = isSingletonStatup(it.getKey()); - if(it.getValue() >= (!uniqueBuff ? ServerConstants.MAX_MONITORED_BUFFSTATS : 1) && effectStatups.contains(it.getKey())) { + if(it.getValue() >= (!uniqueBuff ? YamlConfig.config.server.MAX_MONITORED_BUFFSTATS : 1) && effectStatups.contains(it.getKey())) { MapleBuffStatValueHolder mbsvh = minStatBuffs.get(it.getKey()); Map lpbe = buffEffects.get(mbsvh.effect.getBuffSourceId()); @@ -4514,7 +4515,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { }, buffInterval, buffInterval); } } else if (effect.isRecovery()) { - int healInterval = (ServerConstants.USE_ULTRA_RECOVERY) ? 2000 : 5000; + int healInterval = (YamlConfig.config.server.USE_ULTRA_RECOVERY) ? 2000 : 5000; final byte heal = (byte) effect.getX(); chrLock.lock(); @@ -4583,7 +4584,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } boolean active = effect.isActive(this); - if(ServerConstants.USE_BUFF_MOST_SIGNIFICANT) { + if(YamlConfig.config.server.USE_BUFF_MOST_SIGNIFICANT) { toDeploy = new LinkedHashMap<>(); Map> retrievedEffects = new LinkedHashMap<>(); Set retrievedStats = new LinkedHashSet<>(); @@ -4663,7 +4664,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public boolean unregisterChairBuff() { - if (!ServerConstants.USE_CHAIR_EXTRAHEAL) { + if (!YamlConfig.config.server.USE_CHAIR_EXTRAHEAL) { return false; } @@ -4678,7 +4679,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public boolean registerChairBuff() { - if (!ServerConstants.USE_CHAIR_EXTRAHEAL) { + if (!YamlConfig.config.server.USE_CHAIR_EXTRAHEAL) { return false; } @@ -4954,7 +4955,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public boolean hasNoviceExpRate() { - return ServerConstants.USE_ENFORCE_NOVICE_EXPRATE && isBeginnerJob() && level < 11; + return YamlConfig.config.server.USE_ENFORCE_NOVICE_EXPRATE && isBeginnerJob() && level < 11; } public int getExpRate() { @@ -5334,7 +5335,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public int getMaxLevel() { - if(!ServerConstants.USE_ENFORCE_JOB_LEVEL_RANGE || isGmJob()) { + if(!YamlConfig.config.server.USE_ENFORCE_JOB_LEVEL_RANGE || isGmJob()) { return getMaxClassLevel(); } @@ -6171,7 +6172,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } private long getNextBuybackTime() { - return lastBuyback + ServerConstants.BUYBACK_COOLDOWN_MINUTES * 60 * 1000; + return lastBuyback + YamlConfig.config.server.BUYBACK_COOLDOWN_MINUTES * 60 * 1000; } private boolean isBuybackInvincible() { @@ -6179,30 +6180,30 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } private int getBuybackFee() { - float fee = ServerConstants.BUYBACK_FEE; + float fee = YamlConfig.config.server.BUYBACK_FEE; int grade = Math.min(Math.max(level, 30), 120) - 30; - fee += (grade * ServerConstants.BUYBACK_LEVEL_STACK_FEE); - if (ServerConstants.USE_BUYBACK_WITH_MESOS) { - fee *= ServerConstants.BUYBACK_MESO_MULTIPLIER; + fee += (grade * YamlConfig.config.server.BUYBACK_LEVEL_STACK_FEE); + if (YamlConfig.config.server.USE_BUYBACK_WITH_MESOS) { + fee *= YamlConfig.config.server.BUYBACK_MESO_MULTIPLIER; } return (int) Math.floor(fee); } public void showBuybackInfo() { - String s = "#eBUYBACK STATUS#n\r\n\r\nCurrent buyback fee: #b" + getBuybackFee() + " " + (ServerConstants.USE_BUYBACK_WITH_MESOS ? "mesos" : "NX") + "#k\r\n\r\n"; + String s = "#eBUYBACK STATUS#n\r\n\r\nCurrent buyback fee: #b" + getBuybackFee() + " " + (YamlConfig.config.server.USE_BUYBACK_WITH_MESOS ? "mesos" : "NX") + "#k\r\n\r\n"; long timeNow = Server.getInstance().getCurrentTime(); boolean avail = true; if (!isAlive()) { long timeLapsed = timeNow - lastDeathtime; - long timeRemaining = ServerConstants.BUYBACK_RETURN_MINUTES * 60 * 1000 - (timeLapsed + Math.max(0, getNextBuybackTime() - timeNow)); + long timeRemaining = YamlConfig.config.server.BUYBACK_RETURN_MINUTES * 60 * 1000 - (timeLapsed + Math.max(0, getNextBuybackTime() - timeNow)); if (timeRemaining < 1) { s += "Buyback #e#rUNAVAILABLE#k#n"; avail = false; } else { - s += "Buyback countdown: #e#b" + getTimeRemaining(ServerConstants.BUYBACK_RETURN_MINUTES * 60 * 1000 - timeLapsed) + "#k#n"; + s += "Buyback countdown: #e#b" + getTimeRemaining(YamlConfig.config.server.BUYBACK_RETURN_MINUTES * 60 * 1000 - timeLapsed) + "#k#n"; } s += "\r\n"; } @@ -6225,7 +6226,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { public boolean couldBuyback() { // Ronan's buyback system long timeNow = Server.getInstance().getCurrentTime(); - if (timeNow - lastDeathtime > ServerConstants.BUYBACK_RETURN_MINUTES * 60 * 1000) { + if (timeNow - lastDeathtime > YamlConfig.config.server.BUYBACK_RETURN_MINUTES * 60 * 1000) { this.dropMessage(5, "The period of time to decide has expired, therefore you are unable to buyback."); return false; } @@ -6237,7 +6238,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { return false; } - boolean usingMesos = ServerConstants.USE_BUYBACK_WITH_MESOS; + boolean usingMesos = YamlConfig.config.server.USE_BUYBACK_WITH_MESOS; int fee = getBuybackFee(); if (!canBuyback(fee, usingMesos)) { @@ -6309,7 +6310,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public boolean attemptCatchFish(int baitLevel) { - return ServerConstants.USE_FISHING_SYSTEM && GameConstants.isFishingArea(mapid) && this.getPosition().getY() > 0 && ItemConstants.isFishingChair(chair.get()) && this.getWorldServer().registerFisherPlayer(this, baitLevel); + return YamlConfig.config.server.USE_FISHING_SYSTEM && GameConstants.isFishingArea(mapid) && this.getPosition().getY() > 0 && ItemConstants.isFishingChair(chair.get()) && this.getWorldServer().registerFisherPlayer(this, baitLevel); } public void leaveMap() { @@ -6395,7 +6396,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } int spGain = 3; - if (ServerConstants.USE_ENFORCE_JOB_SP_RANGE && !GameConstants.hasSPTable(job)) { + if (YamlConfig.config.server.USE_ENFORCE_JOB_SP_RANGE && !GameConstants.hasSPTable(job)) { spGain = getSpGain(spGain, job); } @@ -6411,7 +6412,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { int improvingMaxMPLevel = 0; boolean isBeginner = isBeginnerJob(); - if (ServerConstants.USE_AUTOASSIGN_STARTERS_AP && isBeginner && level < 11) { + if (YamlConfig.config.server.USE_AUTOASSIGN_STARTERS_AP && isBeginner && level < 11) { effLock.lock(); statWlock.lock(); try { @@ -6488,7 +6489,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { addmp += improvingMaxMP.getEffect(improvingMaxMPLevel).getX(); } - if (ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if (YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if (getJobStyle() == MapleJob.MAGICIAN) { addmp += localint_ / 20; } else { @@ -6512,7 +6513,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { int maxClassLevel = getMaxClassLevel(); if (level == maxClassLevel) { if (!this.isGM()) { - if (ServerConstants.PLAYERNPC_AUTODEPLOY) { + if (YamlConfig.config.server.PLAYERNPC_AUTODEPLOY) { ThreadManager.getInstance().newTask(new Runnable() { @Override public void run() { @@ -6564,7 +6565,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } if (level % 20 == 0) { - if (ServerConstants.USE_ADD_SLOTS_BY_LEVEL == true) { + if (YamlConfig.config.server.USE_ADD_SLOTS_BY_LEVEL == true) { if (!isGM()) { for (byte i = 1; i < 5; i++) { gainSlots(i, 4, true); @@ -6573,14 +6574,14 @@ public class MapleCharacter extends AbstractMapleCharacterObject { this.yellowMessage("You reached level " + level + ". Congratulations! As a token of your success, your inventory has been expanded a little bit."); } } - if (ServerConstants.USE_ADD_RATES_BY_LEVEL == true) { //For the rate upgrade + if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL == true) { //For the rate upgrade revertLastPlayerRates(); setPlayerRates(); this.yellowMessage("You managed to get level " + level + "! Getting experience and items seems a little easier now, huh?"); } } - if (ServerConstants.USE_PERFECT_PITCH && level >= 30) { + if (YamlConfig.config.server.USE_PERFECT_PITCH && level >= 30) { //milestones? if (MapleInventoryManipulator.checkSpace(client, 4310000, (short) 1, "")) { MapleInventoryManipulator.addById(client, 4310000, (short) 1, "", -1); @@ -6603,7 +6604,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { MapleFamilyEntry familyEntry = getFamilyEntry(); if(familyEntry != null) { - familyEntry.giveReputationToSenior(ServerConstants.FAMILY_REP_PER_LEVELUP, true); + familyEntry.giveReputationToSenior(YamlConfig.config.server.FAMILY_REP_PER_LEVELUP, true); MapleFamilyEntry senior = familyEntry.getSenior(); if(senior != null) { //only send the message to direct senior MapleCharacter seniorChr = senior.getChr(); @@ -6833,7 +6834,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { private List activateCouponsEffects() { List toCommitEffect = new LinkedList<>(); - if(ServerConstants.USE_STACK_COUPON_RATES) { + if(YamlConfig.config.server.USE_STACK_COUPON_RATES) { for(Entry coupon: activeCoupons.entrySet()) { int couponId = coupon.getKey(); int couponQty = coupon.getValue(); @@ -7908,7 +7909,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { reapplyLocalStats(); - if (ServerConstants.USE_FIXED_RATIO_HPMP_UPDATE) { + if (YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) { if (localmaxhp != oldlocalmaxhp) { Pair hpUpdate; @@ -8049,7 +8050,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public synchronized void resetStats() { - if(!ServerConstants.USE_AUTOASSIGN_STARTERS_AP) { + if(!YamlConfig.config.server.USE_AUTOASSIGN_STARTERS_AP) { return; } @@ -8298,7 +8299,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { int[] selectedType; int[] selectedAction; - if(ServerConstants.USE_CUSTOM_KEYSET) { + if(YamlConfig.config.server.USE_CUSTOM_KEYSET) { selectedKey = GameConstants.getCustomKey(true); selectedType = GameConstants.getCustomType(true); selectedAction = GameConstants.getCustomAction(true); @@ -8366,7 +8367,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void saveCharToDB() { - if(ServerConstants.USE_AUTOSAVE) { + if(YamlConfig.config.server.USE_AUTOSAVE) { Runnable r = new Runnable() { @Override public void run() { @@ -9858,7 +9859,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void awardQuestPoint(int awardedPoints) { - if (ServerConstants.QUEST_POINT_REQUIREMENT < 1 || awardedPoints < 1) { + if (YamlConfig.config.server.QUEST_POINT_REQUIREMENT < 1 || awardedPoints < 1) { return; } @@ -9866,8 +9867,8 @@ public class MapleCharacter extends AbstractMapleCharacterObject { synchronized (quests) { quest_fame += awardedPoints; - delta = quest_fame / ServerConstants.QUEST_POINT_REQUIREMENT; - quest_fame %= ServerConstants.QUEST_POINT_REQUIREMENT; + delta = quest_fame / YamlConfig.config.server.QUEST_POINT_REQUIREMENT; + quest_fame %= YamlConfig.config.server.QUEST_POINT_REQUIREMENT; } if(delta > 0) { @@ -9936,7 +9937,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { MapleQuest mquest = quest.getQuest(); short questid = mquest.getId(); if (!mquest.isSameDayRepeatable() && !MapleQuest.isExploitableQuest(questid)) { - awardQuestPoint(ServerConstants.QUEST_POINT_PER_QUEST_COMPLETE); + awardQuestPoint(YamlConfig.config.server.QUEST_POINT_PER_QUEST_COMPLETE); } quest.setCompleted(quest.getCompleted() + 1); // count quest completed Jayd's idea @@ -10394,7 +10395,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { private Collection getUpgradeableEquipList() { Collection fullList = getInventory(MapleInventoryType.EQUIPPED).list(); - if (ServerConstants.USE_EQUIPMNT_LVLUP_CASH) { + if (YamlConfig.config.server.USE_EQUIPMNT_LVLUP_CASH) { return fullList; } @@ -10660,7 +10661,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { while(rs.next()) { Timestamp completedTimestamp = rs.getTimestamp("completionTime"); if(completedTimestamp == null) return false; //pending - else if(completedTimestamp.getTime() + ServerConstants.NAME_CHANGE_COOLDOWN > currentTimeMillis) return false; + else if(completedTimestamp.getTime() + YamlConfig.config.server.NAME_CHANGE_COOLDOWN > currentTimeMillis) return false; } } catch(SQLException e) { e.printStackTrace(); @@ -10886,7 +10887,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public static String checkWorldTransferEligibility(Connection con, int characterId, int oldWorld, int newWorld) { - if(!ServerConstants.ALLOW_CASHSHOP_WORLD_TRANSFER) return "World transfers disabled."; + if(!YamlConfig.config.server.ALLOW_CASHSHOP_WORLD_TRANSFER) return "World transfers disabled."; int accountId = -1; try (PreparedStatement ps = con.prepareStatement("SELECT accountid, level, guildid, guildrank, partnerId, familyId FROM characters WHERE id = ?")) { ps.setInt(1, characterId); @@ -10936,7 +10937,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { while(rs.next()) { Timestamp completedTimestamp = rs.getTimestamp("completionTime"); if(completedTimestamp == null) return false; //pending - else if(completedTimestamp.getTime() + ServerConstants.WORLD_TRANSFER_COOLDOWN > currentTimeMillis) return false; + else if(completedTimestamp.getTime() + YamlConfig.config.server.WORLD_TRANSFER_COOLDOWN > currentTimeMillis) return false; } } catch(SQLException e) { e.printStackTrace(); @@ -10990,7 +10991,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } try (PreparedStatement ps = con.prepareStatement("UPDATE characters SET world = ?, meso = ?, guildid = ?, guildrank = ? WHERE id = ?")) { ps.setInt(1, newWorld); - ps.setInt(2, Math.min(mesos, 1000000)); //might want a limit in ServerConstants for this + ps.setInt(2, Math.min(mesos, 1000000)); //might want a limit in YamlConfig.config.server.for this ps.setInt(3, 0); ps.setInt(4, 5); ps.setInt(5, characterId); @@ -11071,7 +11072,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void setReborns(int value) { - if (!ServerConstants.USE_REBIRTH_SYSTEM) { + if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) { yellowMessage("Rebirth system is not enabled!"); throw new NotEnabledException(); } @@ -11096,7 +11097,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public int getReborns() { - if (!ServerConstants.USE_REBIRTH_SYSTEM) { + if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) { yellowMessage("Rebirth system is not enabled!"); throw new NotEnabledException(); } @@ -11119,7 +11120,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject { } public void executeReborn() { - if (!ServerConstants.USE_REBIRTH_SYSTEM) { + if (!YamlConfig.config.server.USE_REBIRTH_SYSTEM) { yellowMessage("Rebirth system is not enabled!"); throw new NotEnabledException(); } diff --git a/src/client/MapleClient.java b/src/client/MapleClient.java index 415a87b722..b68f27460e 100644 --- a/src/client/MapleClient.java +++ b/src/client/MapleClient.java @@ -44,6 +44,7 @@ import java.util.Set; import java.util.concurrent.Semaphore; import java.util.concurrent.locks.Lock; +import config.YamlConfig; import jdk.nashorn.api.scripting.NashornScriptEngine; import tools.*; @@ -489,7 +490,7 @@ public class MapleClient { } public boolean checkPin(String other) { - if (!(ServerConstants.ENABLE_PIN && !canBypassPin())) { + if (!(YamlConfig.config.server.ENABLE_PIN && !canBypassPin())) { return true; } @@ -526,7 +527,7 @@ public class MapleClient { } public boolean checkPic(String other) { - if (!(ServerConstants.ENABLE_PIC && !canBypassPic())) { + if (!(YamlConfig.config.server.ENABLE_PIC && !canBypassPic())) { return true; } @@ -592,7 +593,7 @@ public class MapleClient { loginok = (tos == 0) ? 23 : 0; } else if (pwd.equals(passhash) || checkHash(passhash, "SHA-1", pwd) || checkHash(passhash, "SHA-512", pwd)) { // thanks GabrielSin for detecting some no-bcrypt inconsistencies here - loginok = (tos == 0) ? (!ServerConstants.BCRYPT_MIGRATION ? 23 : -23) : (!ServerConstants.BCRYPT_MIGRATION ? 0 : -10); // migrate to bcrypt + loginok = (tos == 0) ? (!YamlConfig.config.server.BCRYPT_MIGRATION ? 23 : -23) : (!YamlConfig.config.server.BCRYPT_MIGRATION ? 0 : -10); // migrate to bcrypt } else { loggedIn = false; loginok = 4; @@ -1036,7 +1037,7 @@ public class MapleClient { player.saveCharToDB(true); player.logOff(); - if(ServerConstants.INSTANT_NAME_CHANGE) player.doPendingNameChange(); + if(YamlConfig.config.server.INSTANT_NAME_CHANGE) player.doPendingNameChange(); clear(); } else { getChannelServer().removePlayer(player); diff --git a/src/client/autoban/AutobanFactory.java b/src/client/autoban/AutobanFactory.java index 04f0f672c5..f5cac45c7e 100644 --- a/src/client/autoban/AutobanFactory.java +++ b/src/client/autoban/AutobanFactory.java @@ -23,6 +23,7 @@ along with this program. If not, see . package client.autoban; import client.MapleCharacter; +import config.YamlConfig; import constants.ServerConstants; import net.server.Server; import tools.FilePrinter; @@ -84,19 +85,19 @@ public enum AutobanFactory { } public void alert(MapleCharacter chr, String reason) { - if(ServerConstants.USE_AUTOBAN == true) { + if(YamlConfig.config.server.USE_AUTOBAN == true) { if (chr != null && MapleLogger.ignored.contains(chr.getId())){ return; } Server.getInstance().broadcastGMMessage((chr != null ? chr.getWorld() : 0), MaplePacketCreator.sendYellowTip((chr != null ? MapleCharacter.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason)); } - if (ServerConstants.USE_AUTOBAN_LOG) { + if (YamlConfig.config.server.USE_AUTOBAN_LOG) { FilePrinter.print(FilePrinter.AUTOBAN_WARNING, (chr != null ? MapleCharacter.makeMapleReadable(chr.getName()) : "") + " caused " + this.name() + " " + reason); } } public void autoban(MapleCharacter chr, String value) { - if(ServerConstants.USE_AUTOBAN == true) { + if(YamlConfig.config.server.USE_AUTOBAN == true) { chr.autoban("Autobanned for (" + this.name() + ": " + value + ")"); //chr.sendPolice("You will be disconnected for (" + this.name() + ": " + value + ")"); } diff --git a/src/client/autoban/AutobanManager.java b/src/client/autoban/AutobanManager.java index a3da536387..227790107e 100644 --- a/src/client/autoban/AutobanManager.java +++ b/src/client/autoban/AutobanManager.java @@ -6,6 +6,7 @@ package client.autoban; import client.MapleCharacter; +import config.YamlConfig; import constants.ServerConstants; import java.util.HashMap; import java.util.Map; @@ -33,7 +34,7 @@ public class AutobanManager { } public void addPoint(AutobanFactory fac, String reason) { - if (ServerConstants.USE_AUTOBAN) { + if (YamlConfig.config.server.USE_AUTOBAN) { if (chr.isGM() || chr.isBanned()){ return; } @@ -57,7 +58,7 @@ public class AutobanManager { //chr.sendPolice("You have been blocked by #bMooplePolice for the HACK reason#k."); } } - if (ServerConstants.USE_AUTOBAN_LOG) { + if (YamlConfig.config.server.USE_AUTOBAN_LOG) { // Lets log every single point too. FilePrinter.print(FilePrinter.AUTOBAN_WARNING, MapleCharacter.makeMapleReadable(chr.getName()) + " caused " + fac.name() + " " + reason); } @@ -114,7 +115,7 @@ public class AutobanManager { if (this.timestamp[type] == time) { this.timestampcounter[type]++; if (this.timestampcounter[type] >= times) { - if (ServerConstants.USE_AUTOBAN) { + if (YamlConfig.config.server.USE_AUTOBAN) { chr.getClient().disconnect(false, false); } diff --git a/src/client/command/commands/gm0/DropLimitCommand.java b/src/client/command/commands/gm0/DropLimitCommand.java index 7f10a7dd2c..c27d8ac26d 100644 --- a/src/client/command/commands/gm0/DropLimitCommand.java +++ b/src/client/command/commands/gm0/DropLimitCommand.java @@ -25,6 +25,7 @@ package client.command.commands.gm0; import client.MapleClient; import client.command.Command; +import config.YamlConfig; import constants.ServerConstants; public class DropLimitCommand extends Command { @@ -35,10 +36,10 @@ public class DropLimitCommand extends Command { @Override public void execute(MapleClient c, String[] params) { int dropCount = c.getPlayer().getMap().getDroppedItemCount(); - if(((float) dropCount) / ServerConstants.ITEM_LIMIT_ON_MAP < 0.75f) { - c.getPlayer().showHint("Current drop count: #b" + dropCount + "#k / #e" + ServerConstants.ITEM_LIMIT_ON_MAP + "#n", 300); + if(((float) dropCount) / YamlConfig.config.server.ITEM_LIMIT_ON_MAP < 0.75f) { + c.getPlayer().showHint("Current drop count: #b" + dropCount + "#k / #e" + YamlConfig.config.server.ITEM_LIMIT_ON_MAP + "#n", 300); } else { - c.getPlayer().showHint("Current drop count: #r" + dropCount + "#k / #e" + ServerConstants.ITEM_LIMIT_ON_MAP + "#n", 300); + c.getPlayer().showHint("Current drop count: #r" + dropCount + "#k / #e" + YamlConfig.config.server.ITEM_LIMIT_ON_MAP + "#n", 300); } } diff --git a/src/client/command/commands/gm0/MapOwnerClaimCommand.java b/src/client/command/commands/gm0/MapOwnerClaimCommand.java index 1f6e5c0cdc..352e7029a1 100644 --- a/src/client/command/commands/gm0/MapOwnerClaimCommand.java +++ b/src/client/command/commands/gm0/MapOwnerClaimCommand.java @@ -26,6 +26,7 @@ package client.command.commands.gm0; import client.command.Command; import client.MapleCharacter; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; import server.maps.MapleMap; @@ -40,7 +41,7 @@ public class MapOwnerClaimCommand extends Command { try { MapleCharacter chr = c.getPlayer(); - if (ServerConstants.USE_MAP_OWNERSHIP_SYSTEM) { + if (YamlConfig.config.server.USE_MAP_OWNERSHIP_SYSTEM) { if (chr.getEventInstance() == null) { MapleMap ownedMap = chr.getOwnedMap(); // thanks Conrad for suggesting not unlease a map as soon as player exits it if (ownedMap != null) { diff --git a/src/client/command/commands/gm0/RatesCommand.java b/src/client/command/commands/gm0/RatesCommand.java index 378923e632..103ad11365 100644 --- a/src/client/command/commands/gm0/RatesCommand.java +++ b/src/client/command/commands/gm0/RatesCommand.java @@ -26,6 +26,7 @@ package client.command.commands.gm0; import client.MapleCharacter; import client.command.Command; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; public class RatesCommand extends Command { @@ -43,7 +44,7 @@ public class RatesCommand extends Command { showMsg_ += "MESO Rate: #e#b" + player.getMesoRate() + "x#k#n" + "\r\n"; showMsg_ += "DROP Rate: #e#b" + player.getDropRate() + "x#k#n" + "\r\n"; showMsg_ += "BOSS DROP Rate: #e#b" + player.getBossDropRate() + "x#k#n" + "\r\n"; - if(ServerConstants.USE_QUEST_RATE) showMsg_ += "QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n"; + if(YamlConfig.config.server.USE_QUEST_RATE) showMsg_ += "QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n"; player.showHint(showMsg_, 300); } diff --git a/src/client/command/commands/gm0/ShowRatesCommand.java b/src/client/command/commands/gm0/ShowRatesCommand.java index 0db9088efd..dc10109280 100644 --- a/src/client/command/commands/gm0/ShowRatesCommand.java +++ b/src/client/command/commands/gm0/ShowRatesCommand.java @@ -26,6 +26,7 @@ package client.command.commands.gm0; import client.MapleCharacter; import client.command.Command; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; public class ShowRatesCommand extends Command { @@ -60,7 +61,7 @@ public class ShowRatesCommand extends Command { if(player.getCouponDropRate() != 1) showMsg += "Coupon DROP Rate: #k" + player.getCouponDropRate() + "x#k" + "\r\n"; showMsg += "BOSS DROP Rate: #e#b" + player.getBossDropRate() + "x#k#n" + "\r\n"; - if(ServerConstants.USE_QUEST_RATE) { + if(YamlConfig.config.server.USE_QUEST_RATE) { showMsg += "\r\n" + "#eQUEST RATE#n" + "\r\n"; showMsg += "World QUEST Rate: #e#b" + c.getWorldServer().getQuestRate() + "x#k#n" + "\r\n"; } diff --git a/src/client/command/commands/gm0/StatDexCommand.java b/src/client/command/commands/gm0/StatDexCommand.java index 8bd0fd97d6..8dafe4c6b2 100644 --- a/src/client/command/commands/gm0/StatDexCommand.java +++ b/src/client/command/commands/gm0/StatDexCommand.java @@ -26,6 +26,7 @@ package client.command.commands.gm0; import client.MapleCharacter; import client.MapleClient; import client.command.Command; +import config.YamlConfig; import constants.ServerConstants; public class StatDexCommand extends Command { @@ -47,10 +48,10 @@ public class StatDexCommand extends Command { return; } } else { - amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getDex()); + amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getDex()); } if (!player.assignDex(Math.max(amount, 0))) { - player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute."); + player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute."); } } } diff --git a/src/client/command/commands/gm0/StatIntCommand.java b/src/client/command/commands/gm0/StatIntCommand.java index f28233636f..1c9e0bfeae 100644 --- a/src/client/command/commands/gm0/StatIntCommand.java +++ b/src/client/command/commands/gm0/StatIntCommand.java @@ -26,6 +26,7 @@ package client.command.commands.gm0; import client.command.Command; import client.MapleClient; import client.MapleCharacter; +import config.YamlConfig; import constants.ServerConstants; public class StatIntCommand extends Command { @@ -47,10 +48,10 @@ public class StatIntCommand extends Command { return; } } else { - amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getInt()); + amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getInt()); } if (!player.assignInt(Math.max(amount, 0))) { - player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute."); + player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute."); } } } diff --git a/src/client/command/commands/gm0/StatLukCommand.java b/src/client/command/commands/gm0/StatLukCommand.java index 1ec1ae8366..8d1719e9ad 100644 --- a/src/client/command/commands/gm0/StatLukCommand.java +++ b/src/client/command/commands/gm0/StatLukCommand.java @@ -26,6 +26,7 @@ package client.command.commands.gm0; import client.MapleCharacter; import client.MapleClient; import client.command.Command; +import config.YamlConfig; import constants.ServerConstants; public class StatLukCommand extends Command { @@ -47,10 +48,10 @@ public class StatLukCommand extends Command { return; } } else { - amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getLuk()); + amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getLuk()); } if (!player.assignLuk(Math.max(amount, 0))) { - player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute."); + player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute."); } } } diff --git a/src/client/command/commands/gm0/StatStrCommand.java b/src/client/command/commands/gm0/StatStrCommand.java index 512ea226a4..3ab139946b 100644 --- a/src/client/command/commands/gm0/StatStrCommand.java +++ b/src/client/command/commands/gm0/StatStrCommand.java @@ -26,6 +26,7 @@ package client.command.commands.gm0; import client.command.Command; import client.MapleClient; import client.MapleCharacter; +import config.YamlConfig; import constants.ServerConstants; public class StatStrCommand extends Command { @@ -46,11 +47,11 @@ public class StatStrCommand extends Command { return; } } else { - amount = Math.min(remainingAp, ServerConstants.MAX_AP - player.getStr()); + amount = Math.min(remainingAp, YamlConfig.config.server.MAX_AP - player.getStr()); } if (!player.assignStr(Math.max(amount, 0))) { - player.dropMessage("Please make sure your AP is not over " + ServerConstants.MAX_AP + " and you have enough to distribute."); + player.dropMessage("Please make sure your AP is not over " + YamlConfig.config.server.MAX_AP + " and you have enough to distribute."); } } } diff --git a/src/client/command/commands/gm2/ApCommand.java b/src/client/command/commands/gm2/ApCommand.java index aaecf00dff..e78512317f 100644 --- a/src/client/command/commands/gm2/ApCommand.java +++ b/src/client/command/commands/gm2/ApCommand.java @@ -26,6 +26,7 @@ package client.command.commands.gm2; import client.command.Command; import client.MapleClient; import client.MapleCharacter; +import config.YamlConfig; import constants.ServerConstants; public class ApCommand extends Command { @@ -44,7 +45,7 @@ public class ApCommand extends Command { if (params.length < 2) { int newAp = Integer.parseInt(params[0]); if (newAp < 0) newAp = 0; - else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP; + else if (newAp > YamlConfig.config.server.MAX_AP) newAp = YamlConfig.config.server.MAX_AP; player.changeRemainingAp(newAp, false); } else { @@ -52,7 +53,7 @@ public class ApCommand extends Command { if (victim != null) { int newAp = Integer.parseInt(params[1]); if (newAp < 0) newAp = 0; - else if (newAp > ServerConstants.MAX_AP) newAp = ServerConstants.MAX_AP; + else if (newAp > YamlConfig.config.server.MAX_AP) newAp = YamlConfig.config.server.MAX_AP; victim.changeRemainingAp(newAp, false); } else { diff --git a/src/client/command/commands/gm2/ItemCommand.java b/src/client/command/commands/gm2/ItemCommand.java index e59df0d908..47463cb3c5 100644 --- a/src/client/command/commands/gm2/ItemCommand.java +++ b/src/client/command/commands/gm2/ItemCommand.java @@ -28,6 +28,7 @@ import client.MapleClient; import client.MapleCharacter; import client.inventory.MaplePet; import client.inventory.manipulator.MapleInventoryManipulator; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; import server.MapleItemInformationProvider; @@ -57,7 +58,7 @@ public class ItemCommand extends Command { short quantity = 1; if(params.length >= 2) quantity = Short.parseShort(params[1]); - if (ServerConstants.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) { + if (YamlConfig.config.server.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) { player.yellowMessage("You cannot create a cash item with this command."); return; } diff --git a/src/client/command/commands/gm2/ItemDropCommand.java b/src/client/command/commands/gm2/ItemDropCommand.java index 2185fd7df5..f94d79f27b 100644 --- a/src/client/command/commands/gm2/ItemDropCommand.java +++ b/src/client/command/commands/gm2/ItemDropCommand.java @@ -29,6 +29,7 @@ import client.MapleCharacter; import client.inventory.Item; import client.inventory.MapleInventoryType; import client.inventory.MaplePet; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; import server.MapleItemInformationProvider; @@ -58,7 +59,7 @@ public class ItemDropCommand extends Command { short quantity = 1; if(params.length >= 2) quantity = Short.parseShort(params[1]); - if (ServerConstants.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) { + if (YamlConfig.config.server.BLOCK_GENERATE_CASH_ITEM && ii.isCash(itemId)) { player.yellowMessage("You cannot create a cash item with this command."); return; } diff --git a/src/client/command/commands/gm2/LevelCommand.java b/src/client/command/commands/gm2/LevelCommand.java index e0b0b7392e..4b51b80404 100644 --- a/src/client/command/commands/gm2/LevelCommand.java +++ b/src/client/command/commands/gm2/LevelCommand.java @@ -26,6 +26,7 @@ package client.command.commands.gm2; import client.command.Command; import client.MapleClient; import client.MapleCharacter; +import config.YamlConfig; import constants.ServerConstants; public class LevelCommand extends Command { @@ -45,7 +46,7 @@ public class LevelCommand extends Command { player.setLevel(Math.min(Integer.parseInt(params[0]), player.getMaxClassLevel()) - 1); player.resetPlayerRates(); - if (ServerConstants.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates(); + if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates(); player.setWorldRates(); player.levelUp(false); diff --git a/src/client/command/commands/gm2/MaxStatCommand.java b/src/client/command/commands/gm2/MaxStatCommand.java index af770b4fe2..0136d4687a 100644 --- a/src/client/command/commands/gm2/MaxStatCommand.java +++ b/src/client/command/commands/gm2/MaxStatCommand.java @@ -27,6 +27,7 @@ import client.MapleStat; import client.command.Command; import client.MapleClient; import client.MapleCharacter; +import config.YamlConfig; import constants.ServerConstants; public class MaxStatCommand extends Command { @@ -40,7 +41,7 @@ public class MaxStatCommand extends Command { player.loseExp(player.getExp(), false, false); player.setLevel(255); player.resetPlayerRates(); - if (ServerConstants.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates(); + if (YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL) player.setPlayerRates(); player.setWorldRates(); player.updateStrDexIntLuk(Short.MAX_VALUE); player.setFame(13337); diff --git a/src/client/command/commands/gm2/SpCommand.java b/src/client/command/commands/gm2/SpCommand.java index 5b217b62c4..eb890b8a29 100644 --- a/src/client/command/commands/gm2/SpCommand.java +++ b/src/client/command/commands/gm2/SpCommand.java @@ -26,6 +26,7 @@ package client.command.commands.gm2; import client.command.Command; import client.MapleClient; import client.MapleCharacter; +import config.YamlConfig; import constants.ServerConstants; public class SpCommand extends Command { @@ -44,7 +45,7 @@ public class SpCommand extends Command { if (params.length == 1) { int newSp = Integer.parseInt(params[0]); if (newSp < 0) newSp = 0; - else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP; + else if (newSp > YamlConfig.config.server.MAX_AP) newSp = YamlConfig.config.server.MAX_AP; player.updateRemainingSp(newSp); } else { @@ -52,7 +53,7 @@ public class SpCommand extends Command { if (victim != null) { int newSp = Integer.parseInt(params[1]); if (newSp < 0) newSp = 0; - else if (newSp > ServerConstants.MAX_AP) newSp = ServerConstants.MAX_AP; + else if (newSp > YamlConfig.config.server.MAX_AP) newSp = YamlConfig.config.server.MAX_AP; victim.updateRemainingSp(newSp); diff --git a/src/client/command/commands/gm5/SetCommand.java b/src/client/command/commands/gm5/SetCommand.java index 7614189753..0de439bcee 100644 --- a/src/client/command/commands/gm5/SetCommand.java +++ b/src/client/command/commands/gm5/SetCommand.java @@ -25,6 +25,7 @@ package client.command.commands.gm5; import client.command.Command; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; public class SetCommand extends Command { @@ -35,7 +36,7 @@ public class SetCommand extends Command { @Override public void execute(MapleClient c, String[] params) { for (int i = 0; i < params.length; i++) { - ServerConstants.DEBUG_VALUES[i] = Integer.parseInt(params[i]); + YamlConfig.config.server.DEBUG_VALUES[i] = Integer.parseInt(params[i]); } } } diff --git a/src/client/command/commands/gm5/ShowMoveLifeCommand.java b/src/client/command/commands/gm5/ShowMoveLifeCommand.java index 291c1f63ab..df014eb882 100644 --- a/src/client/command/commands/gm5/ShowMoveLifeCommand.java +++ b/src/client/command/commands/gm5/ShowMoveLifeCommand.java @@ -25,6 +25,7 @@ package client.command.commands.gm5; import client.command.Command; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; public class ShowMoveLifeCommand extends Command { @@ -34,6 +35,6 @@ public class ShowMoveLifeCommand extends Command { @Override public void execute(MapleClient c, String[] params) { - ServerConstants.USE_DEBUG_SHOW_RCVD_MVLIFE = !ServerConstants.USE_DEBUG_SHOW_RCVD_MVLIFE; + YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_MVLIFE = !YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_MVLIFE; } } diff --git a/src/client/command/commands/gm5/ShowPacketsCommand.java b/src/client/command/commands/gm5/ShowPacketsCommand.java index ff1798cc85..2d6ebce1dc 100644 --- a/src/client/command/commands/gm5/ShowPacketsCommand.java +++ b/src/client/command/commands/gm5/ShowPacketsCommand.java @@ -25,6 +25,7 @@ package client.command.commands.gm5; import client.command.Command; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; public class ShowPacketsCommand extends Command { @@ -34,6 +35,6 @@ public class ShowPacketsCommand extends Command { @Override public void execute(MapleClient c, String[] params) { - ServerConstants.USE_DEBUG_SHOW_RCVD_PACKET = !ServerConstants.USE_DEBUG_SHOW_RCVD_PACKET; + YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_PACKET = !YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_PACKET; } } diff --git a/src/client/command/commands/gm6/SupplyRateCouponCommand.java b/src/client/command/commands/gm6/SupplyRateCouponCommand.java index 17a4defbab..10ac8be42b 100644 --- a/src/client/command/commands/gm6/SupplyRateCouponCommand.java +++ b/src/client/command/commands/gm6/SupplyRateCouponCommand.java @@ -22,6 +22,7 @@ package client.command.commands.gm6; import client.MapleCharacter; import client.MapleClient; import client.command.Command; +import config.YamlConfig; import constants.ServerConstants; public class SupplyRateCouponCommand extends Command { @@ -37,7 +38,7 @@ public class SupplyRateCouponCommand extends Command { return; } - ServerConstants.USE_SUPPLY_RATE_COUPONS = params[0].compareToIgnoreCase("no") != 0; - player.dropMessage(5, "Rate coupons are now " + (ServerConstants.USE_SUPPLY_RATE_COUPONS ? "enabled" : "disabled") + " for purchase at the Cash Shop."); + YamlConfig.config.server.USE_SUPPLY_RATE_COUPONS = params[0].compareToIgnoreCase("no") != 0; + player.dropMessage(5, "Rate coupons are now " + (YamlConfig.config.server.USE_SUPPLY_RATE_COUPONS ? "enabled" : "disabled") + " for purchase at the Cash Shop."); } } diff --git a/src/client/creator/CharacterFactory.java b/src/client/creator/CharacterFactory.java index 4aa0da0e24..54721932fb 100644 --- a/src/client/creator/CharacterFactory.java +++ b/src/client/creator/CharacterFactory.java @@ -25,6 +25,7 @@ import client.MapleSkinColor; import client.inventory.Item; import client.inventory.MapleInventory; import client.inventory.MapleInventoryType; +import config.YamlConfig; import constants.ServerConstants; import net.server.Server; import server.MapleItemInformationProvider; @@ -38,7 +39,7 @@ import tools.MaplePacketCreator; public abstract class CharacterFactory { protected synchronized static int createNewCharacter(MapleClient c, String name, int face, int hair, int skin, int gender, CharacterFactoryRecipe recipe) { - if (ServerConstants.COLLECTIVE_CHARSLOT ? c.getAvailableCharacterSlots() <= 0 : c.getAvailableCharacterWorldSlots() <= 0) { + if (YamlConfig.config.server.COLLECTIVE_CHARSLOT ? c.getAvailableCharacterSlots() <= 0 : c.getAvailableCharacterWorldSlots() <= 0) { return -3; } diff --git a/src/client/creator/CharacterFactoryRecipe.java b/src/client/creator/CharacterFactoryRecipe.java index 74d73f001b..8d121558f8 100644 --- a/src/client/creator/CharacterFactoryRecipe.java +++ b/src/client/creator/CharacterFactoryRecipe.java @@ -23,6 +23,7 @@ import client.MapleJob; import client.Skill; import client.inventory.Item; import client.inventory.MapleInventoryType; +import config.YamlConfig; import constants.ServerConstants; import java.util.concurrent.atomic.AtomicInteger; import java.util.LinkedHashMap; @@ -56,8 +57,8 @@ public class CharacterFactoryRecipe { this.shoes = shoes; this.weapon = weapon; - if (!ServerConstants.USE_STARTING_AP_4) { - if (ServerConstants.USE_AUTOASSIGN_STARTERS_AP) { + if (!YamlConfig.config.server.USE_STARTING_AP_4) { + if (YamlConfig.config.server.USE_AUTOASSIGN_STARTERS_AP) { str = 12; dex = 5; } else { diff --git a/src/client/inventory/Equip.java b/src/client/inventory/Equip.java index 93f9ff0387..f78755ff59 100644 --- a/src/client/inventory/Equip.java +++ b/src/client/inventory/Equip.java @@ -22,6 +22,7 @@ package client.inventory; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; import constants.ExpTable; import constants.ItemConstants; @@ -279,7 +280,7 @@ public class Equip extends Item { private static int getStatModifier(boolean isAttribute) { // each set of stat points grants a chance for a bonus stat point upgrade at equip level up. - if(ServerConstants.USE_EQUIPMNT_LVLUP_POWER) { + if(YamlConfig.config.server.USE_EQUIPMNT_LVLUP_POWER) { if(isAttribute) return 2; else return 4; } @@ -290,7 +291,7 @@ public class Equip extends Item { } private static int randomizeStatUpgrade(int top) { - int limit = Math.min(top, ServerConstants.MAX_EQUIPMNT_LVLUP_STAT_UP); + int limit = Math.min(top, YamlConfig.config.server.MAX_EQUIPMNT_LVLUP_STAT_UP); int poolCount = (limit * (limit + 1) / 2) + limit; int rnd = Randomizer.rand(0, poolCount); @@ -383,7 +384,7 @@ public class Equip extends Item { public Pair> gainStats(List> stats) { boolean gotSlot = false, gotVicious = false; String lvupStr = ""; - Integer statUp, maxStat = ServerConstants.MAX_EQUIPMNT_STAT; + Integer statUp, maxStat = YamlConfig.config.server.MAX_EQUIPMNT_STAT; for (Pair stat : stats) { switch (stat.getLeft()) { case incDEX: @@ -483,7 +484,7 @@ public class Equip extends Item { } if(!stats.isEmpty()) { - if(ServerConstants.USE_EQUIPMNT_LVLUP_SLOTS) { + if(YamlConfig.config.server.USE_EQUIPMNT_LVLUP_SLOTS) { if(vicious > 0) getUnitSlotUpgrade(stats, StatUpgrade.incVicious); getUnitSlotUpgrade(stats, StatUpgrade.incSlot); } @@ -491,7 +492,7 @@ public class Equip extends Item { isUpgradeable = false; improveDefaultStats(stats); - if(ServerConstants.USE_EQUIPMNT_LVLUP_SLOTS) { + if(YamlConfig.config.server.USE_EQUIPMNT_LVLUP_SLOTS) { if(vicious > 0) getUnitSlotUpgrade(stats, StatUpgrade.incVicious); getUnitSlotUpgrade(stats, StatUpgrade.incSlot); } @@ -499,7 +500,7 @@ public class Equip extends Item { if(isUpgradeable) { while(stats.isEmpty()) { improveDefaultStats(stats); - if(ServerConstants.USE_EQUIPMNT_LVLUP_SLOTS) { + if(YamlConfig.config.server.USE_EQUIPMNT_LVLUP_SLOTS) { if(vicious > 0) getUnitSlotUpgrade(stats, StatUpgrade.incVicious); getUnitSlotUpgrade(stats, StatUpgrade.incSlot); } @@ -563,14 +564,14 @@ public class Equip extends Item { return; } - int equipMaxLevel = Math.min(30, Math.max(ii.getEquipLevel(this.getItemId(), true), ServerConstants.USE_EQUIPMNT_LVLUP)); + int equipMaxLevel = Math.min(30, Math.max(ii.getEquipLevel(this.getItemId(), true), YamlConfig.config.server.USE_EQUIPMNT_LVLUP)); if (itemLevel >= equipMaxLevel) { return; } int reqLevel = ii.getEquipLevelReq(this.getItemId()); - float masteryModifier = (float)(ServerConstants.EQUIP_EXP_RATE * ExpTable.getExpNeededForLevel(1)) / (float)normalizedMasteryExp(reqLevel); + float masteryModifier = (float)(YamlConfig.config.server.EQUIP_EXP_RATE * ExpTable.getExpNeededForLevel(1)) / (float)normalizedMasteryExp(reqLevel); float elementModifier = (isElemental) ? 0.85f : 0.6f; float baseExpGain = gain * elementModifier * masteryModifier; @@ -578,7 +579,7 @@ public class Equip extends Item { itemExp += baseExpGain; int expNeeded = ExpTable.getEquipExpNeededForLevel(itemLevel); - if(ServerConstants.USE_DEBUG_SHOW_INFO_EQPEXP) System.out.println("'" + ii.getName(this.getItemId()) + "' -> EXP Gain: " + gain + " Mastery: " + masteryModifier + " Base gain: " + baseExpGain + " exp: " + itemExp + " / " + expNeeded + ", Kills TNL: " + expNeeded / (baseExpGain / c.getPlayer().getExpRate())); + if(YamlConfig.config.server.USE_DEBUG_SHOW_INFO_EQPEXP) System.out.println("'" + ii.getName(this.getItemId()) + "' -> EXP Gain: " + gain + " Mastery: " + masteryModifier + " Base gain: " + baseExpGain + " exp: " + itemExp + " / " + expNeeded + ", Kills TNL: " + expNeeded / (baseExpGain / c.getPlayer().getExpRate())); if (itemExp >= expNeeded) { while(itemExp >= expNeeded) { @@ -595,7 +596,7 @@ public class Equip extends Item { } c.getPlayer().forceUpdateItem(this); - //if(ServerConstants.USE_DEBUG) c.getPlayer().dropMessage("'" + ii.getName(this.getItemId()) + "': " + itemExp + " / " + expNeeded); + //if(YamlConfig.config.server.USE_DEBUG) c.getPlayer().dropMessage("'" + ii.getName(this.getItemId()) + "': " + itemExp + " / " + expNeeded); } private boolean reachedMaxLevel() { @@ -605,7 +606,7 @@ public class Equip extends Item { } } - return itemLevel >= ServerConstants.USE_EQUIPMNT_LVLUP; + return itemLevel >= YamlConfig.config.server.USE_EQUIPMNT_LVLUP; } public String showEquipFeatures(MapleClient c) { diff --git a/src/client/inventory/manipulator/MapleInventoryManipulator.java b/src/client/inventory/manipulator/MapleInventoryManipulator.java index 5a9247af51..036bb74f8b 100644 --- a/src/client/inventory/manipulator/MapleInventoryManipulator.java +++ b/src/client/inventory/manipulator/MapleInventoryManipulator.java @@ -31,6 +31,7 @@ import client.inventory.MapleInventoryType; import client.inventory.MaplePet; import client.inventory.ModifyInventory; import client.newyear.NewYearCardRecord; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; @@ -689,9 +690,9 @@ public class MapleInventoryManipulator { if (ii.isDropRestricted(it.getItemId())) { return true; } else if (ii.isCash(it.getItemId())) { - if (ServerConstants.USE_ENFORCE_UNMERCHABLE_CASH) { // thanks Ari for noticing cash drops not available server-side + if (YamlConfig.config.server.USE_ENFORCE_UNMERCHABLE_CASH) { // thanks Ari for noticing cash drops not available server-side return true; - } else if (ItemConstants.isPet(it.getItemId()) && ServerConstants.USE_ENFORCE_UNMERCHABLE_PET) { + } else if (ItemConstants.isPet(it.getItemId()) && YamlConfig.config.server.USE_ENFORCE_UNMERCHABLE_PET) { return true; } } else if (isDroppedItemRestricted(it)) { @@ -802,7 +803,7 @@ public class MapleInventoryManipulator { } private static boolean isDroppedItemRestricted(Item it) { - return ServerConstants.USE_ERASE_UNTRADEABLE_DROP && it.isUntradeable(); + return YamlConfig.config.server.USE_ERASE_UNTRADEABLE_DROP && it.isUntradeable(); } public static boolean isSandboxItem(Item it) { diff --git a/src/client/processor/AssignAPProcessor.java b/src/client/processor/AssignAPProcessor.java index 30fe248e21..9ba1c9fed1 100644 --- a/src/client/processor/AssignAPProcessor.java +++ b/src/client/processor/AssignAPProcessor.java @@ -33,6 +33,7 @@ import client.autoban.AutobanFactory; import client.inventory.Equip; import client.inventory.Item; import client.inventory.MapleInventoryType; +import config.YamlConfig; import constants.ServerConstants; import constants.skills.BlazeWizard; import constants.skills.Brawler; @@ -70,7 +71,7 @@ public class AssignAPProcessor { int remainingAp = chr.getRemainingAp(); slea.skip(8); - if(ServerConstants.USE_SERVER_AUTOASSIGNER) { + if(YamlConfig.config.server.USE_SERVER_AUTOASSIGNER) { // --------- Ronan Lana's AUTOASSIGNER --------- // This method excels for assigning APs in such a way to cover all equipments AP requirements. byte opt = slea.readByte(); // useful for pirate autoassigning @@ -135,7 +136,7 @@ public class AssignAPProcessor { luk = scStat; str = 0; dex = 0; - if(ServerConstants.USE_AUTOASSIGN_SECONDARY_CAP && luk + chr.getLuk() > CAP) { + if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && luk + chr.getLuk() > CAP) { temp = luk + chr.getLuk() - CAP; scStat -= temp; prStat += temp; @@ -161,7 +162,7 @@ public class AssignAPProcessor { str = scStat; int_ = 0; luk = 0; - if(ServerConstants.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) { + if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) { temp = str + chr.getStr() - CAP; scStat -= temp; prStat += temp; @@ -187,7 +188,7 @@ public class AssignAPProcessor { str = scStat; int_ = 0; luk = 0; - if(ServerConstants.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) { + if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) { temp = str + chr.getStr() - CAP; scStat -= temp; prStat += temp; @@ -241,12 +242,12 @@ public class AssignAPProcessor { str = trStat; int_ = 0; - if(ServerConstants.USE_AUTOASSIGN_SECONDARY_CAP && dex + chr.getDex() > CAP) { + if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && dex + chr.getDex() > CAP) { temp = dex + chr.getDex() - CAP; scStat -= temp; prStat += temp; } - if(ServerConstants.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) { + if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && str + chr.getStr() > CAP) { temp = str + chr.getStr() - CAP; trStat -= temp; prStat += temp; @@ -313,7 +314,7 @@ public class AssignAPProcessor { dex = scStat; int_ = 0; luk = 0; - if(ServerConstants.USE_AUTOASSIGN_SECONDARY_CAP && dex + chr.getDex() > CAP) { + if(YamlConfig.config.server.USE_AUTOASSIGN_SECONDARY_CAP && dex + chr.getDex() > CAP) { temp = dex + chr.getDex() - CAP; scStat -= temp; prStat += temp; @@ -387,44 +388,44 @@ public class AssignAPProcessor { int newVal = 0; if (type.equals(MapleStat.STR)) { newVal = statUpdate[0] + gain; - if (newVal > ServerConstants.MAX_AP) { - statGain[0] += (gain - (newVal - ServerConstants.MAX_AP)); - statUpdate[0] = ServerConstants.MAX_AP; + if (newVal > YamlConfig.config.server.MAX_AP) { + statGain[0] += (gain - (newVal - YamlConfig.config.server.MAX_AP)); + statUpdate[0] = YamlConfig.config.server.MAX_AP; } else { statGain[0] += gain; statUpdate[0] = newVal; } } else if (type.equals(MapleStat.INT)) { newVal = statUpdate[3] + gain; - if (newVal > ServerConstants.MAX_AP) { - statGain[3] += (gain - (newVal - ServerConstants.MAX_AP)); - statUpdate[3] = ServerConstants.MAX_AP; + if (newVal > YamlConfig.config.server.MAX_AP) { + statGain[3] += (gain - (newVal - YamlConfig.config.server.MAX_AP)); + statUpdate[3] = YamlConfig.config.server.MAX_AP; } else { statGain[3] += gain; statUpdate[3] = newVal; } } else if (type.equals(MapleStat.LUK)) { newVal = statUpdate[2] + gain; - if (newVal > ServerConstants.MAX_AP) { - statGain[2] += (gain - (newVal - ServerConstants.MAX_AP)); - statUpdate[2] = ServerConstants.MAX_AP; + if (newVal > YamlConfig.config.server.MAX_AP) { + statGain[2] += (gain - (newVal - YamlConfig.config.server.MAX_AP)); + statUpdate[2] = YamlConfig.config.server.MAX_AP; } else { statGain[2] += gain; statUpdate[2] = newVal; } } else if (type.equals(MapleStat.DEX)) { newVal = statUpdate[1] + gain; - if (newVal > ServerConstants.MAX_AP) { - statGain[1] += (gain - (newVal - ServerConstants.MAX_AP)); - statUpdate[1] = ServerConstants.MAX_AP; + if (newVal > YamlConfig.config.server.MAX_AP) { + statGain[1] += (gain - (newVal - YamlConfig.config.server.MAX_AP)); + statUpdate[1] = YamlConfig.config.server.MAX_AP; } else { statGain[1] += gain; statUpdate[1] = newVal; } } - if (newVal > ServerConstants.MAX_AP) { - return newVal - ServerConstants.MAX_AP; + if (newVal > YamlConfig.config.server.MAX_AP) { + return newVal - YamlConfig.config.server.MAX_AP; } return 0; } @@ -489,7 +490,7 @@ public class AssignAPProcessor { } break; case 2048: // HP - if(ServerConstants.USE_ENFORCE_HPMP_SWAP) { + if(YamlConfig.config.server.USE_ENFORCE_HPMP_SWAP) { if (APTo != 8192) { player.message("You can only swap HP ability points to MP."); c.announce(MaplePacketCreator.enableActions()); @@ -514,13 +515,13 @@ public class AssignAPProcessor { int curHp = player.getHp(); int hplose = -takeHp(player.getJob()); player.assignHP(hplose, -1); - if (!ServerConstants.USE_FIXED_RATIO_HPMP_UPDATE) { + if (!YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) { player.updateHp(Math.max(1, curHp + hplose)); } break; case 8192: // MP - if(ServerConstants.USE_ENFORCE_HPMP_SWAP) { + if(YamlConfig.config.server.USE_ENFORCE_HPMP_SWAP) { if (APTo != 2048) { player.message("You can only swap MP ability points to HP."); c.announce(MaplePacketCreator.enableActions()); @@ -558,7 +559,7 @@ public class AssignAPProcessor { int curMp = player.getMp(); int mplose = -takeMp(job); player.assignMP(mplose, -1); - if (!ServerConstants.USE_FIXED_RATIO_HPMP_UPDATE) { + if (!YamlConfig.config.server.USE_FIXED_RATIO_HPMP_UPDATE) { player.updateMp(Math.max(0, curMp + mplose)); } break; @@ -647,7 +648,7 @@ public class AssignAPProcessor { MaxHP += increaseHP.getEffect(sLvl).getY(); } - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if (usedAPReset) { MaxHP += 20; } else { @@ -657,7 +658,7 @@ public class AssignAPProcessor { MaxHP += 20; } } else if(job.isA(MapleJob.ARAN1)) { - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if (usedAPReset) { MaxHP += 20; } else { @@ -667,7 +668,7 @@ public class AssignAPProcessor { MaxHP += 28; } } else if (job.isA(MapleJob.MAGICIAN) || job.isA(MapleJob.BLAZEWIZARD1)) { - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if (usedAPReset) { MaxHP += 6; } else { @@ -677,7 +678,7 @@ public class AssignAPProcessor { MaxHP += 6; } } else if (job.isA(MapleJob.THIEF) || job.isA(MapleJob.NIGHTWALKER1)) { - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if (usedAPReset) { MaxHP += 16; } else { @@ -687,7 +688,7 @@ public class AssignAPProcessor { MaxHP += 16; } } else if(job.isA(MapleJob.BOWMAN) || job.isA(MapleJob.WINDARCHER1)) { - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if (usedAPReset) { MaxHP += 16; } else { @@ -705,7 +706,7 @@ public class AssignAPProcessor { MaxHP += increaseHP.getEffect(sLvl).getY(); } - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if (usedAPReset) { MaxHP += 18; } else { @@ -717,7 +718,7 @@ public class AssignAPProcessor { } else if (usedAPReset) { MaxHP += 8; } else { - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { MaxHP += Randomizer.rand(8, 12); } else { MaxHP += 10; @@ -732,7 +733,7 @@ public class AssignAPProcessor { int MaxMP = 0; if (job.isA(MapleJob.WARRIOR) || job.isA(MapleJob.DAWNWARRIOR1) || job.isA(MapleJob.ARAN1)) { - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if(!usedAPReset) { MaxMP += (Randomizer.rand(2, 4) + (player.getInt() / 10)); } else { @@ -750,7 +751,7 @@ public class AssignAPProcessor { MaxMP += increaseMP.getEffect(sLvl).getY(); } - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if(!usedAPReset) { MaxMP += (Randomizer.rand(12, 16) + (player.getInt() / 20)); } else { @@ -760,7 +761,7 @@ public class AssignAPProcessor { MaxMP += 18; } } else if (job.isA(MapleJob.BOWMAN) || job.isA(MapleJob.WINDARCHER1)) { - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if(!usedAPReset) { MaxMP += (Randomizer.rand(6, 8) + (player.getInt() / 10)); } else { @@ -770,7 +771,7 @@ public class AssignAPProcessor { MaxMP += 10; } } else if(job.isA(MapleJob.THIEF) || job.isA(MapleJob.NIGHTWALKER1)) { - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if(!usedAPReset) { MaxMP += (Randomizer.rand(6, 8) + (player.getInt() / 10)); } else { @@ -780,7 +781,7 @@ public class AssignAPProcessor { MaxMP += 10; } } else if (job.isA(MapleJob.PIRATE) || job.isA(MapleJob.THUNDERBREAKER1)) { - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if(!usedAPReset) { MaxMP += (Randomizer.rand(7, 9) + (player.getInt() / 10)); } else { @@ -790,7 +791,7 @@ public class AssignAPProcessor { MaxMP += 14; } } else { - if(ServerConstants.USE_RANDOMIZE_HPMP_GAIN) { + if(YamlConfig.config.server.USE_RANDOMIZE_HPMP_GAIN) { if(!usedAPReset) { MaxMP += (Randomizer.rand(4, 6) + (player.getInt() / 10)); } else { diff --git a/src/client/processor/DueyProcessor.java b/src/client/processor/DueyProcessor.java index d629e565c2..9630ddba57 100644 --- a/src/client/processor/DueyProcessor.java +++ b/src/client/processor/DueyProcessor.java @@ -32,6 +32,7 @@ import client.inventory.MapleInventory; import client.inventory.MapleInventoryType; import client.inventory.manipulator.MapleInventoryManipulator; import client.inventory.manipulator.MapleKarmaManipulator; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; import java.sql.Connection; @@ -501,7 +502,7 @@ public class DueyProcessor { if (c.tryacquireClient()) { try { long timeNow = System.currentTimeMillis(); - if(timeNow - c.getPlayer().getNpcCooldown() < ServerConstants.BLOCK_NPC_RACE_CONDT) { + if(timeNow - c.getPlayer().getNpcCooldown() < YamlConfig.config.server.BLOCK_NPC_RACE_CONDT) { c.announce(MaplePacketCreator.enableActions()); return; } diff --git a/src/client/processor/MakerProcessor.java b/src/client/processor/MakerProcessor.java index 7c4ec841dc..fc48e30615 100644 --- a/src/client/processor/MakerProcessor.java +++ b/src/client/processor/MakerProcessor.java @@ -24,6 +24,7 @@ import client.MapleCharacter; import client.inventory.Equip; import client.inventory.Item; import client.inventory.MapleInventoryType; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; import client.inventory.manipulator.MapleInventoryManipulator; @@ -238,7 +239,7 @@ public class MakerProcessor { Map reagentType = new LinkedHashMap<>(); List toRemove = new LinkedList<>(); - boolean isWeapon = ItemConstants.isWeapon(toCreate) || ServerConstants.USE_MAKER_PERMISSIVE_ATKUP; // thanks Vcoc for finding a case where a weapon wouldn't be counted as such due to a bounding on isWeapon + boolean isWeapon = ItemConstants.isWeapon(toCreate) || YamlConfig.config.server.USE_MAKER_PERMISSIVE_ATKUP; // thanks Vcoc for finding a case where a weapon wouldn't be counted as such due to a bounding on isWeapon for(Map.Entry r : reagentids.entrySet()) { int curRid = r.getKey(); @@ -371,8 +372,8 @@ public class MakerProcessor { Equip eqp = (Equip)item; if(ItemConstants.isAccessory(item.getItemId()) && eqp.getUpgradeSlots() <= 0) eqp.setUpgradeSlots(3); - if(ServerConstants.USE_ENHANCED_CRAFTING == true) { - if(!(c.getPlayer().isGM() && ServerConstants.USE_PERFECT_GM_SCROLL)) { + if(YamlConfig.config.server.USE_ENHANCED_CRAFTING == true) { + if(!(c.getPlayer().isGM() && YamlConfig.config.server.USE_PERFECT_GM_SCROLL)) { eqp.setUpgradeSlots((byte)(eqp.getUpgradeSlots() + 1)); } item = MapleItemInformationProvider.getInstance().scrollEquipWithId(eqp, 2049100, true, 2049100, c.getPlayer().isGM()); diff --git a/src/client/processor/PetAutopotProcessor.java b/src/client/processor/PetAutopotProcessor.java index faaf04912a..bca2d0e3a3 100644 --- a/src/client/processor/PetAutopotProcessor.java +++ b/src/client/processor/PetAutopotProcessor.java @@ -27,6 +27,7 @@ import client.inventory.Item; import client.inventory.MapleInventory; import client.inventory.MapleInventoryType; import client.inventory.manipulator.MapleInventoryManipulator; +import config.YamlConfig; import constants.ServerConstants; import java.util.List; import server.MapleItemInformationProvider; @@ -125,13 +126,13 @@ public class PetAutopotProcessor { incMp = stat.getMp(); if(incMp <= 0 && hasMpGain) incMp = Math.ceil(maxMp * stat.getMpRate()); - if (ServerConstants.USE_COMPULSORY_AUTOPOT) { + if (YamlConfig.config.server.USE_COMPULSORY_AUTOPOT) { if (hasHpGain) { - qtyCount = (int) Math.ceil(((ServerConstants.PET_AUTOHP_RATIO * maxHp) - curHp) / incHp); + qtyCount = (int) Math.ceil(((YamlConfig.config.server.PET_AUTOHP_RATIO * maxHp) - curHp) / incHp); } if (hasMpGain) { - qtyCount = Math.max(qtyCount, (int) Math.ceil(((ServerConstants.PET_AUTOMP_RATIO * maxMp) - curMp) / incMp)); + qtyCount = Math.max(qtyCount, (int) Math.ceil(((YamlConfig.config.server.PET_AUTOMP_RATIO * maxMp) - curMp) / incMp)); } } else { qtyCount = 1; // non-compulsory autopot concept thanks to marcuswoon diff --git a/src/client/processor/StorageProcessor.java b/src/client/processor/StorageProcessor.java index d465d184f7..f900b676a5 100644 --- a/src/client/processor/StorageProcessor.java +++ b/src/client/processor/StorageProcessor.java @@ -28,6 +28,7 @@ import client.inventory.Item; import client.inventory.MapleInventory; import client.inventory.MapleInventoryType; import client.inventory.manipulator.MapleKarmaManipulator; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; import client.inventory.manipulator.MapleInventoryManipulator; @@ -167,7 +168,7 @@ public class StorageProcessor { storage.sendStored(c, ItemConstants.getInventoryType(itemId)); } } else if (mode == 6) { // arrange items - if(ServerConstants.USE_STORAGE_ITEM_SORT) storage.arrangeItems(c); + if(YamlConfig.config.server.USE_STORAGE_ITEM_SORT) storage.arrangeItems(c); c.announce(MaplePacketCreator.enableActions()); } else if (mode == 7) { // meso int meso = slea.readInt(); diff --git a/src/config/ServerConfig.java b/src/config/ServerConfig.java new file mode 100644 index 0000000000..d19727735e --- /dev/null +++ b/src/config/ServerConfig.java @@ -0,0 +1,305 @@ +package config; + +public class ServerConfig { + //Thread Tracker Configuration + public boolean USE_THREAD_TRACKER; + + //Database Configuration + public String DB_URL; + public String DB_USER; + public String DB_PASS; + public boolean DB_CONNECTION_POOL; + + //Login Configuration + public int WLDLIST_SIZE; + public int CHANNEL_SIZE; + public int CHANNEL_LOAD; + public int CHANNEL_LOCKS; + + public long RESPAWN_INTERVAL; + public long PURGING_INTERVAL; + public long RANKING_INTERVAL; + public long COUPON_INTERVAL; + public long UPDATE_INTERVAL; + + public boolean ENABLE_PIC; + public boolean ENABLE_PIN; + + public int BYPASS_PIC_EXPIRATION; + public int BYPASS_PIN_EXPIRATION; + + public boolean AUTOMATIC_REGISTER; + public boolean BCRYPT_MIGRATION; + public boolean COLLECTIVE_CHARSLOT; + public boolean DETERRED_MULTICLIENT; + + //Besides blocking logging in with several client sessions on the same machine, this also blocks suspicious login attempts for players that tries to login on an account using several diferent remote addresses. + + //Multiclient Coordinator Configuration + public int MAX_ALLOWED_ACCOUNT_HWID; + public int MAX_ACCOUNT_LOGIN_ATTEMPT; + public int LOGIN_ATTEMPT_DURATION; + + //Ip Configuration + public String HOST; + public boolean LOCALSERVER; + public boolean GMSERVER; + + //Other configuration + public boolean SHUTDOWNHOOK; + + //Server Flags + public boolean USE_CUSTOM_KEYSET; + public boolean USE_DEBUG; + public boolean USE_DEBUG_SHOW_INFO_EQPEXP; + public boolean USE_DEBUG_SHOW_RCVD_PACKET; + public boolean USE_DEBUG_SHOW_RCVD_MVLIFE; + public boolean USE_DEBUG_SHOW_PACKET; + public boolean USE_SUPPLY_RATE_COUPONS; + public boolean USE_IP_VALIDATION; + + public boolean USE_MAXRANGE; + public boolean USE_MAXRANGE_ECHO_OF_HERO; + public boolean USE_MTS; + public boolean USE_CPQ; + public boolean USE_AUTOHIDE_GM; + public boolean USE_BUYBACK_SYSTEM; + public boolean USE_FIXED_RATIO_HPMP_UPDATE; + public boolean USE_FAMILY_SYSTEM; + public boolean USE_DUEY; + public boolean USE_RANDOMIZE_HPMP_GAIN; + public boolean USE_STORAGE_ITEM_SORT; + public boolean USE_ITEM_SORT; + public boolean USE_ITEM_SORT_BY_NAME; + public boolean USE_PARTY_FOR_STARTERS; + public boolean USE_AUTOASSIGN_STARTERS_AP; + public boolean USE_AUTOASSIGN_SECONDARY_CAP; + public boolean USE_STARTING_AP_4; + public boolean USE_AUTOBAN; + public boolean USE_AUTOBAN_LOG; + public boolean USE_AUTOSAVE; + public boolean USE_SERVER_AUTOASSIGNER; + public boolean USE_REFRESH_RANK_MOVE; + public boolean USE_ENFORCE_ADMIN_ACCOUNT; + public boolean USE_ENFORCE_NOVICE_EXPRATE; + public boolean USE_ENFORCE_HPMP_SWAP; + public boolean USE_ENFORCE_MOB_LEVEL_RANGE; + public boolean USE_ENFORCE_JOB_LEVEL_RANGE; + public boolean USE_ENFORCE_JOB_SP_RANGE; + public boolean USE_ENFORCE_ITEM_SUGGESTION; + public boolean USE_ENFORCE_UNMERCHABLE_CASH; + public boolean USE_ENFORCE_UNMERCHABLE_PET; + public boolean USE_ENFORCE_MERCHANT_SAVE; + public boolean USE_ENFORCE_MDOOR_POSITION; + public boolean USE_SPAWN_CLEAN_MDOOR; + public boolean USE_SPAWN_LOOT_ON_ANIMATION; + public boolean USE_SPAWN_RELEVANT_LOOT; + public boolean USE_ERASE_PERMIT_ON_OPENSHOP; + public boolean USE_ERASE_UNTRADEABLE_DROP; + public boolean USE_ERASE_PET_ON_EXPIRATION; + public boolean USE_BUFF_MOST_SIGNIFICANT; + public boolean USE_BUFF_EVERLASTING; + public boolean USE_MULTIPLE_SAME_EQUIP_DROP; + public boolean USE_BANISHABLE_TOWN_SCROLL; + public boolean USE_ENABLE_FULL_RESPAWN; + public boolean USE_ENABLE_CHAT_LOG; + public boolean USE_REBIRTH_SYSTEM; + public boolean USE_MAP_OWNERSHIP_SYSTEM; + public boolean USE_FISHING_SYSTEM; + public boolean USE_NPCS_SCRIPTABLE; + + //Events/PQs Configuration + public boolean USE_OLD_GMS_STYLED_PQ_NPCS; + public boolean USE_ENABLE_SOLO_EXPEDITIONS; + public boolean USE_ENABLE_DAILY_EXPEDITIONS; + public boolean USE_ENABLE_RECALL_EVENT; + + //Announcement Configuration + public boolean USE_ANNOUNCE_SHOPITEMSOLD; + public boolean USE_ANNOUNCE_CHANGEJOB; + + //Cash Shop Configuration + public boolean USE_JOINT_CASHSHOP_INVENTORY; + public boolean USE_CLEAR_OUTDATED_COUPONS; + public boolean ALLOW_CASHSHOP_NAME_CHANGE; + public boolean ALLOW_CASHSHOP_WORLD_TRANSFER;//Allows players to buy world transfers in the cash shop. + + //Maker Configuration + public boolean USE_MAKER_PERMISSIVE_ATKUP; + public boolean USE_MAKER_FEE_HEURISTICS; + + //Custom Configuration + public boolean USE_ENABLE_CUSTOM_NPC_SCRIPT; + public boolean USE_STARTER_MERGE; + + //Commands Configuration + public boolean BLOCK_GENERATE_CASH_ITEM; + public boolean USE_WHOLE_SERVER_RANKING; + + public double EQUIP_EXP_RATE; + public double PQ_BONUS_EXP_RATE; + + public byte EXP_SPLIT_LEVEL_INTERVAL; + public byte EXP_SPLIT_LEECH_INTERVAL; + public float EXP_SPLIT_MVP_MOD; + public float EXP_SPLIT_COMMON_MOD; + public float PARTY_BONUS_EXP_RATE; + + //Miscellaneous Configuration + public String TIMEZONE; + public boolean USE_DISPLAY_NUMBERS_WITH_COMMA; + public boolean USE_UNITPRICE_WITH_COMMA; + public byte MAX_MONITORED_BUFFSTATS; + public int MAX_AP; + public int MAX_EVENT_LEVELS; + public long BLOCK_NPC_RACE_CONDT; + public long PET_LOOT_UPON_ATTACK; + public int TOT_MOB_QUEST_REQUIREMENT; + public int MOB_REACTOR_REFRESH_TIME; + public int PARTY_SEARCH_REENTRY_LIMIT; + public long NAME_CHANGE_COOLDOWN; + public long WORLD_TRANSFER_COOLDOWN=NAME_CHANGE_COOLDOWN;//Cooldown for world tranfers, default is same as name change (30 days). + public boolean INSTANT_NAME_CHANGE; + + //Dangling Items/Locks Configuration + public int ITEM_EXPIRE_TIME ; + public int KITE_EXPIRE_TIME ; + public int ITEM_MONITOR_TIME; + public int LOCK_MONITOR_TIME; + + //Map Monitor Configuration + public int ITEM_EXPIRE_CHECK; + public int ITEM_LIMIT_ON_MAP; + public int MAP_VISITED_SIZE; + public int MAP_DAMAGE_OVERTIME_INTERVAL; + + //Channel Mob Disease Monitor Configuration + public int MOB_STATUS_MONITOR_PROC; + public int MOB_STATUS_MONITOR_LIFE; + public int MOB_STATUS_AGGRO_PERSISTENCE; + public int MOB_STATUS_AGGRO_INTERVAL; + + //Some Gameplay Enhancing Configurations + //Scroll Configuration + public boolean USE_PERFECT_GM_SCROLL; + public boolean USE_PERFECT_SCROLLING; + public boolean USE_ENHANCED_CHSCROLL; + public boolean USE_ENHANCED_CRAFTING; + public boolean USE_ENHANCED_CLNSLATE; + public int SCROLL_CHANCE_RATE; + public int CHSCROLL_STAT_RATE; + public int CHSCROLL_STAT_RANGE; + + //Beginner Skills Configuration + public boolean USE_ULTRA_NIMBLE_FEET; + public boolean USE_ULTRA_RECOVERY; + public boolean USE_ULTRA_THREE_SNAILS; + + //Other Skills Configuration + public boolean USE_FULL_ARAN_SKILLSET; + public boolean USE_FAST_REUSE_HERO_WILL; + public boolean USE_ANTI_IMMUNITY_CRASH; + public boolean USE_UNDISPEL_HOLY_SHIELD; + public boolean USE_FULL_HOLY_SYMBOL; + + //Character Configuration + public boolean USE_ADD_SLOTS_BY_LEVEL; + public boolean USE_ADD_RATES_BY_LEVEL; + public boolean USE_STACK_COUPON_RATES; + public boolean USE_PERFECT_PITCH; + + //Quest Configuration + public boolean USE_QUEST_RATE; + + //Quest Points Configuration + public int QUEST_POINT_REPEATABLE_INTERVAL; + public int QUEST_POINT_REQUIREMENT; + public int QUEST_POINT_PER_QUEST_COMPLETE; + public int QUEST_POINT_PER_EVENT_CLEAR; + + //Guild Configuration + public int CREATE_GUILD_MIN_PARTNERS; + public int CREATE_GUILD_COST; + public int CHANGE_EMBLEM_COST; + public int EXPAND_GUILD_BASE_COST; + public int EXPAND_GUILD_TIER_COST; + public int EXPAND_GUILD_MAX_COST; + + //Family Configuration + public int FAMILY_REP_PER_KILL; + public int FAMILY_REP_PER_BOSS_KILL; + public int FAMILY_REP_PER_LEVELUP; + public int FAMILY_MAX_GENERATIONS; + + //Equipment Configuration + public boolean USE_EQUIPMNT_LVLUP_SLOTS; + public boolean USE_EQUIPMNT_LVLUP_POWER; + public boolean USE_EQUIPMNT_LVLUP_CASH; + public boolean USE_SPIKES_AVOID_BANISH; + public int MAX_EQUIPMNT_LVLUP_STAT_UP; + public int MAX_EQUIPMNT_STAT; + public int USE_EQUIPMNT_LVLUP; + + //Map-Chair Configuration + public boolean USE_CHAIR_EXTRAHEAL; + public byte CHAIR_EXTRA_HEAL_MULTIPLIER; + public int CHAIR_EXTRA_HEAL_MAX_DELAY; + + //Player NPC Configuration + public int PLAYERNPC_INITIAL_X; + public int PLAYERNPC_INITIAL_Y; + public int PLAYERNPC_AREA_X; + public int PLAYERNPC_AREA_Y; + public int PLAYERNPC_AREA_STEPS; + public boolean PLAYERNPC_ORGANIZE_AREA; + public boolean PLAYERNPC_AUTODEPLOY; + + //Pet Auto-Pot Configuration + public boolean USE_COMPULSORY_AUTOPOT; + public boolean USE_EQUIPS_ON_AUTOPOT; + public double PET_AUTOHP_RATIO; + public double PET_AUTOMP_RATIO; + + //Pet & Mount Configuration + public byte PET_EXHAUST_COUNT; + public byte MOUNT_EXHAUST_COUNT; + + //Pet Hunger Configuration + public boolean PETS_NEVER_HUNGRY; + public boolean GM_PETS_NEVER_HUNGRY; + + //Event Configuration + public int EVENT_MAX_GUILD_QUEUE; + public long EVENT_LOBBY_DELAY; + + //Dojo Configuration + public boolean USE_FAST_DOJO_UPGRADE; + public boolean USE_DEADLY_DOJO; + public int DOJO_ENERGY_ATK; + public int DOJO_ENERGY_DMG; + + //Wedding Configuration + public int WEDDING_RESERVATION_DELAY; + public int WEDDING_RESERVATION_TIMEOUT; + public int WEDDING_RESERVATION_INTERVAL; + public int WEDDING_BLESS_EXP; + public int WEDDING_GIFT_LIMIT; + public boolean WEDDING_BLESSER_SHOWFX; + + //Buyback Configuration + public boolean USE_BUYBACK_WITH_MESOS; + public float BUYBACK_FEE; + public float BUYBACK_LEVEL_STACK_FEE; + public int BUYBACK_MESO_MULTIPLIER; + public int BUYBACK_RETURN_MINUTES; + public int BUYBACK_COOLDOWN_MINUTES; + + // Login timeout by shavit + public long TIMEOUT_DURATION; + + //Event End Timestamp + public long EVENT_END_TIMESTAMP; + + //Debug Variables + public int DEBUG_VALUES[]; +} diff --git a/src/config/WorldConfig.java b/src/config/WorldConfig.java new file mode 100644 index 0000000000..075282bf50 --- /dev/null +++ b/src/config/WorldConfig.java @@ -0,0 +1,16 @@ +package config; + +public class WorldConfig { + public int flag = 0; + public String server_message = "Welcome!"; + public String event_message = ""; + public String why_am_i_recommended = ""; + public int channels = 1; + public int exp_rate = 1; + public int meso_rate = 1; + public int drop_rate = 1; + public int boss_drop_rate = 1; + public int quest_rate = 1; + public int travel_rate = 1; + public int fishing_rate = 1; +} diff --git a/src/config/YamlConfig.java b/src/config/YamlConfig.java new file mode 100644 index 0000000000..0af88cad37 --- /dev/null +++ b/src/config/YamlConfig.java @@ -0,0 +1,30 @@ +package config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.List; + + +public class YamlConfig { + + public static final YamlConfig config = fromFile("config.yaml"); + public List worlds; + public ServerConfig server; + + public static YamlConfig fromFile(String filename) { + ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); + try { + return mapper.readValue(new File(filename), YamlConfig.class); + } catch (FileNotFoundException e) { + String message = "Could not read config file " + filename + ": " + e.getMessage(); + throw new RuntimeException(message); + } catch (IOException e) { + String message = "Could not successfully parse config file " + filename + ": " + e.getMessage(); + throw new RuntimeException(message); + } + } +} diff --git a/src/constants/GameConstants.java b/src/constants/GameConstants.java index a869edb18b..e7b4017f96 100644 --- a/src/constants/GameConstants.java +++ b/src/constants/GameConstants.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.HashMap; import java.util.Map; import client.MapleJob; +import config.YamlConfig; import constants.skills.Aran; import java.io.File; import java.text.DecimalFormat; @@ -40,7 +41,7 @@ public class GameConstants { private static final int[] jobUpgradeSpUp = {0, 1, 2, 3, 6}; private final static Map jobNames = new HashMap<>(); private final static NumberFormat nfFormatter = new DecimalFormat("#,###,###,###"); - private final static NumberFormat nfParser = NumberFormat.getInstance(ServerConstants.USE_UNITPRICE_WITH_COMMA ? Locale.FRANCE : Locale.UK); + private final static NumberFormat nfParser = NumberFormat.getInstance(YamlConfig.config.server.USE_UNITPRICE_WITH_COMMA ? Locale.FRANCE : Locale.UK); public static final MapleDisease[] CPQ_DISEASES = {MapleDisease.SLOW, MapleDisease.SEDUCE, MapleDisease.STUN, MapleDisease.POISON, MapleDisease.SEAL, MapleDisease.DARKNESS, MapleDisease.WEAKEN, MapleDisease.CURSE}; @@ -666,7 +667,7 @@ public class GameConstants { } public synchronized static String numberWithCommas(int i) { - if(!ServerConstants.USE_DISPLAY_NUMBERS_WITH_COMMA) { + if(!YamlConfig.config.server.USE_DISPLAY_NUMBERS_WITH_COMMA) { return nfFormatter.format(i); // will display number on whatever locale is currently assigned on NumberFormat } else { return NumberFormat.getNumberInstance(Locale.UK).format(i); diff --git a/src/constants/ItemConstants.java b/src/constants/ItemConstants.java index c3ff38e458..1ae3d13507 100644 --- a/src/constants/ItemConstants.java +++ b/src/constants/ItemConstants.java @@ -22,6 +22,8 @@ package constants; import client.inventory.MapleInventoryType; +import config.YamlConfig; + import java.util.HashSet; import java.util.Set; import java.util.HashMap; @@ -107,7 +109,7 @@ public final class ItemConstants { } public static boolean isExpirablePet(int itemId) { - return ServerConstants.USE_ERASE_PET_ON_EXPIRATION || itemId == 5000054; + return YamlConfig.config.server.USE_ERASE_PET_ON_EXPIRATION || itemId == 5000054; } public static boolean isPermanentItem(int itemId) { diff --git a/src/constants/ServerConstants.java b/src/constants/ServerConstants.java index 4a29d301c7..8e39808de2 100644 --- a/src/constants/ServerConstants.java +++ b/src/constants/ServerConstants.java @@ -1,347 +1,15 @@ package constants; -import java.io.FileInputStream; -import java.util.Properties; - public class ServerConstants { - //Thread Tracker Configuration - public static final boolean USE_THREAD_TRACKER = true; //[SEVERE] This deadlock auditing thing will bloat the memory as fast as the time frame one takes to lose track of a raindrop on a tempesting day. Only for debugging purposes. - - //Database Configuration - public static String DB_URL = ""; - public static String DB_USER = ""; - public static String DB_PASS = ""; - public static final boolean DB_CONNECTION_POOL = true; //Installs a connection pool to hub DB connections. Set false to default. - //Server Version public static short VERSION = 83; - //Login Configuration - public static final int WLDLIST_SIZE = 21; //Max possible worlds on the server. - public static final int CHANNEL_SIZE = 20; //Max possible channels per world (which is 20, based on the channel list on login phase). - public static final int CHANNEL_LOAD = 100; //Max players per channel (limit actually used to calculate the World server capacity). - public static final int CHANNEL_LOCKS = 20; //Total number of structure management locks each channel has. - - public static final long RESPAWN_INTERVAL = 10 * 1000; //10 seconds, 10000. - public static final long PURGING_INTERVAL = 5 * 60 * 1000; - public static final long RANKING_INTERVAL = 60 * 60 * 1000; //60 minutes, 3600000. - public static final long COUPON_INTERVAL = 60 * 60 * 1000; //60 minutes, 3600000. - public static final long UPDATE_INTERVAL = 777; //Dictates the frequency on which the "centralized server time" is updated. - - public static final boolean ENABLE_PIC = false; //Pick true/false to enable or disable Pic. Delete character requires PIC available. - public static final boolean ENABLE_PIN = false; //Pick true/false to enable or disable Pin. - - public static final int BYPASS_PIC_EXPIRATION = 20; //Enables PIC bypass, which will remain active for that account by that client machine for N minutes. Set 0 to disable. - public static final int BYPASS_PIN_EXPIRATION = 15; //Enables PIN bypass, which will remain active for that account by that client machine for N minutes. Set 0 to disable. - - public static final boolean AUTOMATIC_REGISTER = true; //Automatically register players when they login with a nonexistent username. - public static final boolean BCRYPT_MIGRATION = true; //Performs a migration from old SHA-1 and SHA-512 password to bcrypt. - public static final boolean COLLECTIVE_CHARSLOT = false; //Available character slots are contabilized globally rather than per world server. - public static final boolean DETERRED_MULTICLIENT = false; //Enables detection of multi-client and suspicious remote IP on the login system. - - //Besides blocking logging in with several client sessions on the same machine, this also blocks suspicious login attempts for players that tries to login on an account using several diferent remote addresses. - - //Multiclient Coordinator Configuration - public static final int MAX_ALLOWED_ACCOUNT_HWID = 4; //Allows up to N concurrent HWID's for an account. HWID's remains linked to an account longer the more times it's used to login. - public static final int MAX_ACCOUNT_LOGIN_ATTEMPT = 15; //After N tries on an account, login on that account gets disabled for a short period. - public static final int LOGIN_ATTEMPT_DURATION = 120; //Period in seconds the login attempt remains registered on the system. - - //Ip Configuration - public static String HOST; - public static boolean LOCALSERVER; - - //Other Configuration - public static final boolean JAVA_8 = getJavaVersion() >= 8; - public static boolean SHUTDOWNHOOK; - - //Server Flags - public static final boolean USE_CUSTOM_KEYSET = true; //Enables auto-setup of the HeavenMS's custom keybindings when creating characters. - public static final boolean USE_DEBUG = false; //Will enable some text prints on the client, oriented for debugging purposes. - public static final boolean USE_DEBUG_SHOW_INFO_EQPEXP = false; //Prints on the cmd all equip exp gain info. - public static boolean USE_DEBUG_SHOW_RCVD_PACKET = false; //Prints on the cmd all received packet ids. - public static boolean USE_DEBUG_SHOW_RCVD_MVLIFE = false; //Prints on the cmd all received move life content. - public static final boolean USE_DEBUG_SHOW_PACKET = false; - public static boolean USE_SUPPLY_RATE_COUPONS = true; //Allows rate coupons to be sold through the Cash Shop. - public static final boolean USE_IP_VALIDATION = true; //Enables IP checking when logging in. - - public static final boolean USE_MAXRANGE = true; //Will send and receive packets from all events on a map, rather than those of only view range. - public static final boolean USE_MAXRANGE_ECHO_OF_HERO = true; - public static final boolean USE_MTS = false; - public static final boolean USE_CPQ = true; //Renders the CPQ available or not. - public static final boolean USE_AUTOHIDE_GM = false; //When enabled, GMs are automatically hidden when joining. Thanks to Steven Deblois (steven1152). - public static final boolean USE_BUYBACK_SYSTEM = true; //Enables the HeavenMS-builtin buyback system, to be used by dead players when clicking the MTS button. - public static final boolean USE_FIXED_RATIO_HPMP_UPDATE = true; //Enables the HeavenMS-builtin HPMP update based on the current pool to max pool ratio. - public static final boolean USE_FAMILY_SYSTEM = true; - public static final boolean USE_DUEY = true; - public static final boolean USE_RANDOMIZE_HPMP_GAIN = true; //Enables randomizing on MaxHP/MaxMP gains and INT accounting for the MaxMP gain on level up. - public static final boolean USE_STORAGE_ITEM_SORT = true; //Enables storage "Arrange Items" feature. - public static final boolean USE_ITEM_SORT = true; //Enables inventory "Item Sort/Merge" feature. - public static final boolean USE_ITEM_SORT_BY_NAME = false; //Item sorting based on name rather than id. - public static final boolean USE_PARTY_FOR_STARTERS = true; //Players level 10 or below can create/invite other players on the given level range. - public static final boolean USE_AUTOASSIGN_STARTERS_AP = false; //Beginners level 10 or below have their AP autoassigned (they can't choose to levelup a stat). Set true ONLY if the localhost doesn't support AP assigning for beginners level 10 or below. - public static final boolean USE_AUTOASSIGN_SECONDARY_CAP = true;//Prevents AP autoassign from spending on secondary stats after the player class' cap (defined on the autoassign handler) has been reached. - public static final boolean USE_STARTING_AP_4 = true; //Use early-GMS 4/4/4/4 starting stats. To overcome AP shortage, this gives 4AP/5AP at 1st/2nd job advancements. - public static final boolean USE_AUTOBAN = false; //Commands the server to detect infractors automatically. - public static final boolean USE_AUTOBAN_LOG = true; //Log autoban related messages. Still logs even with USE_AUTOBAN disabled. - public static final boolean USE_AUTOSAVE = true; //Enables server autosaving feature (saves characters to DB each 1 hour). - public static final boolean USE_SERVER_AUTOASSIGNER = true; //HeavenMS-builtin autoassigner, uses algorithm based on distributing AP accordingly with required secondary stat on equipments. - public static final boolean USE_REFRESH_RANK_MOVE = true; - public static final boolean USE_ENFORCE_ADMIN_ACCOUNT = false; //Forces accounts having GM characters to be treated as a "GM account" by the client (localhost). Some of the GM account perks is the ability to FLY, but unable to TRADE. - public static final boolean USE_ENFORCE_NOVICE_EXPRATE = false; //Hardsets experience rate 1x for beginners level 10 or under. Ideal for roaming on novice areas without caring too much about losing some stats. - public static final boolean USE_ENFORCE_HPMP_SWAP = false; //Forces players to reuse stats (via AP Resetting) located on HP/MP pool only inside the HP/MP stats. - public static final boolean USE_ENFORCE_MOB_LEVEL_RANGE = true; //Players N levels below the killed mob will gain no experience from defeating it. - public static final boolean USE_ENFORCE_JOB_LEVEL_RANGE = false;//Caps the player level on the minimum required to advance their current jobs. - public static final boolean USE_ENFORCE_JOB_SP_RANGE = false; //Caps the player SP level on the total obtainable by their current jobs. After changing jobs, missing SP will be retrieved. - public static final boolean USE_ENFORCE_ITEM_SUGGESTION = false;//Forces the Owl of Minerva and the Cash Shop to always display the defined item array instead of those featured by the players. - public static final boolean USE_ENFORCE_UNMERCHABLE_CASH = true;//Forces players to not sell CASH items via merchants, drops of it disappears. - public static final boolean USE_ENFORCE_UNMERCHABLE_PET = true; //Forces players to not sell pets via merchants, drops of it disappears. (since non-named pets gets dirty name and other possible DB-related issues) - public static final boolean USE_ENFORCE_MERCHANT_SAVE = true; //Forces automatic DB save on merchant owners, at every item movement on shop. - public static final boolean USE_ENFORCE_MDOOR_POSITION = false; //Forces mystic door to be spawned near spawnpoints. - public static final boolean USE_SPAWN_CLEAN_MDOOR = false; //Makes mystic doors to be spawned without deploy animation. This clears disconnecting issues that may happen when trying to cancel doors a couple seconds after deployment. - public static final boolean USE_SPAWN_LOOT_ON_ANIMATION = false;//Makes loot appear some time after the mob has been killed (following the mob death animation, instead of instantly). - public static final boolean USE_SPAWN_RELEVANT_LOOT = true; //Forces to only spawn loots that are collectable by the player or any of their party members. - public static final boolean USE_ERASE_PERMIT_ON_OPENSHOP = true;//Forces "shop permit" item to be consumed when player deploy his/her player shop. - public static final boolean USE_ERASE_UNTRADEABLE_DROP = true; //Forces flagged untradeable items to disappear when dropped. - public static final boolean USE_ERASE_PET_ON_EXPIRATION = false;//Forces pets to be removed from inventory when expire time comes, rather than converting it to a doll. - public static final boolean USE_BUFF_MOST_SIGNIFICANT = true; //When applying buffs, the player will stick with the highest stat boost among the listed, rather than overwriting stats. - public static final boolean USE_BUFF_EVERLASTING = false; //Every applied buff on players holds expiration time so high it'd be considered permanent. Suggestion thanks to Vcoc. - public static final boolean USE_MULTIPLE_SAME_EQUIP_DROP = true;//Enables multiple drops by mobs of the same equipment, number of possible drops based on the quantities provided at the drop data. - public static final boolean USE_BANISHABLE_TOWN_SCROLL = true; //Enables town scrolls to act as if it's a "player banish", rendering the antibanish scroll effect available. - public static final boolean USE_ENABLE_FULL_RESPAWN = true; //At respawn task, always respawn missing mobs when they're available. Spawn count doesn't depend on how many players are currently there. - public static final boolean USE_ENABLE_CHAT_LOG = false; //Write in-game chat to log - public static final boolean USE_REBIRTH_SYSTEM = false; //Flag to enable/disable rebirth system - public static final boolean USE_MAP_OWNERSHIP_SYSTEM = true; //Flag to enable/disable map ownership system - public static final boolean USE_FISHING_SYSTEM = true; //Flag to enable/disable custom fishing system - public static final boolean USE_NPCS_SCRIPTABLE = true; //Flag to enable/disable serverside predefined script NPCs. - - //Events/PQs Configuration - public static final boolean USE_OLD_GMS_STYLED_PQ_NPCS = true; //Enables PQ NPCs with similar behaviour to old GMS style, that skips info about the PQs and immediately tries to register the party in. - public static final boolean USE_ENABLE_SOLO_EXPEDITIONS = true; //Enables start expeditions with any number of players. This will also bypass all the Zakum prequest. - public static final boolean USE_ENABLE_DAILY_EXPEDITIONS = false;//Enables daily entry limitations in expeditions. - public static final boolean USE_ENABLE_RECALL_EVENT = false; //Enables a disconnected player to reaccess the last event instance they were in before logging out. Recall only works if the event isn't cleared or disposed yet. Suggestion thanks to Alisson (Goukken). - - //Announcement Configuration - public static final boolean USE_ANNOUNCE_SHOPITEMSOLD = false; //Automatic message sent to owner when an item from the Player Shop or Hired Merchant is sold. - public static final boolean USE_ANNOUNCE_CHANGEJOB = false; //Automatic message sent to acquantainces when changing jobs. - - //Cash Shop Configuration - public static final boolean USE_JOINT_CASHSHOP_INVENTORY = true;//Enables usage of a same cash shop inventory for explorers, cygnus and legends. Items from exclusive cash shop inventories won't show up on the shared inventory, though. - public static final boolean USE_CLEAR_OUTDATED_COUPONS = true; //Enables deletion of older code coupon registry from the DB, freeing so-long irrelevant data. - public static final boolean ALLOW_CASHSHOP_NAME_CHANGE = true; //Allows players to buy name changes in the cash shop. - public static final boolean ALLOW_CASHSHOP_WORLD_TRANSFER =true;//Allows players to buy world transfers in the cash shop. - - //Maker Configuration - public static final boolean USE_MAKER_PERMISSIVE_ATKUP = true; //Allows players to use attack-based strengthening gems on non-weapon items. - public static final boolean USE_MAKER_FEE_HEURISTICS = true; //Apply compiled values for stimulants and reagents into the Maker fee calculations (max error revolves around 50k mesos). Set false to use basic constant values instead (results are never higher than requested by the client-side). - - //Custom Configuration - public static final boolean USE_ENABLE_CUSTOM_NPC_SCRIPT = true;//Enables usage of custom HeavenMS NPC scripts (Agent E, Coco, etc). Will not disable Abdula (it's actually useful for the gameplay) or quests. - public static final boolean USE_STARTER_MERGE = false; //Allows any players to use the Equipment Merge custom mechanic (as opposed to the high-level, Maker lv3 requisites). - - //Commands Configuration - public static final boolean BLOCK_GENERATE_CASH_ITEM = false; //Prevents creation of cash items with the item/drop command. - public static final boolean USE_WHOLE_SERVER_RANKING = false; //Enables a ranking pool made from every character registered on the server for the "ranks" command, instead of separated by worlds. - - //Server Rates And Experience - public static final int EXP_RATE = 10; //NOTE: World-specific rates within "world.ini" OVERRIDES the default rates from here. - public static final int MESO_RATE = 10; - public static final int DROP_RATE = 10; - public static final int BOSS_DROP_RATE = 10; //NOTE: Boss drop rate OVERRIDES common drop rate, for bosses-only. - public static final int QUEST_RATE = 5; //Multiplier for Exp & Meso gains when completing a quest. Only available when USE_QUEST_RATE is true. Stacks with server Exp & Meso rates. - public static final int FISHING_RATE = 10; //Multiplier for success likelihood on meso thrown during fishing. - public static final int TRAVEL_RATE = 10; //Means of transportation rides/departs using 1/N of the default time. - - public static final double EQUIP_EXP_RATE = 1.0; //Rate for equipment exp gain, grows linearly. Set 1.0 for default (about 100~200 same-level range mobs killed to pass equip from level 1 to 2). - public static final double PQ_BONUS_EXP_RATE = 0.5; //Rate for the PQ exp reward. - - public static final byte EXP_SPLIT_LEVEL_INTERVAL = 5; //Non-contributing players must be within N level between the mob to receive EXP. - public static final byte EXP_SPLIT_LEECH_INTERVAL = 5; //Non-contributing players must be within N level between any contributing party member to receive EXP. - public static final float EXP_SPLIT_MVP_MOD = 0.2f; - public static final float EXP_SPLIT_COMMON_MOD = 0.8f; - public static final float PARTY_BONUS_EXP_RATE = 1.0f; //Rate for the party exp bonus reward. - - //Miscellaneous Configuration - public static String TIMEZONE = "GMT-3"; - public static boolean USE_DISPLAY_NUMBERS_WITH_COMMA = true; //Enforce comma on displayed strings (use this when USE_UNITPRICE_WITH_COMMA is active and you still want to display comma-separated values). - public static boolean USE_UNITPRICE_WITH_COMMA = true; //Set this accordingly with the layout of the unitPrices on Item.wz XML's, whether it's using commas or dots to represent fractions. - public static final byte MAX_MONITORED_BUFFSTATS = 5; //Limits accounting for "dormant" buff effects, that should take place when stronger stat buffs expires. - public static final int MAX_AP = 32767; //Max AP allotted on the auto-assigner. - public static final int MAX_EVENT_LEVELS = 8; //Event has different levels of rewarding system. - public static final long BLOCK_NPC_RACE_CONDT = (long)(0.5 * 1000); //Time the player client must wait before reopening a conversation with an NPC. - public static final long PET_LOOT_UPON_ATTACK = (long)(0.7 * 1000); //Time the pet must wait before trying to pick items up. - public static final int TOT_MOB_QUEST_REQUIREMENT = 77; //Overwrites old 999-mobs requirement for the ToT questline with new requirement value, set 0 for default. - public static final int MOB_REACTOR_REFRESH_TIME = 30 * 1000; //Overwrites refresh time for those reactors oriented to inflict damage to bosses (Ice Queen, Riche), set 0 for default. - public static final int PARTY_SEARCH_REENTRY_LIMIT = 10; //Max amount of times a party leader is allowed to persist on the Party Search before entry expiration (thus needing to manually restart the Party Search to be able to search for members). - public static final int NAME_CHANGE_COOLDOWN = 30*24*60*60*1000; //Cooldown for name changes, default (GMS) is 30 days. - public static final int WORLD_TRANSFER_COOLDOWN=NAME_CHANGE_COOLDOWN;//Cooldown for world tranfers, default is same as name change (30 days). - public static final boolean INSTANT_NAME_CHANGE = false; //Whether or not to wait for server restart to apply name changes. Does on reconnect otherwise (requires queries on every login). - - //Dangling Items/Locks Configuration - public static final int ITEM_EXPIRE_TIME = 3 * 60 * 1000; //Time before items start disappearing. Recommended to be set up to 3 minutes. - public static final int KITE_EXPIRE_TIME = 60 * 60 * 1000; //Time before kites (cash item) disappears. - public static final int ITEM_MONITOR_TIME = 5 * 60 * 1000; //Interval between item monitoring tasks on maps, which checks for dangling (null) item objects on the map item history. - public static final int LOCK_MONITOR_TIME = 30 * 1000; //Waiting time for a lock to be released. If it reaches timeout, a critical server deadlock has made present. - - //Map Monitor Configuration - public static final int ITEM_EXPIRE_CHECK = 10 * 1000; //Interval between item expiring tasks on maps, which checks and makes disappear expired items. - public static final int ITEM_LIMIT_ON_MAP = 200; //Max number of items allowed on a map. - public static final int MAP_VISITED_SIZE = 5; //Max length for last mapids visited by a player. This is used to recover and update drops on these maps accordingly with player actions. - public static final int MAP_DAMAGE_OVERTIME_INTERVAL = 5000;//Interval in milliseconds between map environment damage (e.g. El Nath and Aqua Road surrondings). - - //Channel Mob Disease Monitor Configuration - public static final int MOB_STATUS_MONITOR_PROC = 200; //Frequency in milliseconds between each proc on the mob disease monitor schedule. - public static final int MOB_STATUS_MONITOR_LIFE = 84; //Idle proc count the mob disease monitor is allowed to be there before closing it due to inactivity. - public static final int MOB_STATUS_AGGRO_PERSISTENCE = 2; //Idle proc count on aggro update for a mob to keep following the current controller, given him/her is the leading damage dealer. - public static final int MOB_STATUS_AGGRO_INTERVAL = 5000; //Interval in milliseconds between aggro logistics update. - - //Some Gameplay Enhancing Configurations - //Scroll Configuration - public static final boolean USE_PERFECT_GM_SCROLL = true; //Scrolls from GMs never uses up slots nor fails. - public static final boolean USE_PERFECT_SCROLLING = true; //Scrolls doesn't use slots upon failure. - public static final boolean USE_ENHANCED_CHSCROLL = true; //Equips even more powerful with chaos upgrade. - public static final boolean USE_ENHANCED_CRAFTING = true; //Apply chaos scroll on every equip crafted. - public static final boolean USE_ENHANCED_CLNSLATE = true; //Clean slates can be applied to recover successfully used slots as well. - public static final int SCROLL_CHANCE_RATE = 10; //Number of rolls for success on a scroll, set 1 for default. - public static final int CHSCROLL_STAT_RATE = 3; //Number of rolls of stat upgrade on a successfully applied chaos scroll, set 1 for default. - public static final int CHSCROLL_STAT_RANGE = 6; //Stat upgrade range (-N, N) on chaos scrolls. - - //Beginner Skills Configuration - public static final boolean USE_ULTRA_NIMBLE_FEET = true; //Massive speed & jump upgrade. - public static final boolean USE_ULTRA_RECOVERY = true; //Massive recovery amounts overtime. - public static final boolean USE_ULTRA_THREE_SNAILS = true; //Massive damage on shell toss. - - //Other Skills Configuration - public static final boolean USE_FULL_ARAN_SKILLSET = false; //Enables starter availability to all Aran job skills. Suggestion thanks to Masterrulax. - public static final boolean USE_FAST_REUSE_HERO_WILL = true;//Greatly reduce cooldown on Hero's Will. - public static final boolean USE_ANTI_IMMUNITY_CRASH = true; //Crash skills additionally removes the mob's invincibility buffs. Suggestion thanks to Celestial. - public static final boolean USE_UNDISPEL_HOLY_SHIELD = true;//Holy shield buff also prevents players from suffering dispel from mobs. - public static final boolean USE_FULL_HOLY_SYMBOL = true; //Holy symbol doesn't require EXP sharers to work in full. - - //Character Configuration - public static final boolean USE_ADD_SLOTS_BY_LEVEL = true; //Slots are added each 20 levels. - public static final boolean USE_ADD_RATES_BY_LEVEL = true; //Rates are added each 20 levels. - public static final boolean USE_STACK_COUPON_RATES = false; //Multiple coupons effects builds up together. - public static final boolean USE_PERFECT_PITCH = true; //For lvl 30 or above, each lvlup grants player 1 perfect pitch. - - //Quest Configuration - public static final boolean USE_QUEST_RATE = false; //Exp/Meso gained by quests uses fixed server exp/meso rate times quest rate as multiplier, instead of player rates. - - //Quest Points Configuration - public static final int QUEST_POINT_REPEATABLE_INTERVAL = 24;//Minimum interval between repeatable quest completions for quest points to be awarded. - public static final int QUEST_POINT_REQUIREMENT = 16; //Exchange factor between N quest points to +1 fame, set 0 to disable the entire quest point mechanism. - public static final int QUEST_POINT_PER_QUEST_COMPLETE = 4; //Each completed quest awards N quest points, set 0 to disable. - public static final int QUEST_POINT_PER_EVENT_CLEAR = 1; //Each completed event instance awards N quest points, set 0 to disable. - - //Guild Configuration - public static final int CREATE_GUILD_MIN_PARTNERS = 6; //Minimum number of members on Guild Headquarters to establish a new guild. - public static final int CREATE_GUILD_COST = 1500000; - public static final int CHANGE_EMBLEM_COST = 5000000; - public static final int EXPAND_GUILD_BASE_COST = 500000; - public static final int EXPAND_GUILD_TIER_COST = 1000000; - public static final int EXPAND_GUILD_MAX_COST = 5000000; - - //Family Configuration - public static final int FAMILY_REP_PER_KILL = 4; //Amount of rep gained per monster kill. - public static final int FAMILY_REP_PER_BOSS_KILL = 20; //Amount of rep gained per boss kill. - public static final int FAMILY_REP_PER_LEVELUP = 200; //Amount of rep gained upon leveling up. - public static final int FAMILY_MAX_GENERATIONS = 1000; //Maximum depth of family tree. (Distance from leader to farthest junior) - - //Equipment Configuration - public static final boolean USE_EQUIPMNT_LVLUP_SLOTS = true;//Equips can upgrade slots at level up. - public static final boolean USE_EQUIPMNT_LVLUP_POWER = true;//Enable more powerful stat upgrades at equip level up. - public static final boolean USE_EQUIPMNT_LVLUP_CASH = true; //Enable equip leveling up on cash equipments as well. - public static final boolean USE_SPIKES_AVOID_BANISH = true; //Shoes equipped with spikes prevents mobs from banishing wearer. - public static final int MAX_EQUIPMNT_LVLUP_STAT_UP = 10000; //Max stat upgrade an equipment can have on a levelup. - public static final int MAX_EQUIPMNT_STAT = 32767; //Max stat on an equipment by leveling up. - public static final int USE_EQUIPMNT_LVLUP = 7; //All equips lvlup at max level of N, set 1 to disable. - - //Map-Chair Configuration - public static final boolean USE_CHAIR_EXTRAHEAL = true; //Enable map chairs to further recover player's HP and MP (player must have the Chair Mastery skill). - public static final byte CHAIR_EXTRA_HEAL_MULTIPLIER = 10; //Due to only being able to be send up-to-255 heal values, values being actually updated is the one displayed times this. - public static final int CHAIR_EXTRA_HEAL_MAX_DELAY = 21; //Players are expected to recover fully after using this skill for N seconds. - - //Player NPC Configuration - public static final int PLAYERNPC_INITIAL_X = 262; //Map frame width for putting PlayerNPCs. - public static final int PLAYERNPC_INITIAL_Y = 262; //Map frame height for putting PlayerNPCs. - public static final int PLAYERNPC_AREA_X = 320; //Initial width gap between PlayerNPCs. - public static final int PLAYERNPC_AREA_Y = 160; //Initial height gap between PlayerNPCs. - public static final int PLAYERNPC_AREA_STEPS = 4; //Max number of times gap is shortened to comport PlayerNPCs. - public static final boolean PLAYERNPC_ORGANIZE_AREA = true; //Automatically rearranges PlayerNPCs on the map if there is no space set the new NPC. Current distance gap between NPCs is decreased to solve this issue. - public static final boolean PLAYERNPC_AUTODEPLOY = true; //Makes PlayerNPC automatically deployed on the Hall of Fame at the instant one reaches max level. If false, eligible players must talk to 1st job instructor to deploy a NPC. - - //Pet Auto-Pot Configuration - public static final boolean USE_COMPULSORY_AUTOPOT = true; //Pets will consume as many potions as needed to fulfill the AUTOHP/MP ratio threshold. - public static final boolean USE_EQUIPS_ON_AUTOPOT = true; //Player MaxHP and MaxMP check values on autopot handler will be updated by the HP/MP bonuses on equipped items. - public static final double PET_AUTOHP_RATIO = 0.99; //Will automatically consume potions until given ratio of the MaxHP/MaxMP is reached. - public static final double PET_AUTOMP_RATIO = 0.99; - - //Pet & Mount Configuration - public static final byte PET_EXHAUST_COUNT = 3; //Number of proc counts (1 per minute) on the exhaust schedule for fullness. - public static final byte MOUNT_EXHAUST_COUNT = 1; //Number of proc counts (1 per minute) on the exhaust schedule for tiredness. - - //Pet Hunger Configuration - public static final boolean PETS_NEVER_HUNGRY = false; //If true, pets and mounts will never grow hungry. - public static final boolean GM_PETS_NEVER_HUNGRY = true; //If true, pets and mounts owned by GMs will never grow hungry. - - //Event Configuration - public static final int EVENT_MAX_GUILD_QUEUE = 10; //Max number of guilds in queue for GPQ. - public static final long EVENT_LOBBY_DELAY = 10; //Cooldown duration in seconds before reopening an event lobby. - - //Dojo Configuration - public static final boolean USE_FAST_DOJO_UPGRADE = true; //Reduced Dojo training points amount required for a belt upgrade. - public static final boolean USE_DEADLY_DOJO = false; //Should bosses really use 1HP,1MP attacks in dojo? - public static final int DOJO_ENERGY_ATK = 100; //Dojo energy gain when deal attack - public static final int DOJO_ENERGY_DMG = 20; //Dojo energy gain when recv attack - - //Wedding Configuration - public static final int WEDDING_RESERVATION_DELAY = 3; //Minimum idle slots before processing a wedding reservation. - public static final int WEDDING_RESERVATION_TIMEOUT = 10; //Limit time in minutes for the couple to show up before cancelling the wedding reservation. - public static final int WEDDING_RESERVATION_INTERVAL = 60; //Time between wedding starts in minutes. - public static final int WEDDING_BLESS_EXP = 30000; //Exp gained per bless count. - public static final int WEDDING_GIFT_LIMIT = 1; //Max number of gifts per person to same wishlist on marriage instances. - public static final boolean WEDDING_BLESSER_SHOWFX = true; //Pops bubble sprite effect on players blessing the couple. Setting this false shows the blessing effect on the couple instead. - - //Buyback Configuration - public static final boolean USE_BUYBACK_WITH_MESOS = true; //Enables usage of either mesos or NX for the buyback fee. - public static final float BUYBACK_FEE = 77.70f; //Sets the base amount needed to buyback (level 30 or under will use the base value). - public static final float BUYBACK_LEVEL_STACK_FEE = 85.47f; //Sets the level-stacking portion of the amount needed to buyback (fee will sum up linearly until level 120, when it reaches the peak). - public static final int BUYBACK_MESO_MULTIPLIER = 1000; //Sets a multiplier for the fee when using meso as the charge unit. - public static final int BUYBACK_RETURN_MINUTES = 1; //Sets the maximum amount of time the player can wait before decide to buyback. - public static final int BUYBACK_COOLDOWN_MINUTES = 7; //Sets the time the player must wait before using buyback again. - - // Login timeout by shavit - public static long TIMEOUT_DURATION = 3600000L; // Kicks clients who don't send any packet to the game server in due time (in millisseconds). - - //Event End Timestamp - public static final long EVENT_END_TIMESTAMP = 1428897600000L; + //Java Configuration + public static final boolean JAVA_8 = getJavaVersion() >= 8; //Max amount of times a party leader is allowed to persist on the Party Search before entry expiration (thus needing to manually restart the Party Search to be able to search for members). //Debug Variables public static int DEBUG_VALUES[] = new int[10]; // Field designed for packet testing purposes - - //Properties - static { - Properties p = new Properties(); - try { - p.load(new FileInputStream("configuration.ini")); - //Server Host - ServerConstants.HOST = p.getProperty("HOST"); - ServerConstants.LOCALSERVER = ServerConstants.HOST.startsWith("127.") || ServerConstants.HOST.startsWith("localhost"); - - //Sql Database - ServerConstants.DB_URL = p.getProperty("URL"); - ServerConstants.DB_USER = p.getProperty("DB_USER"); - ServerConstants.DB_PASS = p.getProperty("DB_PASS"); - - // shutdownhook - ServerConstants.SHUTDOWNHOOK = p.getProperty("SHUTDOWNHOOK").equalsIgnoreCase("true"); - - } catch (Exception e) { - e.printStackTrace(); - System.out.println("Failed to load configuration.ini."); - System.exit(0); - } - } // https://github.com/openstreetmap/josm/blob/a3a6e8a6b657cf4c5b4c64ea14d6e87be6280d65/src/org/openstreetmap/josm/tools/Utils.java#L1566-L1585 /** * Returns the Java version as an int value. diff --git a/src/net/MapleServerHandler.java b/src/net/MapleServerHandler.java index 6c9e4c2021..5b16e0ae02 100644 --- a/src/net/MapleServerHandler.java +++ b/src/net/MapleServerHandler.java @@ -28,6 +28,8 @@ import java.util.HashSet; import java.util.Calendar; import java.util.concurrent.atomic.AtomicLong; +import config.ServerConfig; +import config.YamlConfig; import org.apache.mina.core.service.IoHandlerAdapter; import org.apache.mina.core.session.IdleStatus; import org.apache.mina.core.session.IoSession; @@ -188,7 +190,7 @@ public class MapleServerHandler extends IoHandlerAdapter { short packetId = slea.readShort(); MapleClient client = (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY); - if(ServerConstants.USE_DEBUG_SHOW_RCVD_PACKET && !ignoredDebugRecvPackets.contains(packetId)) System.out.println("Received packet id " + packetId); + if(YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_PACKET && !ignoredDebugRecvPackets.contains(packetId)) System.out.println("Received packet id " + packetId); final MaplePacketHandler packetHandler = processor.getHandler(packetId); if (packetHandler != null && packetHandler.validateState(client)) { try { diff --git a/src/net/mina/MaplePacketDecoder.java b/src/net/mina/MaplePacketDecoder.java index 0acffa2881..b08116fc23 100644 --- a/src/net/mina/MaplePacketDecoder.java +++ b/src/net/mina/MaplePacketDecoder.java @@ -21,6 +21,7 @@ */ package net.mina; +import config.YamlConfig; import constants.ServerConstants; import client.MapleClient; import constants.OpcodeConstants; @@ -75,7 +76,7 @@ public class MaplePacketDecoder extends CumulativeProtocolDecoder { rcvdCrypto.crypt(decryptedPacket); MapleCustomEncryption.decryptData(decryptedPacket); out.write(decryptedPacket); - if (ServerConstants.USE_DEBUG_SHOW_PACKET){ // packet traffic log: Atoot's idea, applied using auto-identation thanks to lrenex + if (YamlConfig.config.server.USE_DEBUG_SHOW_PACKET){ // packet traffic log: Atoot's idea, applied using auto-identation thanks to lrenex int packetLen = decryptedPacket.length; int pHeader = readFirstShort(decryptedPacket); String pHeaderStr = Integer.toHexString(pHeader).toUpperCase(); diff --git a/src/net/mina/MaplePacketEncoder.java b/src/net/mina/MaplePacketEncoder.java index cad289e166..8aafcf2e60 100644 --- a/src/net/mina/MaplePacketEncoder.java +++ b/src/net/mina/MaplePacketEncoder.java @@ -21,6 +21,7 @@ along with this program. If not, see . */ package net.mina; +import config.YamlConfig; import constants.ServerConstants; import client.MapleClient; import constants.OpcodeConstants; @@ -46,7 +47,7 @@ public class MaplePacketEncoder implements ProtocolEncoder { try { final MapleAESOFB send_crypto = client.getSendCrypto(); final byte[] input = (byte[]) message; - if (ServerConstants.USE_DEBUG_SHOW_PACKET) { + if (YamlConfig.config.server.USE_DEBUG_SHOW_PACKET) { int packetLen = input.length; int pHeader = readFirstShort(input); String pHeaderStr = Integer.toHexString(pHeader).toUpperCase(); diff --git a/src/net/server/Server.java b/src/net/server/Server.java index a370db5cc8..25d4c77cc3 100644 --- a/src/net/server/Server.java +++ b/src/net/server/Server.java @@ -46,6 +46,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; +import config.YamlConfig; import net.server.audit.ThreadTracker; import net.server.audit.locks.MonitoredLockType; import net.server.audit.locks.MonitoredReentrantReadWriteLock; @@ -170,7 +171,7 @@ public class Server { } public void updateCurrentTime() { - serverCurrentTime = currentTime.addAndGet(ServerConstants.UPDATE_INTERVAL); + serverCurrentTime = currentTime.addAndGet(YamlConfig.config.server.UPDATE_INTERVAL); } public long forceUpdateCurrentTime() { @@ -342,18 +343,13 @@ public class Server { if(worldChannels == null) return -3; int channelid = worldChannels.size(); - if(channelid >= ServerConstants.CHANNEL_SIZE) return -2; - - Properties p = loadWorldINI(); - if(p == null) { - return -1; - } + if(channelid >= YamlConfig.config.server.CHANNEL_SIZE) return -2; channelid++; World world = this.getWorld(worldid); Channel channel = new Channel(worldid, channelid, getCurrentTime()); - - channel.setServerMessage(p.getProperty("whyamirecommended" + worldid)); + + channel.setServerMessage(YamlConfig.config.worlds.get(worldid).why_am_i_recommended); world.addChannel(channel); worldChannels.put(channelid, channel.getIP()); @@ -365,10 +361,7 @@ public class Server { } public int addWorld() { - Properties p = loadWorldINI(); - if(p == null) return -2; - - int newWorld = initWorld(p); + int newWorld = initWorld(); if(newWorld > -1) { installWorldPlayerRanking(newWorld); @@ -388,40 +381,40 @@ public class Server { return newWorld; } - private static int getWorldProperty(Properties p, String property, int wid, int defaultValue) { - String content = p.getProperty(property + wid); - return content != null ? Integer.parseInt(content) : defaultValue; - } - - private int initWorld(Properties p) { + private int initWorld() { wldWLock.lock(); try { int i = worlds.size(); - if(i >= ServerConstants.WLDLIST_SIZE) { + if(i >= YamlConfig.config.server.WLDLIST_SIZE) { return -1; } System.out.println("Starting world " + i); - int exprate = getWorldProperty(p, "exprate", i, ServerConstants.EXP_RATE); - int mesorate = getWorldProperty(p, "mesorate", i, ServerConstants.MESO_RATE); - int droprate = getWorldProperty(p, "droprate", i, ServerConstants.DROP_RATE); - int bossdroprate = getWorldProperty(p, "bossdroprate", i, ServerConstants.BOSS_DROP_RATE); - int questrate = getWorldProperty(p, "questrate", i, ServerConstants.QUEST_RATE); - int travelrate = getWorldProperty(p, "travelrate", i, ServerConstants.TRAVEL_RATE); - int fishingrate = getWorldProperty(p, "fishrate", i, ServerConstants.FISHING_RATE); + + int exprate = YamlConfig.config.worlds.get(i).exp_rate; + int mesorate = YamlConfig.config.worlds.get(i).meso_rate; + int droprate = YamlConfig.config.worlds.get(i).drop_rate; + int bossdroprate = YamlConfig.config.worlds.get(i).boss_drop_rate; + int questrate = YamlConfig.config.worlds.get(i).quest_rate; + int travelrate = YamlConfig.config.worlds.get(i).travel_rate; + int fishingrate = YamlConfig.config.worlds.get(i).fishing_rate; + + int flag = YamlConfig.config.worlds.get(i).flag; + String event_message = YamlConfig.config.worlds.get(i).event_message; + String why_am_i_recommended = YamlConfig.config.worlds.get(i).why_am_i_recommended; World world = new World(i, - Integer.parseInt(p.getProperty("flag" + i)), - p.getProperty("eventmessage" + i), + flag, + event_message, exprate, droprate, bossdroprate, mesorate, questrate, travelrate, fishingrate); - worldRecommendedList.add(new Pair<>(i, p.getProperty("whyamirecommended" + i))); + worldRecommendedList.add(new Pair<>(i, why_am_i_recommended)); worlds.add(world); Map channelInfo = new HashMap<>(); long bootTime = getCurrentTime(); - for (int j = 1; j <= Integer.parseInt(p.getProperty("channels" + i)); j++) { + for (int j = 1; j <= YamlConfig.config.worlds.get(i).channels; j++) { int channelid = j; Channel channel = new Channel(i, channelid, bootTime); @@ -431,7 +424,7 @@ public class Server { channels.add(i, channelInfo); - world.setServerMessage(p.getProperty("servermessage" + i)); + world.setServerMessage(YamlConfig.config.worlds.get(i).server_message); System.out.println("Finished loading world " + i + "\r\n"); return i; @@ -511,18 +504,6 @@ public class Server { } } - public static Properties loadWorldINI() { - Properties p = new Properties(); - try { - p.load(new FileInputStream("world.ini")); - return p; - } catch (Exception e) { - e.printStackTrace(); - System.out.println("[SEVERE] Could not find/open 'world.ini'."); - return null; - } - } - private static long getTimeLeftForNextHour() { Calendar nextHour = Calendar.getInstance(); nextHour.add(Calendar.HOUR, 1); @@ -547,7 +528,7 @@ public class Server { } public static void cleanNxcodeCoupons(Connection con) throws SQLException { - if (!ServerConstants.USE_CLEAR_OUTDATED_COUPONS) return; + if (!YamlConfig.config.server.USE_CLEAR_OUTDATED_COUPONS) return; long timeClear = System.currentTimeMillis() - 14 * 24 * 60 * 60 * 1000; @@ -705,7 +686,7 @@ public class Server { public List> getWorldPlayerRanking(int worldid) { wldRLock.lock(); try { - return new ArrayList<>(playerRanking.get(!ServerConstants.USE_WHOLE_SERVER_RANKING ? worldid : 0)); + return new ArrayList<>(playerRanking.get(!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING ? worldid : 0)); } finally { wldRLock.unlock(); } @@ -716,7 +697,7 @@ public class Server { if(!ranking.isEmpty()) { wldWLock.lock(); try { - if (!ServerConstants.USE_WHOLE_SERVER_RANKING) { + if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { for(int i = playerRanking.size(); i <= worldid; i++) { playerRanking.add(new ArrayList>(0)); } @@ -732,7 +713,7 @@ public class Server { } private void removeWorldPlayerRanking() { - if (!ServerConstants.USE_WHOLE_SERVER_RANKING) { + if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { wldWLock.lock(); try { if(playerRanking.size() < this.getWorldsSize()) { @@ -760,7 +741,7 @@ public class Server { if(!rankUpdates.isEmpty()) { wldWLock.lock(); try { - if (!ServerConstants.USE_WHOLE_SERVER_RANKING) { + if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { for(int i = playerRanking.size(); i <= rankUpdates.get(rankUpdates.size() - 1).getLeft(); i++) { playerRanking.add(new ArrayList>(0)); } @@ -778,7 +759,7 @@ public class Server { } private void initWorldPlayerRanking() { - if (ServerConstants.USE_WHOLE_SERVER_RANKING) { + if (YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { playerRanking.add(new ArrayList>(0)); } updateWorldPlayerRanking(); @@ -795,7 +776,7 @@ public class Server { con = DatabaseConnection.getConnection(); String worldQuery; - if (!ServerConstants.USE_WHOLE_SERVER_RANKING) { + if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { if(worldid >= 0) { worldQuery = (" AND `characters`.`world` = " + worldid); } else { @@ -805,10 +786,10 @@ public class Server { worldQuery = (" AND `characters`.`world` >= 0 AND `characters`.`world` <= " + Math.abs(worldid)); } - ps = con.prepareStatement("SELECT `characters`.`name`, `characters`.`level`, `characters`.`world` FROM `characters` LEFT JOIN accounts ON accounts.id = characters.accountid WHERE `characters`.`gm` < 2 AND `accounts`.`banned` = '0'" + worldQuery + " ORDER BY " + (!ServerConstants.USE_WHOLE_SERVER_RANKING ? "world, " : "") + "level DESC, exp DESC, lastExpGainTime ASC LIMIT 50"); + ps = con.prepareStatement("SELECT `characters`.`name`, `characters`.`level`, `characters`.`world` FROM `characters` LEFT JOIN accounts ON accounts.id = characters.accountid WHERE `characters`.`gm` < 2 AND `accounts`.`banned` = '0'" + worldQuery + " ORDER BY " + (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING ? "world, " : "") + "level DESC, exp DESC, lastExpGainTime ASC LIMIT 50"); rs = ps.executeQuery(); - if (!ServerConstants.USE_WHOLE_SERVER_RANKING) { + if (!YamlConfig.config.server.USE_WHOLE_SERVER_RANKING) { int currentWorld = -1; while(rs.next()) { int rsWorld = rs.getInt("world"); @@ -854,17 +835,12 @@ public class Server { } public void init() { - Properties p = loadWorldINI(); - if(p == null) { - System.exit(0); - } - System.out.println("HeavenMS v" + ServerConstants.VERSION + " starting up.\r\n"); - if(ServerConstants.SHUTDOWNHOOK) + if(YamlConfig.config.server.SHUTDOWNHOOK) Runtime.getRuntime().addShutdownHook(new Thread(shutdown(false))); - TimeZone.setDefault(TimeZone.getTimeZone(ServerConstants.TIMEZONE)); + TimeZone.setDefault(TimeZone.getTimeZone(YamlConfig.config.server.TIMEZONE)); Connection c = null; try { @@ -897,21 +873,21 @@ public class Server { ThreadManager.getInstance().start(); TimerManager tMan = TimerManager.getInstance(); tMan.start(); - tMan.register(tMan.purge(), ServerConstants.PURGING_INTERVAL);//Purging ftw... + tMan.register(tMan.purge(), YamlConfig.config.server.PURGING_INTERVAL);//Purging ftw... disconnectIdlesOnLoginTask(); long timeLeft = getTimeLeftForNextHour(); - tMan.register(new CharacterDiseaseWorker(), ServerConstants.UPDATE_INTERVAL, ServerConstants.UPDATE_INTERVAL); + tMan.register(new CharacterDiseaseWorker(), YamlConfig.config.server.UPDATE_INTERVAL, YamlConfig.config.server.UPDATE_INTERVAL); tMan.register(new ReleaseLockWorker(), 2 * 60 * 1000, 2 * 60 * 1000); - tMan.register(new CouponWorker(), ServerConstants.COUPON_INTERVAL, timeLeft); + tMan.register(new CouponWorker(), YamlConfig.config.server.COUPON_INTERVAL, timeLeft); tMan.register(new RankingCommandWorker(), 5 * 60 * 1000, 5 * 60 * 1000); - tMan.register(new RankingLoginWorker(), ServerConstants.RANKING_INTERVAL, timeLeft); + tMan.register(new RankingLoginWorker(), YamlConfig.config.server.RANKING_INTERVAL, timeLeft); tMan.register(new LoginCoordinatorWorker(), 60 * 60 * 1000, timeLeft); tMan.register(new EventRecallCoordinatorWorker(), 60 * 60 * 1000, timeLeft); tMan.register(new LoginStorageWorker(), 2 * 60 * 1000, 2 * 60 * 1000); tMan.register(new DueyFredrickWorker(), 60 * 60 * 1000, timeLeft); tMan.register(new InvitationWorker(), 30 * 1000, 30 * 1000); - tMan.register(new RespawnWorker(), ServerConstants.RESPAWN_INTERVAL, ServerConstants.RESPAWN_INTERVAL); + tMan.register(new RespawnWorker(), YamlConfig.config.server.RESPAWN_INTERVAL, YamlConfig.config.server.RESPAWN_INTERVAL); timeLeft = getTimeLeftForNextDay(); MapleExpeditionBossLog.resetBossLogTable(); @@ -932,13 +908,13 @@ public class Server { NewYearCardRecord.startPendingNewYearCardRequests(); - if(ServerConstants.USE_THREAD_TRACKER) ThreadTracker.getInstance().registerThreadTrackerTask(); + if(YamlConfig.config.server.USE_THREAD_TRACKER) ThreadTracker.getInstance().registerThreadTrackerTask(); try { - Integer worldCount = Math.min(GameConstants.WORLD_NAMES.length, Integer.parseInt(p.getProperty("worlds"))); + Integer worldCount = Math.min(GameConstants.WORLD_NAMES.length, YamlConfig.config.worlds.size()); for (int i = 0; i < worldCount; i++) { - initWorld(p); + initWorld(); } initWorldPlayerRanking(); @@ -952,7 +928,7 @@ public class Server { System.out.println(); - if(ServerConstants.USE_FAMILY_SYSTEM) { + if(YamlConfig.config.server.USE_FAMILY_SYSTEM) { timeToTake = System.currentTimeMillis(); MapleFamily.loadAllFamilies(); System.out.println("Families loaded in " + ((System.currentTimeMillis() - timeToTake) / 1000.0) + " seconds\r\n"); @@ -1767,7 +1743,7 @@ public class Server { } public boolean validateCharacteridInTransition(IoSession session, int charId) { - if (!ServerConstants.USE_IP_VALIDATION) { + if (!YamlConfig.config.server.USE_IP_VALIDATION) { return true; } @@ -1783,7 +1759,7 @@ public class Server { } public Integer freeCharacteridInTransition(IoSession session) { - if (!ServerConstants.USE_IP_VALIDATION) { + if (!YamlConfig.config.server.USE_IP_VALIDATION) { return null; } @@ -1798,7 +1774,7 @@ public class Server { } public boolean hasCharacteridInTransition(IoSession session) { - if (!ServerConstants.USE_IP_VALIDATION) { + if (!YamlConfig.config.server.USE_IP_VALIDATION) { return true; } @@ -1905,7 +1881,7 @@ public class Server { List allChannels = getAllChannels(); - if(ServerConstants.USE_THREAD_TRACKER) ThreadTracker.getInstance().cancelThreadTrackerTask(); + if(YamlConfig.config.server.USE_THREAD_TRACKER) ThreadTracker.getInstance().cancelThreadTrackerTask(); for (Channel ch : allChannels) { while (!ch.finishedShutdown()) { diff --git a/src/net/server/audit/locks/active/TrackerReadLock.java b/src/net/server/audit/locks/active/TrackerReadLock.java index bed688d8f0..4b05805d0a 100644 --- a/src/net/server/audit/locks/active/TrackerReadLock.java +++ b/src/net/server/audit/locks/active/TrackerReadLock.java @@ -19,6 +19,7 @@ */ package net.server.audit.locks.active; +import config.YamlConfig; import constants.ServerConstants; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -59,7 +60,7 @@ public class TrackerReadLock extends ReentrantReadWriteLock.ReadLock implements @Override public void lock() { - if(ServerConstants.USE_THREAD_TRACKER) { + if(YamlConfig.config.server.USE_THREAD_TRACKER) { if(deadlockedState != null) { DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); dateFormat.setTimeZone(TimeZone.getDefault()); @@ -77,7 +78,7 @@ public class TrackerReadLock extends ReentrantReadWriteLock.ReadLock implements @Override public void unlock() { - if(ServerConstants.USE_THREAD_TRACKER) { + if(YamlConfig.config.server.USE_THREAD_TRACKER) { unregisterLocking(); } @@ -87,7 +88,7 @@ public class TrackerReadLock extends ReentrantReadWriteLock.ReadLock implements @Override public boolean tryLock() { if(super.tryLock()) { - if(ServerConstants.USE_THREAD_TRACKER) { + if(YamlConfig.config.server.USE_THREAD_TRACKER) { if(deadlockedState != null) { //FilePrinter.printError(FilePrinter.DEADLOCK_ERROR, "Deadlock occurred when trying to use the '" + id.name() + "' lock resources:\r\n" + printStackTrace(deadlockedState)); ThreadTracker.getInstance().accessThreadTracker(true, true, id, hashcode); @@ -114,7 +115,7 @@ public class TrackerReadLock extends ReentrantReadWriteLock.ReadLock implements public void run() { issueDeadlock(t); } - }, ServerConstants.LOCK_MONITOR_TIME); + }, YamlConfig.config.server.LOCK_MONITOR_TIME); } } finally { state.unlock(); diff --git a/src/net/server/audit/locks/active/TrackerReentrantLock.java b/src/net/server/audit/locks/active/TrackerReentrantLock.java index 5a211086f2..3f1432465e 100644 --- a/src/net/server/audit/locks/active/TrackerReentrantLock.java +++ b/src/net/server/audit/locks/active/TrackerReentrantLock.java @@ -23,6 +23,8 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.ScheduledFuture; + +import config.YamlConfig; import constants.ServerConstants; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -61,7 +63,7 @@ public class TrackerReentrantLock extends ReentrantLock implements MonitoredReen @Override public void lock() { - if(ServerConstants.USE_THREAD_TRACKER) { + if(YamlConfig.config.server.USE_THREAD_TRACKER) { if(deadlockedState != null) { DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); dateFormat.setTimeZone(TimeZone.getDefault()); @@ -79,7 +81,7 @@ public class TrackerReentrantLock extends ReentrantLock implements MonitoredReen @Override public void unlock() { - if(ServerConstants.USE_THREAD_TRACKER) { + if(YamlConfig.config.server.USE_THREAD_TRACKER) { unregisterLocking(); } @@ -89,7 +91,7 @@ public class TrackerReentrantLock extends ReentrantLock implements MonitoredReen @Override public boolean tryLock() { if(super.tryLock()) { - if(ServerConstants.USE_THREAD_TRACKER) { + if(YamlConfig.config.server.USE_THREAD_TRACKER) { if(deadlockedState != null) { //FilePrinter.printError(FilePrinter.DEADLOCK_ERROR, "Deadlock occurred when trying to use the '" + id.name() + "' lock resources:\r\n" + printStackTrace(deadlockedState)); ThreadTracker.getInstance().accessThreadTracker(true, true, id, hashcode); @@ -116,7 +118,7 @@ public class TrackerReentrantLock extends ReentrantLock implements MonitoredReen public void run() { issueDeadlock(t); } - }, ServerConstants.LOCK_MONITOR_TIME); + }, YamlConfig.config.server.LOCK_MONITOR_TIME); } } finally { state.unlock(); diff --git a/src/net/server/audit/locks/active/TrackerWriteLock.java b/src/net/server/audit/locks/active/TrackerWriteLock.java index dd160fcad9..e77aaec924 100644 --- a/src/net/server/audit/locks/active/TrackerWriteLock.java +++ b/src/net/server/audit/locks/active/TrackerWriteLock.java @@ -19,6 +19,7 @@ */ package net.server.audit.locks.active; +import config.YamlConfig; import constants.ServerConstants; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -57,7 +58,7 @@ public class TrackerWriteLock extends ReentrantReadWriteLock.WriteLock implement @Override public void lock() { - if(ServerConstants.USE_THREAD_TRACKER) { + if(YamlConfig.config.server.USE_THREAD_TRACKER) { if(deadlockedState != null) { DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); dateFormat.setTimeZone(TimeZone.getDefault()); @@ -75,7 +76,7 @@ public class TrackerWriteLock extends ReentrantReadWriteLock.WriteLock implement @Override public void unlock() { - if(ServerConstants.USE_THREAD_TRACKER) { + if(YamlConfig.config.server.USE_THREAD_TRACKER) { unregisterLocking(); } @@ -85,7 +86,7 @@ public class TrackerWriteLock extends ReentrantReadWriteLock.WriteLock implement @Override public boolean tryLock() { if(super.tryLock()) { - if(ServerConstants.USE_THREAD_TRACKER) { + if(YamlConfig.config.server.USE_THREAD_TRACKER) { if(deadlockedState != null) { //FilePrinter.printError(FilePrinter.DEADLOCK_ERROR, "Deadlock occurred when trying to use the '" + id.name() + "' lock resources:\r\n" + printStackTrace(deadlockedState)); ThreadTracker.getInstance().accessThreadTracker(true, true, id, hashcode); @@ -112,7 +113,7 @@ public class TrackerWriteLock extends ReentrantReadWriteLock.WriteLock implement public void run() { issueDeadlock(t); } - }, ServerConstants.LOCK_MONITOR_TIME); + }, YamlConfig.config.server.LOCK_MONITOR_TIME); } } finally { state.unlock(); diff --git a/src/net/server/channel/Channel.java b/src/net/server/channel/Channel.java index 4433d65d4c..aaa7aa64e2 100644 --- a/src/net/server/channel/Channel.java +++ b/src/net/server/channel/Channel.java @@ -37,6 +37,8 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; + +import config.YamlConfig; import net.server.audit.LockCollector; import net.server.audit.locks.MonitoredLockType; import net.server.audit.locks.MonitoredReentrantLock; @@ -88,13 +90,13 @@ public final class Channel { private String ip, serverMessage; private MapleMapManager mapManager; private EventScriptManager eventSM; - private MobStatusScheduler mobStatusSchedulers[] = new MobStatusScheduler[ServerConstants.CHANNEL_LOCKS]; - private MobAnimationScheduler mobAnimationSchedulers[] = new MobAnimationScheduler[ServerConstants.CHANNEL_LOCKS]; - private MobClearSkillScheduler mobClearSkillSchedulers[] = new MobClearSkillScheduler[ServerConstants.CHANNEL_LOCKS]; - private MobMistScheduler mobMistSchedulers[] = new MobMistScheduler[ServerConstants.CHANNEL_LOCKS]; - private FaceExpressionScheduler faceExpressionSchedulers[] = new FaceExpressionScheduler[ServerConstants.CHANNEL_LOCKS]; - private EventScheduler eventSchedulers[] = new EventScheduler[ServerConstants.CHANNEL_LOCKS]; - private OverallScheduler channelSchedulers[] = new OverallScheduler[ServerConstants.CHANNEL_LOCKS]; + private MobStatusScheduler mobStatusSchedulers[] = new MobStatusScheduler[YamlConfig.config.server.CHANNEL_LOCKS]; + private MobAnimationScheduler mobAnimationSchedulers[] = new MobAnimationScheduler[YamlConfig.config.server.CHANNEL_LOCKS]; + private MobClearSkillScheduler mobClearSkillSchedulers[] = new MobClearSkillScheduler[YamlConfig.config.server.CHANNEL_LOCKS]; + private MobMistScheduler mobMistSchedulers[] = new MobMistScheduler[YamlConfig.config.server.CHANNEL_LOCKS]; + private FaceExpressionScheduler faceExpressionSchedulers[] = new FaceExpressionScheduler[YamlConfig.config.server.CHANNEL_LOCKS]; + private EventScheduler eventSchedulers[] = new EventScheduler[YamlConfig.config.server.CHANNEL_LOCKS]; + private OverallScheduler channelSchedulers[] = new OverallScheduler[YamlConfig.config.server.CHANNEL_LOCKS]; private Map hiredMerchants = new HashMap<>(); private final Map storedVars = new HashMap<>(); private Set playersAway = new HashSet<>(); @@ -129,7 +131,7 @@ public final class Channel { private ReadLock merchRlock = merchantLock.readLock(); private WriteLock merchWlock = merchantLock.writeLock(); - private MonitoredReentrantLock faceLock[] = new MonitoredReentrantLock[ServerConstants.CHANNEL_LOCKS]; + private MonitoredReentrantLock faceLock[] = new MonitoredReentrantLock[YamlConfig.config.server.CHANNEL_LOCKS]; private MonitoredReentrantLock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHANNEL, true); @@ -143,7 +145,7 @@ public final class Channel { eventSM = new EventScriptManager(this, getEvents()); port = 7575 + this.channel - 1; port += (world * 100); - ip = ServerConstants.HOST + ":" + port; + ip = YamlConfig.config.server.HOST + ":" + port; IoBuffer.setUseDirectBuffer(false); IoBuffer.setAllocator(new SimpleBufferAllocator()); acceptor = new NioSocketAcceptor(); @@ -166,7 +168,7 @@ public final class Channel { dojoTask[i] = null; } - for(int i = 0; i < ServerConstants.CHANNEL_LOCKS; i++) { + for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) { faceLock[i] = MonitoredReentrantLockFactory.createLock(MonitoredLockType.CHANNEL_FACEEXPRS, true); mobStatusSchedulers[i] = new MobStatusScheduler(); @@ -228,7 +230,7 @@ public final class Channel { } } - for(int i = 0; i < ServerConstants.CHANNEL_LOCKS; i++) { + for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) { if(mobStatusSchedulers[i] != null) { mobStatusSchedulers[i].dispose(); mobStatusSchedulers[i] = null; @@ -278,7 +280,7 @@ public final class Channel { } private void emptyLocks() { - for(int i = 0; i < ServerConstants.CHANNEL_LOCKS; i++) { + for(int i = 0; i < YamlConfig.config.server.CHANNEL_LOCKS; i++) { faceLock[i] = faceLock[i].dispose(); } @@ -335,7 +337,7 @@ public final class Channel { } public int getChannelCapacity() { - return (int)(Math.ceil(((float) players.getAllCharacters().size() / ServerConstants.CHANNEL_LOAD) * 800)); + return (int)(Math.ceil(((float) players.getAllCharacters().size() / YamlConfig.config.server.CHANNEL_LOAD) * 800)); } public void broadcastPacket(final byte[] data) { @@ -786,7 +788,7 @@ public final class Channel { try { List weddingReservationQueue = (cathedral ? cathedralReservationQueue : chapelReservationQueue); - int delay = ServerConstants.WEDDING_RESERVATION_DELAY - 1 - weddingReservationQueue.size(); + int delay = YamlConfig.config.server.WEDDING_RESERVATION_DELAY - 1 - weddingReservationQueue.size(); for(int i = 0; i < delay; i++) { weddingReservationQueue.add(null); // push empty slots to fill the waiting time } @@ -869,7 +871,7 @@ public final class Channel { public void run() { closeOngoingWedding(cathedral); } - }, ServerConstants.WEDDING_RESERVATION_TIMEOUT * 60 * 1000); + }, YamlConfig.config.server.WEDDING_RESERVATION_TIMEOUT * 60 * 1000); if(cathedral) { cathedralReservationTask = weddingTask; @@ -933,7 +935,7 @@ public final class Channel { } public static long getRelativeWeddingTicketExpireTime(int resSlot) { - return (resSlot * ServerConstants.WEDDING_RESERVATION_INTERVAL * 60 * 1000); + return (resSlot * YamlConfig.config.server.WEDDING_RESERVATION_INTERVAL * 60 * 1000); } public String getWeddingReservationTimeLeft(Integer weddingId) { @@ -959,7 +961,7 @@ public final class Channel { return venue + " - RIGHT NOW"; } - return venue + " - " + getTimeLeft(ongoingStartTime + (resStatus * ServerConstants.WEDDING_RESERVATION_INTERVAL * 60 * 1000)) + " from now"; + return venue + " - " + getTimeLeft(ongoingStartTime + (resStatus * YamlConfig.config.server.WEDDING_RESERVATION_INTERVAL * 60 * 1000)) + " from now"; } finally { lock.unlock(); } @@ -1019,7 +1021,7 @@ public final class Channel { } private static int getChannelSchedulerIndex(int mapid) { - int section = 1000000000 / ServerConstants.CHANNEL_LOCKS; + int section = 1000000000 / YamlConfig.config.server.CHANNEL_LOCKS; return mapid / section; } diff --git a/src/net/server/channel/handlers/AbstractDealDamageHandler.java b/src/net/server/channel/handlers/AbstractDealDamageHandler.java index 2ca1a9bcec..ec977f1501 100644 --- a/src/net/server/channel/handlers/AbstractDealDamageHandler.java +++ b/src/net/server/channel/handlers/AbstractDealDamageHandler.java @@ -28,6 +28,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import config.YamlConfig; import net.AbstractMaplePacketHandler; import server.MapleStatEffect; import server.TimerManager; @@ -462,7 +463,7 @@ public abstract class AbstractDealDamageHandler extends AbstractMaplePacketHandl int threeSnailsId = player.getJobType() * 10000000 + 1000; if(attack.skill == threeSnailsId) { - if(ServerConstants.USE_ULTRA_THREE_SNAILS) { + if(YamlConfig.config.server.USE_ULTRA_THREE_SNAILS) { int skillLv = player.getSkillLevel(threeSnailsId); if(skillLv > 0) { diff --git a/src/net/server/channel/handlers/AcceptFamilyHandler.java b/src/net/server/channel/handlers/AcceptFamilyHandler.java index 4bffaa5d50..670f37fec4 100644 --- a/src/net/server/channel/handlers/AcceptFamilyHandler.java +++ b/src/net/server/channel/handlers/AcceptFamilyHandler.java @@ -21,6 +21,7 @@ */ package net.server.channel.handlers; +import config.YamlConfig; import constants.ServerConstants; import java.sql.Connection; @@ -50,7 +51,7 @@ public final class AcceptFamilyHandler extends AbstractMaplePacketHandler { @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { - if(!ServerConstants.USE_FAMILY_SYSTEM) { + if(!YamlConfig.config.server.USE_FAMILY_SYSTEM) { return; } MapleCharacter chr = c.getPlayer(); @@ -79,7 +80,7 @@ public final class AcceptFamilyHandler extends AbstractMaplePacketHandler { MapleFamilyEntry targetEntry = chr.getFamilyEntry(); MapleFamily targetFamily = targetEntry.getFamily(); if(targetFamily.getLeader() != targetEntry) return; - if(inviter.getFamily().getTotalGenerations() + targetFamily.getTotalGenerations() <= ServerConstants.FAMILY_MAX_GENERATIONS) { + if(inviter.getFamily().getTotalGenerations() + targetFamily.getTotalGenerations() <= YamlConfig.config.server.FAMILY_MAX_GENERATIONS) { targetEntry.join(inviter.getFamilyEntry()); } else { inviter.announce(MaplePacketCreator.sendFamilyMessage(76, 0)); @@ -88,7 +89,7 @@ public final class AcceptFamilyHandler extends AbstractMaplePacketHandler { } } } else { // create new family - if(chr.getFamily() != null && inviter.getFamily() != null && chr.getFamily().getTotalGenerations() + inviter.getFamily().getTotalGenerations() >= ServerConstants.FAMILY_MAX_GENERATIONS) { + if(chr.getFamily() != null && inviter.getFamily() != null && chr.getFamily().getTotalGenerations() + inviter.getFamily().getTotalGenerations() >= YamlConfig.config.server.FAMILY_MAX_GENERATIONS) { inviter.announce(MaplePacketCreator.sendFamilyMessage(76, 0)); chr.announce(MaplePacketCreator.sendFamilyMessage(76, 0)); return; diff --git a/src/net/server/channel/handlers/AdminChatHandler.java b/src/net/server/channel/handlers/AdminChatHandler.java index a27edfa2d0..35be0f800b 100644 --- a/src/net/server/channel/handlers/AdminChatHandler.java +++ b/src/net/server/channel/handlers/AdminChatHandler.java @@ -1,6 +1,7 @@ package net.server.channel.handlers; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import tools.LogHelper; @@ -25,19 +26,19 @@ public class AdminChatHandler extends AbstractMaplePacketHandler { switch (mode) { case 0:// /alertall, /noticeall, /slideall c.getWorldServer().broadcastPacket(packet); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "Alert All", message); } break; case 1:// /alertch, /noticech, /slidech c.getChannelServer().broadcastPacket(packet); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "Alert Ch", message); } break; case 2:// /alertm /alertmap, /noticem /noticemap, /slidem /slidemap c.getPlayer().getMap().broadcastMessage(packet); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "Alert Map", message); } break; diff --git a/src/net/server/channel/handlers/CashOperationHandler.java b/src/net/server/channel/handlers/CashOperationHandler.java index f1b51fadf8..ca25e216fb 100644 --- a/src/net/server/channel/handlers/CashOperationHandler.java +++ b/src/net/server/channel/handlers/CashOperationHandler.java @@ -28,6 +28,7 @@ import client.inventory.Equip; import client.inventory.Item; import client.inventory.MapleInventory; import client.inventory.MapleInventoryType; +import config.YamlConfig; import constants.ItemConstants; import java.sql.SQLException; import java.util.Calendar; @@ -76,7 +77,7 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler { if (ItemConstants.isCashStore(cItem.getItemId()) && chr.getLevel() < 16) { c.enableCSActions(); return; - } else if (ItemConstants.isRateCoupon(cItem.getItemId()) && !ServerConstants.USE_SUPPLY_RATE_COUPONS) { + } else if (ItemConstants.isRateCoupon(cItem.getItemId()) && !YamlConfig.config.server.USE_SUPPLY_RATE_COUPONS) { chr.dropMessage(1, "Rate coupons are currently unavailable to purchase."); c.enableCSActions(); return; @@ -376,7 +377,7 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler { c.enableCSActions(); return; } - if(cItem.getSN() == 50600000 && ServerConstants.ALLOW_CASHSHOP_NAME_CHANGE) { + if(cItem.getSN() == 50600000 && YamlConfig.config.server.ALLOW_CASHSHOP_NAME_CHANGE) { slea.readMapleAsciiString(); //old name String newName = slea.readMapleAsciiString(); if(!MapleCharacter.canCreateChar(newName) || chr.getLevel() < 10) { //(longest ban duration isn't tracked currently) @@ -405,7 +406,7 @@ public final class CashOperationHandler extends AbstractMaplePacketHandler { c.enableCSActions(); return; } - if(cItem.getSN() == 50600001 && ServerConstants.ALLOW_CASHSHOP_WORLD_TRANSFER) { + if(cItem.getSN() == 50600001 && YamlConfig.config.server.ALLOW_CASHSHOP_WORLD_TRANSFER) { int newWorldSelection = slea.readInt(); int worldTransferError = chr.checkWorldTransferEligibility(); diff --git a/src/net/server/channel/handlers/CloseRangeDamageHandler.java b/src/net/server/channel/handlers/CloseRangeDamageHandler.java index cc5551c571..3f23247fac 100644 --- a/src/net/server/channel/handlers/CloseRangeDamageHandler.java +++ b/src/net/server/channel/handlers/CloseRangeDamageHandler.java @@ -25,6 +25,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import config.YamlConfig; import server.MapleStatEffect; import tools.MaplePacketCreator; import tools.Pair; @@ -70,7 +71,7 @@ public final class CloseRangeDamageHandler extends AbstractDealDamageHandler { if (chr.getDojoEnergy() < 10000 && (attack.skill == 1009 || attack.skill == 10001009 || attack.skill == 20001009)) // PE hacking or maybe just lagging return; if (chr.getMap().isDojoMap() && attack.numAttacked > 0) { - chr.setDojoEnergy(chr.getDojoEnergy() + ServerConstants.DOJO_ENERGY_ATK); + chr.setDojoEnergy(chr.getDojoEnergy() + YamlConfig.config.server.DOJO_ENERGY_ATK); c.announce(MaplePacketCreator.getEnergy("energy", chr.getDojoEnergy())); } diff --git a/src/net/server/channel/handlers/DueyHandler.java b/src/net/server/channel/handlers/DueyHandler.java index 89fc361282..71c0bdd390 100644 --- a/src/net/server/channel/handlers/DueyHandler.java +++ b/src/net/server/channel/handlers/DueyHandler.java @@ -23,6 +23,7 @@ package net.server.channel.handlers; import client.MapleClient; import client.processor.DueyProcessor; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; @@ -33,7 +34,7 @@ public final class DueyHandler extends AbstractMaplePacketHandler { @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { - if (!ServerConstants.USE_DUEY){ + if (!YamlConfig.config.server.USE_DUEY){ c.announce(MaplePacketCreator.enableActions()); return; } diff --git a/src/net/server/channel/handlers/EnterMTSHandler.java b/src/net/server/channel/handlers/EnterMTSHandler.java index ce78a5ca12..8de629d4e9 100644 --- a/src/net/server/channel/handlers/EnterMTSHandler.java +++ b/src/net/server/channel/handlers/EnterMTSHandler.java @@ -28,6 +28,7 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; +import config.YamlConfig; import constants.ServerConstants; import client.MapleCharacter; import client.MapleClient; @@ -49,11 +50,11 @@ public final class EnterMTSHandler extends AbstractMaplePacketHandler { public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { MapleCharacter chr = c.getPlayer(); - if(!chr.isAlive() && ServerConstants.USE_BUYBACK_SYSTEM) { + if(!chr.isAlive() && YamlConfig.config.server.USE_BUYBACK_SYSTEM) { BuybackProcessor.processBuyback(c); c.announce(MaplePacketCreator.enableActions()); } else { - if (!ServerConstants.USE_MTS) { + if (!YamlConfig.config.server.USE_MTS) { c.announce(MaplePacketCreator.enableActions()); return; } diff --git a/src/net/server/channel/handlers/FamilyAddHandler.java b/src/net/server/channel/handlers/FamilyAddHandler.java index a7638e401d..1553908173 100644 --- a/src/net/server/channel/handlers/FamilyAddHandler.java +++ b/src/net/server/channel/handlers/FamilyAddHandler.java @@ -21,6 +21,7 @@ */ package net.server.channel.handlers; +import config.YamlConfig; import constants.ServerConstants; import client.MapleCharacter; import client.MapleClient; @@ -38,7 +39,7 @@ import tools.data.input.SeekableLittleEndianAccessor; public final class FamilyAddHandler extends AbstractMaplePacketHandler { @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { - if(!ServerConstants.USE_FAMILY_SYSTEM) { + if(!YamlConfig.config.server.USE_FAMILY_SYSTEM) { return; } String toAdd = slea.readMapleAsciiString(); @@ -58,7 +59,7 @@ public final class FamilyAddHandler extends AbstractMaplePacketHandler { c.announce(MaplePacketCreator.enableActions()); } else if(MapleInviteCoordinator.hasInvite(InviteType.FAMILY, addChr.getId())) { c.announce(MaplePacketCreator.sendFamilyMessage(73, 0)); - } else if(chr.getFamily() != null && addChr.getFamily() != null && addChr.getFamily().getTotalGenerations() + chr.getFamily().getTotalGenerations() > ServerConstants.FAMILY_MAX_GENERATIONS) { + } else if(chr.getFamily() != null && addChr.getFamily() != null && addChr.getFamily().getTotalGenerations() + chr.getFamily().getTotalGenerations() > YamlConfig.config.server.FAMILY_MAX_GENERATIONS) { c.announce(MaplePacketCreator.sendFamilyMessage(76, 0)); } else { MapleInviteCoordinator.createInvite(InviteType.FAMILY, chr, addChr, addChr.getId()); diff --git a/src/net/server/channel/handlers/FamilySeparateHandler.java b/src/net/server/channel/handlers/FamilySeparateHandler.java index 191ce23a38..1dee691f5c 100644 --- a/src/net/server/channel/handlers/FamilySeparateHandler.java +++ b/src/net/server/channel/handlers/FamilySeparateHandler.java @@ -22,6 +22,7 @@ package net.server.channel.handlers; import client.MapleClient; import client.MapleFamily; import client.MapleFamilyEntry; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import tools.MaplePacketCreator; @@ -31,7 +32,7 @@ public class FamilySeparateHandler extends AbstractMaplePacketHandler { @Override public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { - if(!ServerConstants.USE_FAMILY_SYSTEM) return; + if(!YamlConfig.config.server.USE_FAMILY_SYSTEM) return; MapleFamily oldFamily = c.getPlayer().getFamily(); if(oldFamily == null) return; MapleFamilyEntry forkOn = null; diff --git a/src/net/server/channel/handlers/FamilySummonResponseHandler.java b/src/net/server/channel/handlers/FamilySummonResponseHandler.java index 96ccee2c44..0bbaa58830 100644 --- a/src/net/server/channel/handlers/FamilySummonResponseHandler.java +++ b/src/net/server/channel/handlers/FamilySummonResponseHandler.java @@ -4,6 +4,7 @@ import client.MapleCharacter; import client.MapleClient; import client.MapleFamilyEntitlement; import client.MapleFamilyEntry; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import net.server.coordinator.MapleInviteCoordinator; @@ -18,7 +19,7 @@ public class FamilySummonResponseHandler extends AbstractMaplePacketHandler { @Override public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { - if(!ServerConstants.USE_FAMILY_SYSTEM) return; + if(!YamlConfig.config.server.USE_FAMILY_SYSTEM) return; slea.readMapleAsciiString(); //family name boolean accept = slea.readByte() != 0; MapleInviteResult inviteResult = MapleInviteCoordinator.answerInvite(InviteType.FAMILY_SUMMON, c.getPlayer().getId(), c.getPlayer(), accept); diff --git a/src/net/server/channel/handlers/FamilyUseHandler.java b/src/net/server/channel/handlers/FamilyUseHandler.java index dd33793e6d..24b2abc758 100644 --- a/src/net/server/channel/handlers/FamilyUseHandler.java +++ b/src/net/server/channel/handlers/FamilyUseHandler.java @@ -25,6 +25,7 @@ import client.MapleCharacter; import client.MapleClient; import client.MapleFamilyEntitlement; import client.MapleFamilyEntry; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import net.server.coordinator.MapleInviteCoordinator; @@ -42,7 +43,7 @@ import tools.data.input.SeekableLittleEndianAccessor; public final class FamilyUseHandler extends AbstractMaplePacketHandler { @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { - if(!ServerConstants.USE_FAMILY_SYSTEM) { + if(!YamlConfig.config.server.USE_FAMILY_SYSTEM) { return; } MapleFamilyEntitlement type = MapleFamilyEntitlement.values()[slea.readInt()]; diff --git a/src/net/server/channel/handlers/GeneralChatHandler.java b/src/net/server/channel/handlers/GeneralChatHandler.java index 5fbea4eb43..dcf8b66b85 100644 --- a/src/net/server/channel/handlers/GeneralChatHandler.java +++ b/src/net/server/channel/handlers/GeneralChatHandler.java @@ -25,6 +25,7 @@ import client.MapleCharacter; import client.MapleClient; import client.autoban.AutobanFactory; import client.command.CommandsExecutor; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import tools.FilePrinter; @@ -59,12 +60,12 @@ public final class GeneralChatHandler extends AbstractMaplePacketHandler { if (!chr.isHidden()) { chr.getMap().broadcastMessage(MaplePacketCreator.getChatText(chr.getId(), s, chr.getWhiteChat(), show)); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "General", s); } } else { chr.getMap().broadcastGMMessage(MaplePacketCreator.getChatText(chr.getId(), s, chr.getWhiteChat(), show)); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "GM General", s); } } diff --git a/src/net/server/channel/handlers/GuildOperationHandler.java b/src/net/server/channel/handlers/GuildOperationHandler.java index cb1a41e189..ac5f0b3b70 100644 --- a/src/net/server/channel/handlers/GuildOperationHandler.java +++ b/src/net/server/channel/handlers/GuildOperationHandler.java @@ -21,6 +21,7 @@ */ package net.server.channel.handlers; +import config.YamlConfig; import net.server.guild.MapleGuildResponse; import net.server.guild.MapleGuild; import constants.GameConstants; @@ -65,8 +66,8 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler { mc.dropMessage(1, "You cannot create a new Guild while in one."); return; } - if (mc.getMeso() < ServerConstants.CREATE_GUILD_COST) { - mc.dropMessage(1, "You do not have " + GameConstants.numberWithCommas(ServerConstants.CREATE_GUILD_COST) + " mesos to create a Guild."); + if (mc.getMeso() < YamlConfig.config.server.CREATE_GUILD_COST) { + mc.dropMessage(1, "You do not have " + GameConstants.numberWithCommas(YamlConfig.config.server.CREATE_GUILD_COST) + " mesos to create a Guild."); return; } String guildName = slea.readMapleAsciiString(); @@ -76,8 +77,8 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler { } Set eligibleMembers = new HashSet<>(MapleGuild.getEligiblePlayersForGuild(mc)); - if (eligibleMembers.size() < ServerConstants.CREATE_GUILD_MIN_PARTNERS) { - if (mc.getMap().getAllPlayers().size() < ServerConstants.CREATE_GUILD_MIN_PARTNERS) { + if (eligibleMembers.size() < YamlConfig.config.server.CREATE_GUILD_MIN_PARTNERS) { + if (mc.getMap().getAllPlayers().size() < YamlConfig.config.server.CREATE_GUILD_MIN_PARTNERS) { // thanks NovaStory for noticing message in need of smoother info mc.dropMessage(1, "Your Guild doesn't have enough cofounders present here and therefore cannot be created at this time."); } else { @@ -211,8 +212,8 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler { System.out.println("[Hack] " + mc.getName() + " tried to change guild emblem without being the guild leader."); return; } - if (mc.getMeso() < ServerConstants.CHANGE_EMBLEM_COST) { - c.announce(MaplePacketCreator.serverNotice(1, "You do not have " + GameConstants.numberWithCommas(ServerConstants.CHANGE_EMBLEM_COST) + " mesos to change the Guild emblem.")); + if (mc.getMeso() < YamlConfig.config.server.CHANGE_EMBLEM_COST) { + c.announce(MaplePacketCreator.serverNotice(1, "You do not have " + GameConstants.numberWithCommas(YamlConfig.config.server.CHANGE_EMBLEM_COST) + " mesos to change the Guild emblem.")); return; } short bg = slea.readShort(); @@ -226,7 +227,7 @@ public final class GuildOperationHandler extends AbstractMaplePacketHandler { Server.getInstance().allianceMessage(alliance.getId(), MaplePacketCreator.getGuildAlliances(alliance, c.getWorld()), -1, -1); } - mc.gainMeso(-ServerConstants.CHANGE_EMBLEM_COST, true, false, true); + mc.gainMeso(-YamlConfig.config.server.CHANGE_EMBLEM_COST, true, false, true); mc.getGuild().broadcastNameChanged(); mc.getGuild().broadcastEmblemChanged(); break; diff --git a/src/net/server/channel/handlers/InventoryMergeHandler.java b/src/net/server/channel/handlers/InventoryMergeHandler.java index 43ec9f437e..1e87fa2e23 100644 --- a/src/net/server/channel/handlers/InventoryMergeHandler.java +++ b/src/net/server/channel/handlers/InventoryMergeHandler.java @@ -21,6 +21,7 @@ */ package net.server.channel.handlers; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import client.inventory.manipulator.MapleInventoryManipulator; @@ -42,7 +43,7 @@ public final class InventoryMergeHandler extends AbstractMaplePacketHandler { slea.readInt(); chr.getAutobanManager().setTimestamp(2, Server.getInstance().getCurrentTimestamp(), 4); - if(!ServerConstants.USE_ITEM_SORT) { + if(!YamlConfig.config.server.USE_ITEM_SORT) { c.announce(MaplePacketCreator.enableActions()); return; } diff --git a/src/net/server/channel/handlers/InventorySortHandler.java b/src/net/server/channel/handlers/InventorySortHandler.java index c48a8d9390..5d2b32db38 100644 --- a/src/net/server/channel/handlers/InventorySortHandler.java +++ b/src/net/server/channel/handlers/InventorySortHandler.java @@ -24,6 +24,7 @@ package net.server.channel.handlers; import java.util.ArrayList; import java.util.List; +import config.YamlConfig; import net.AbstractMaplePacketHandler; import tools.MaplePacketCreator; import tools.data.input.SeekableLittleEndianAccessor; @@ -265,7 +266,7 @@ public final class InventorySortHandler extends AbstractMaplePacketHandler { slea.readInt(); chr.getAutobanManager().setTimestamp(3, Server.getInstance().getCurrentTimestamp(), 4); - if(!ServerConstants.USE_ITEM_SORT) { + if(!YamlConfig.config.server.USE_ITEM_SORT) { c.announce(MaplePacketCreator.enableActions()); return; } @@ -295,7 +296,7 @@ public final class InventorySortHandler extends AbstractMaplePacketHandler { } int invTypeCriteria = (MapleInventoryType.getByType(invType) == MapleInventoryType.EQUIP) ? 3 : 1; - int sortCriteria = (ServerConstants.USE_ITEM_SORT_BY_NAME == true) ? 2 : 0; + int sortCriteria = (YamlConfig.config.server.USE_ITEM_SORT_BY_NAME == true) ? 2 : 0; PairedQuicksort pq = new PairedQuicksort(itemarray, sortCriteria, invTypeCriteria); for (Item item : itemarray) { diff --git a/src/net/server/channel/handlers/MagicDamageHandler.java b/src/net/server/channel/handlers/MagicDamageHandler.java index 52778e8b12..cd562e5d63 100644 --- a/src/net/server/channel/handlers/MagicDamageHandler.java +++ b/src/net/server/channel/handlers/MagicDamageHandler.java @@ -21,6 +21,7 @@ */ package net.server.channel.handlers; +import config.YamlConfig; import server.MapleStatEffect; import tools.MaplePacketCreator; import tools.data.input.SeekableLittleEndianAccessor; @@ -58,7 +59,7 @@ public final class MagicDamageHandler extends AbstractDealDamageHandler { } if (chr.getMap().isDojoMap() && attack.numAttacked > 0) { - chr.setDojoEnergy(chr.getDojoEnergy() + + ServerConstants.DOJO_ENERGY_ATK); + chr.setDojoEnergy(chr.getDojoEnergy() + + YamlConfig.config.server.DOJO_ENERGY_ATK); c.announce(MaplePacketCreator.getEnergy("energy", chr.getDojoEnergy())); } diff --git a/src/net/server/channel/handlers/MoveLifeHandler.java b/src/net/server/channel/handlers/MoveLifeHandler.java index b1c52deaef..5c4581fa1f 100644 --- a/src/net/server/channel/handlers/MoveLifeHandler.java +++ b/src/net/server/channel/handlers/MoveLifeHandler.java @@ -26,6 +26,8 @@ import client.MapleClient; import java.awt.Point; import java.util.LinkedList; import java.util.List; + +import config.YamlConfig; import constants.ServerConstants; import server.life.MapleMonster; import server.life.MapleMonsterInformationProvider; @@ -156,7 +158,7 @@ public final class MoveLifeHandler extends AbstractMovementPacketHandler { } if (movementDataLength > 0) { - if (ServerConstants.USE_DEBUG_SHOW_RCVD_MVLIFE) { + if (YamlConfig.config.server.USE_DEBUG_SHOW_RCVD_MVLIFE) { System.out.println((isSkill ? "SKILL " : (isAttack ? "ATTCK " : " ")) + "castPos: " + castPos + " rawAct: " + rawActivity + " opt: " + pOption + " skillID: " + useSkillId + " skillLV: " + useSkillLevel + " " + "allowSkill: " + nextMovementCouldBeSkill + " mobMp: " + mobMp); } slea.seek(movementDataStart); diff --git a/src/net/server/channel/handlers/MultiChatHandler.java b/src/net/server/channel/handlers/MultiChatHandler.java index 8924774c32..a31c265d17 100644 --- a/src/net/server/channel/handlers/MultiChatHandler.java +++ b/src/net/server/channel/handlers/MultiChatHandler.java @@ -24,6 +24,7 @@ package net.server.channel.handlers; import client.MapleCharacter; import client.MapleClient; import client.autoban.AutobanFactory; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import net.server.Server; @@ -57,24 +58,24 @@ public final class MultiChatHandler extends AbstractMaplePacketHandler { World world = c.getWorldServer(); if (type == 0) { world.buddyChat(recipients, player.getId(), player.getName(), chattext); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "Buddy", chattext); } } else if (type == 1 && player.getParty() != null) { world.partyChat(player.getParty(), chattext, player.getName()); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "Party", chattext); } } else if (type == 2 && player.getGuildId() > 0) { Server.getInstance().guildChat(player.getGuildId(), player.getName(), player.getId(), chattext); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "Guild", chattext); } } else if (type == 3 && player.getGuild() != null) { int allianceId = player.getGuild().getAllianceId(); if (allianceId > 0) { Server.getInstance().allianceMessage(allianceId, MaplePacketCreator.multiChat(player.getName(), chattext, 3), player.getId(), -1); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "Ally", chattext); } } diff --git a/src/net/server/channel/handlers/NPCTalkHandler.java b/src/net/server/channel/handlers/NPCTalkHandler.java index a9165d8ee2..e9ca76240a 100644 --- a/src/net/server/channel/handlers/NPCTalkHandler.java +++ b/src/net/server/channel/handlers/NPCTalkHandler.java @@ -23,6 +23,7 @@ package net.server.channel.handlers; import client.MapleClient; import client.processor.DueyProcessor; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import scripting.npc.NPCScriptManager; @@ -41,7 +42,7 @@ public final class NPCTalkHandler extends AbstractMaplePacketHandler { return; } - if(currentServerTime() - c.getPlayer().getNpcCooldown() < ServerConstants.BLOCK_NPC_RACE_CONDT) { + if(currentServerTime() - c.getPlayer().getNpcCooldown() < YamlConfig.config.server.BLOCK_NPC_RACE_CONDT) { c.announce(MaplePacketCreator.enableActions()); return; } @@ -50,7 +51,7 @@ public final class NPCTalkHandler extends AbstractMaplePacketHandler { MapleMapObject obj = c.getPlayer().getMap().getMapObject(oid); if (obj instanceof MapleNPC) { MapleNPC npc = (MapleNPC) obj; - if(ServerConstants.USE_DEBUG == true) c.getPlayer().dropMessage(5, "Talking to NPC " + npc.getId()); + if(YamlConfig.config.server.USE_DEBUG == true) c.getPlayer().dropMessage(5, "Talking to NPC " + npc.getId()); if (npc.getId() == 9010009) { //is duey DueyProcessor.dueySendTalk(c, false); diff --git a/src/net/server/channel/handlers/OpenFamilyHandler.java b/src/net/server/channel/handlers/OpenFamilyHandler.java index 3cd053c8b2..242b510bb3 100644 --- a/src/net/server/channel/handlers/OpenFamilyHandler.java +++ b/src/net/server/channel/handlers/OpenFamilyHandler.java @@ -19,6 +19,7 @@ */ package net.server.channel.handlers; +import config.YamlConfig; import constants.ServerConstants; import client.MapleCharacter; import client.MapleClient; @@ -33,7 +34,7 @@ import tools.data.input.SeekableLittleEndianAccessor; public final class OpenFamilyHandler extends AbstractMaplePacketHandler { @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { - if(!ServerConstants.USE_FAMILY_SYSTEM) return; + if(!YamlConfig.config.server.USE_FAMILY_SYSTEM) return; MapleCharacter chr = c.getPlayer(); c.announce(MaplePacketCreator.getFamilyInfo(chr.getFamilyEntry())); } diff --git a/src/net/server/channel/handlers/OpenFamilyPedigreeHandler.java b/src/net/server/channel/handlers/OpenFamilyPedigreeHandler.java index e382112f40..c6a57a78d7 100644 --- a/src/net/server/channel/handlers/OpenFamilyPedigreeHandler.java +++ b/src/net/server/channel/handlers/OpenFamilyPedigreeHandler.java @@ -19,6 +19,7 @@ */ package net.server.channel.handlers; +import config.YamlConfig; import constants.ServerConstants; import client.MapleCharacter; import client.MapleClient; @@ -33,7 +34,7 @@ import tools.data.input.SeekableLittleEndianAccessor; public final class OpenFamilyPedigreeHandler extends AbstractMaplePacketHandler { @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { - if(!ServerConstants.USE_FAMILY_SYSTEM) return; + if(!YamlConfig.config.server.USE_FAMILY_SYSTEM) return; MapleCharacter target = c.getChannelServer().getPlayerStorage().getCharacterByName(slea.readMapleAsciiString()); if(target != null && target.getFamily() != null) { c.announce(MaplePacketCreator.showPedigree(target.getFamilyEntry())); diff --git a/src/net/server/channel/handlers/PartyOperationHandler.java b/src/net/server/channel/handlers/PartyOperationHandler.java index fcc1ba9da8..562cb04136 100644 --- a/src/net/server/channel/handlers/PartyOperationHandler.java +++ b/src/net/server/channel/handlers/PartyOperationHandler.java @@ -21,6 +21,7 @@ */ package net.server.channel.handlers; +import config.YamlConfig; import net.AbstractMaplePacketHandler; import net.server.world.MapleParty; import net.server.world.MaplePartyCharacter; @@ -77,11 +78,11 @@ public final class PartyOperationHandler extends AbstractMaplePacketHandler { String name = slea.readMapleAsciiString(); MapleCharacter invited = world.getPlayerStorage().getCharacterByName(name); if (invited != null) { - if(invited.getLevel() < 10 && (!ServerConstants.USE_PARTY_FOR_STARTERS || player.getLevel() >= 10)) { //min requirement is level 10 + if(invited.getLevel() < 10 && (!YamlConfig.config.server.USE_PARTY_FOR_STARTERS || player.getLevel() >= 10)) { //min requirement is level 10 c.announce(MaplePacketCreator.serverNotice(5, "The player you have invited does not meet the requirements.")); return; } - if(ServerConstants.USE_PARTY_FOR_STARTERS && invited.getLevel() >= 10 && player.getLevel() < 10) { //trying to invite high level + if(YamlConfig.config.server.USE_PARTY_FOR_STARTERS && invited.getLevel() >= 10 && player.getLevel() < 10) { //trying to invite high level c.announce(MaplePacketCreator.serverNotice(5, "The player you have invited does not meet the requirements.")); return; } diff --git a/src/net/server/channel/handlers/PetChatHandler.java b/src/net/server/channel/handlers/PetChatHandler.java index 448583b5f6..abb21c849d 100644 --- a/src/net/server/channel/handlers/PetChatHandler.java +++ b/src/net/server/channel/handlers/PetChatHandler.java @@ -23,6 +23,7 @@ package net.server.channel.handlers; import client.MapleClient; import client.autoban.AutobanFactory; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import tools.FilePrinter; @@ -50,7 +51,7 @@ public final class PetChatHandler extends AbstractMaplePacketHandler { return; } c.getPlayer().getMap().broadcastMessage(c.getPlayer(), MaplePacketCreator.petChat(c.getPlayer().getId(), pet, act, text), true); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "Pet", text); } } diff --git a/src/net/server/channel/handlers/PetLootHandler.java b/src/net/server/channel/handlers/PetLootHandler.java index 26e7609ba1..c20ba61a2d 100644 --- a/src/net/server/channel/handlers/PetLootHandler.java +++ b/src/net/server/channel/handlers/PetLootHandler.java @@ -26,6 +26,7 @@ import java.util.Set; import client.MapleCharacter; import client.MapleClient; import client.inventory.MaplePet; +import config.YamlConfig; import net.AbstractMaplePacketHandler; import server.maps.MapleMapItem; import server.maps.MapleMapObject; @@ -41,7 +42,7 @@ public final class PetLootHandler extends AbstractMaplePacketHandler { @Override public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { MapleCharacter chr = c.getPlayer(); - if(currentServerTime() - chr.getPetLootCd() < ServerConstants.PET_LOOT_UPON_ATTACK) { + if(currentServerTime() - chr.getPetLootCd() < YamlConfig.config.server.PET_LOOT_UPON_ATTACK) { c.announce(MaplePacketCreator.enableActions()); return; } diff --git a/src/net/server/channel/handlers/PlayerInteractionHandler.java b/src/net/server/channel/handlers/PlayerInteractionHandler.java index 9daa2e91bd..a3d98705b6 100644 --- a/src/net/server/channel/handlers/PlayerInteractionHandler.java +++ b/src/net/server/channel/handlers/PlayerInteractionHandler.java @@ -29,6 +29,7 @@ import client.inventory.MapleInventory; import client.inventory.MapleInventoryType; import client.inventory.manipulator.MapleInventoryManipulator; import client.inventory.manipulator.MapleKarmaManipulator; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; @@ -369,7 +370,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler { MaplePlayerShop shop = chr.getPlayerShop(); MapleHiredMerchant merchant = chr.getHiredMerchant(); if (shop != null && shop.isOwner(chr)) { - if(ServerConstants.USE_ERASE_PERMIT_ON_OPENSHOP) { + if(YamlConfig.config.server.USE_ERASE_PERMIT_ON_OPENSHOP) { try { MapleInventoryManipulator.removeById(c, MapleInventoryType.CASH, shop.getItemId(), 1, true, false); } catch(RuntimeException re) {} // fella does not have a player shop permit... @@ -642,7 +643,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler { c.announce(MaplePacketCreator.updateHiredMerchant(merchant, chr)); - if (ServerConstants.USE_ENFORCE_MERCHANT_SAVE) { + if (YamlConfig.config.server.USE_ENFORCE_MERCHANT_SAVE) { chr.saveCharToDB(false); } diff --git a/src/net/server/channel/handlers/PlayerLoggedinHandler.java b/src/net/server/channel/handlers/PlayerLoggedinHandler.java index 05cf6b391e..a4ab1d0221 100644 --- a/src/net/server/channel/handlers/PlayerLoggedinHandler.java +++ b/src/net/server/channel/handlers/PlayerLoggedinHandler.java @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map.Entry; +import config.YamlConfig; import net.AbstractMaplePacketHandler; import net.server.PlayerBuffValueHolder; import net.server.Server; @@ -233,7 +234,7 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler { c.announce(MaplePacketCreator.getCharInfo(player)); if (!player.isHidden()) { - if(player.isGM() && ServerConstants.USE_AUTOHIDE_GM) { + if(player.isGM() && YamlConfig.config.server.USE_AUTOHIDE_GM) { player.toggleHide(true); } } @@ -402,7 +403,7 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler { if (player.getMap().getHPDec() > 0) player.resetHpDecreaseTask(); player.resetPlayerRates(); - if(ServerConstants.USE_ADD_RATES_BY_LEVEL == true) player.setPlayerRates(); + if(YamlConfig.config.server.USE_ADD_RATES_BY_LEVEL == true) player.setPlayerRates(); player.setWorldRates(); player.updateCouponRates(); @@ -425,7 +426,7 @@ public final class PlayerLoggedinHandler extends AbstractMaplePacketHandler { } } - if (ServerConstants.USE_NPCS_SCRIPTABLE) { + if (YamlConfig.config.server.USE_NPCS_SCRIPTABLE) { c.announce(MaplePacketCreator.setNPCScriptable(ScriptableNPCConstants.SCRIPTABLE_NPCS)); } diff --git a/src/net/server/channel/handlers/RangedAttackHandler.java b/src/net/server/channel/handlers/RangedAttackHandler.java index b432d75e1e..5b371a2f1e 100644 --- a/src/net/server/channel/handlers/RangedAttackHandler.java +++ b/src/net/server/channel/handlers/RangedAttackHandler.java @@ -22,6 +22,7 @@ along with this program. If not, see . package net.server.channel.handlers; import client.inventory.manipulator.MapleInventoryManipulator; +import config.YamlConfig; import server.MapleItemInformationProvider; import server.MapleStatEffect; import tools.MaplePacketCreator; @@ -70,7 +71,7 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler { } if (chr.getMap().isDojoMap() && attack.numAttacked > 0) { - chr.setDojoEnergy(chr.getDojoEnergy() + ServerConstants.DOJO_ENERGY_ATK); + chr.setDojoEnergy(chr.getDojoEnergy() + YamlConfig.config.server.DOJO_ENERGY_ATK); c.announce(MaplePacketCreator.getEnergy("energy", chr.getDojoEnergy())); } diff --git a/src/net/server/channel/handlers/SpecialMoveHandler.java b/src/net/server/channel/handlers/SpecialMoveHandler.java index aa0aeb1fa0..16891585a2 100644 --- a/src/net/server/channel/handlers/SpecialMoveHandler.java +++ b/src/net/server/channel/handlers/SpecialMoveHandler.java @@ -23,6 +23,7 @@ package net.server.channel.handlers; import java.awt.Point; +import config.YamlConfig; import net.AbstractMaplePacketHandler; import server.MapleStatEffect; import server.life.MapleMonster; @@ -81,7 +82,7 @@ public final class SpecialMoveHandler extends AbstractMaplePacketHandler { return; } else if (skillid != Corsair.BATTLE_SHIP) { int cooldownTime = effect.getCooldown(); - if(MapleStatEffect.isHerosWill(skillid) && ServerConstants.USE_FAST_REUSE_HERO_WILL) { + if(MapleStatEffect.isHerosWill(skillid) && YamlConfig.config.server.USE_FAST_REUSE_HERO_WILL) { cooldownTime /= 60; } diff --git a/src/net/server/channel/handlers/SpouseChatHandler.java b/src/net/server/channel/handlers/SpouseChatHandler.java index 09ec66a389..9fe17fc769 100644 --- a/src/net/server/channel/handlers/SpouseChatHandler.java +++ b/src/net/server/channel/handlers/SpouseChatHandler.java @@ -23,6 +23,7 @@ package net.server.channel.handlers; import client.MapleCharacter; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import tools.LogHelper; @@ -41,7 +42,7 @@ public final class SpouseChatHandler extends AbstractMaplePacketHandler { if (spouse != null) { spouse.announce(MaplePacketCreator.OnCoupleMessage(c.getPlayer().getName(), msg, true)); c.announce(MaplePacketCreator.OnCoupleMessage(c.getPlayer().getName(), msg, true)); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "Spouse", msg); } } else { diff --git a/src/net/server/channel/handlers/TakeDamageHandler.java b/src/net/server/channel/handlers/TakeDamageHandler.java index 7d8ca471b7..dfe19296e9 100644 --- a/src/net/server/channel/handlers/TakeDamageHandler.java +++ b/src/net/server/channel/handlers/TakeDamageHandler.java @@ -31,6 +31,7 @@ import client.inventory.MapleInventory; import client.inventory.MapleInventoryType; import client.status.MonsterStatus; import client.status.MonsterStatusEffect; +import config.YamlConfig; import constants.GameConstants; import constants.ItemConstants; import constants.ServerConstants; @@ -197,7 +198,7 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler { } //in dojo player cannot use pot, so deadly attacks should be turned off as well - if(is_deadly && chr.getMap().isDojoMap() && !ServerConstants.USE_DEADLY_DOJO) { + if(is_deadly && chr.getMap().isDojoMap() && !YamlConfig.config.server.USE_DEADLY_DOJO) { damage = 0; mpattack = 0; } @@ -282,7 +283,7 @@ public final class TakeDamageHandler extends AbstractMaplePacketHandler { map.broadcastGMMessage(chr, MaplePacketCreator.damagePlayer(damagefrom, monsteridfrom, chr.getId(), damage, fake, direction, is_pgmr, pgmr, is_pg, oid, pos_x, pos_y), false); } if (GameConstants.isDojo(map.getId())) { - chr.setDojoEnergy(chr.getDojoEnergy() + ServerConstants.DOJO_ENERGY_DMG); + chr.setDojoEnergy(chr.getDojoEnergy() + YamlConfig.config.server.DOJO_ENERGY_DMG); c.announce(MaplePacketCreator.getEnergy("energy", chr.getDojoEnergy())); } diff --git a/src/net/server/channel/handlers/TransferNameHandler.java b/src/net/server/channel/handlers/TransferNameHandler.java index 426a37a5ba..0feae06b18 100644 --- a/src/net/server/channel/handlers/TransferNameHandler.java +++ b/src/net/server/channel/handlers/TransferNameHandler.java @@ -29,6 +29,7 @@ import java.sql.Connection; import client.MapleCharacter; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import tools.DatabaseConnection; @@ -51,7 +52,7 @@ public final class TransferNameHandler extends AbstractMaplePacketHandler { c.announce(MaplePacketCreator.enableActions()); return; } - if(!ServerConstants.ALLOW_CASHSHOP_NAME_CHANGE) { + if(!YamlConfig.config.server.ALLOW_CASHSHOP_NAME_CHANGE) { c.announce(MaplePacketCreator.sendNameTransferRules(4)); return; } @@ -73,7 +74,7 @@ public final class TransferNameHandler extends AbstractMaplePacketHandler { if(completedTimestamp == null) { //has pending name request c.announce(MaplePacketCreator.sendNameTransferRules(1)); return; - } else if(completedTimestamp.getTime() + ServerConstants.NAME_CHANGE_COOLDOWN > System.currentTimeMillis()) { + } else if(completedTimestamp.getTime() + YamlConfig.config.server.NAME_CHANGE_COOLDOWN > System.currentTimeMillis()) { c.announce(MaplePacketCreator.sendNameTransferRules(3)); return; }; diff --git a/src/net/server/channel/handlers/TransferWorldHandler.java b/src/net/server/channel/handlers/TransferWorldHandler.java index d822c247bb..d6f46343fb 100644 --- a/src/net/server/channel/handlers/TransferWorldHandler.java +++ b/src/net/server/channel/handlers/TransferWorldHandler.java @@ -28,6 +28,7 @@ import java.sql.Timestamp; import client.MapleCharacter; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import net.server.Server; @@ -52,7 +53,7 @@ public final class TransferWorldHandler extends AbstractMaplePacketHandler { return; } MapleCharacter chr = c.getPlayer(); - if(!ServerConstants.ALLOW_CASHSHOP_WORLD_TRANSFER || Server.getInstance().getWorldsSize() <= 1) { + if(!YamlConfig.config.server.ALLOW_CASHSHOP_WORLD_TRANSFER || Server.getInstance().getWorldsSize() <= 1) { c.announce(MaplePacketCreator.sendWorldTransferRules(9, c)); return; } @@ -70,7 +71,7 @@ public final class TransferWorldHandler extends AbstractMaplePacketHandler { if(completedTimestamp == null) { //has pending world transfer c.announce(MaplePacketCreator.sendWorldTransferRules(6, c)); return; - } else if(completedTimestamp.getTime() + ServerConstants.WORLD_TRANSFER_COOLDOWN > System.currentTimeMillis()) { + } else if(completedTimestamp.getTime() + YamlConfig.config.server.WORLD_TRANSFER_COOLDOWN > System.currentTimeMillis()) { c.announce(MaplePacketCreator.sendWorldTransferRules(7, c)); return; }; diff --git a/src/net/server/channel/handlers/UseCashItemHandler.java b/src/net/server/channel/handlers/UseCashItemHandler.java index 4be8c93fc0..f88582c9a3 100644 --- a/src/net/server/channel/handlers/UseCashItemHandler.java +++ b/src/net/server/channel/handlers/UseCashItemHandler.java @@ -38,6 +38,7 @@ import client.inventory.manipulator.MapleKarmaManipulator; import client.processor.AssignAPProcessor; import client.processor.AssignSPProcessor; import client.processor.DueyProcessor; +import config.YamlConfig; import constants.GameConstants; import constants.ItemConstants; import constants.ServerConstants; @@ -373,7 +374,7 @@ public final class UseCashItemHandler extends AbstractMaplePacketHandler { } else if (itemType == 523) { int itemid = slea.readInt(); - if(!ServerConstants.USE_ENFORCE_ITEM_SUGGESTION) c.getWorldServer().addOwlItemSearch(itemid); + if(!YamlConfig.config.server.USE_ENFORCE_ITEM_SUGGESTION) c.getWorldServer().addOwlItemSearch(itemid); player.setOwlSearch(itemid); List> hmsAvailable = c.getWorldServer().getAvailableItemBundles(itemid); if(!hmsAvailable.isEmpty()) remove(c, position, itemId); diff --git a/src/net/server/channel/handlers/UseItemHandler.java b/src/net/server/channel/handlers/UseItemHandler.java index 54c03dd1ed..182aef2062 100644 --- a/src/net/server/channel/handlers/UseItemHandler.java +++ b/src/net/server/channel/handlers/UseItemHandler.java @@ -26,6 +26,7 @@ import client.MapleClient; import client.MapleDisease; import client.inventory.Item; import client.inventory.MapleInventoryType; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; import net.AbstractMaplePacketHandler; @@ -77,7 +78,7 @@ public final class UseItemHandler extends AbstractMaplePacketHandler { long banTime = currentServerTime(); if (ii.getItemEffect(toUse.getItemId()).applyTo(chr)) { - if(ServerConstants.USE_BANISHABLE_TOWN_SCROLL) { + if(YamlConfig.config.server.USE_BANISHABLE_TOWN_SCROLL) { chr.setBanishPlayerData(banMap, banSp, banTime); } diff --git a/src/net/server/channel/handlers/WeddingHandler.java b/src/net/server/channel/handlers/WeddingHandler.java index 1dae1aa6e6..19ef488948 100644 --- a/src/net/server/channel/handlers/WeddingHandler.java +++ b/src/net/server/channel/handlers/WeddingHandler.java @@ -14,6 +14,7 @@ import client.inventory.MapleInventory; import client.inventory.MapleInventoryType; import client.inventory.manipulator.MapleInventoryManipulator; import client.inventory.manipulator.MapleKarmaManipulator; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; import net.AbstractMaplePacketHandler; @@ -50,7 +51,7 @@ public final class WeddingHandler extends AbstractMaplePacketHandler { String groomWishlistProp = "giftedItem" + (groomWishlist ? "G" : "B") + chr.getId(); int giftCount = marriage.getIntProperty(groomWishlistProp); - if (giftCount < ServerConstants.WEDDING_GIFT_LIMIT) { + if (giftCount < YamlConfig.config.server.WEDDING_GIFT_LIMIT) { int cid = marriage.getIntProperty(groomWishlist ? "groomId" : "brideId"); if (chr.getId() != cid) { // cannot gift yourself MapleCharacter spouse = marriage.getPlayerById(cid); @@ -69,7 +70,7 @@ public final class WeddingHandler extends AbstractMaplePacketHandler { marriage.addGiftItem(groomWishlist, newItem); MapleInventoryManipulator.removeFromSlot(c, type, slot, quantity, false, false); - if (ServerConstants.USE_ENFORCE_MERCHANT_SAVE) chr.saveCharToDB(false); + if (YamlConfig.config.server.USE_ENFORCE_MERCHANT_SAVE) chr.saveCharToDB(false); marriage.saveGiftItemsToDb(c, groomWishlist, cid); MapleKarmaManipulator.toggleKarmaFlagToUntradeable(newItem); diff --git a/src/net/server/channel/handlers/WhisperHandler.java b/src/net/server/channel/handlers/WhisperHandler.java index 6126ae5958..2c7dded0cf 100644 --- a/src/net/server/channel/handlers/WhisperHandler.java +++ b/src/net/server/channel/handlers/WhisperHandler.java @@ -25,6 +25,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import config.YamlConfig; import constants.ServerConstants; import net.AbstractMaplePacketHandler; import net.server.world.World; @@ -62,7 +63,7 @@ public final class WhisperHandler extends AbstractMaplePacketHandler { } if (player != null) { player.getClient().announce(MaplePacketCreator.getWhisper(c.getPlayer().getName(), c.getChannel(), text)); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "Whisper To " + player.getName(), text); } if(player.isHidden() && player.gmLevel() >= c.getPlayer().gmLevel()) { @@ -74,7 +75,7 @@ public final class WhisperHandler extends AbstractMaplePacketHandler { World world = c.getWorldServer(); if (world.isConnected(recipient)) { world.whisper(c.getPlayer().getName(), recipient, c.getChannel(), text); - if (ServerConstants.USE_ENABLE_CHAT_LOG) { + if (YamlConfig.config.server.USE_ENABLE_CHAT_LOG) { LogHelper.logChat(c, "Whisper To " + recipient, text); } player = world.getPlayerStorage().getCharacterByName(recipient); diff --git a/src/net/server/channel/worker/BaseScheduler.java b/src/net/server/channel/worker/BaseScheduler.java index 5e47add6b5..248e66cac5 100644 --- a/src/net/server/channel/worker/BaseScheduler.java +++ b/src/net/server/channel/worker/BaseScheduler.java @@ -19,6 +19,7 @@ */ package net.server.channel.worker; +import config.YamlConfig; import constants.ServerConstants; import java.util.Collections; import java.util.HashMap; @@ -101,7 +102,7 @@ public abstract class BaseScheduler { if(registeredEntries.isEmpty()) { idleProcs++; - if(idleProcs >= ServerConstants.MOB_STATUS_MONITOR_LIFE) { + if(idleProcs >= YamlConfig.config.server.MOB_STATUS_MONITOR_LIFE) { if(schedulerTask != null) { schedulerTask.cancel(false); schedulerTask = null; @@ -147,7 +148,7 @@ public abstract class BaseScheduler { try { idleProcs = 0; if(schedulerTask == null) { - schedulerTask = TimerManager.getInstance().register(monitorTask, ServerConstants.MOB_STATUS_MONITOR_PROC, ServerConstants.MOB_STATUS_MONITOR_PROC); + schedulerTask = TimerManager.getInstance().register(monitorTask, YamlConfig.config.server.MOB_STATUS_MONITOR_PROC, YamlConfig.config.server.MOB_STATUS_MONITOR_PROC); } registeredEntries.put(key, new Pair<>(removalAction, Server.getInstance().getCurrentTime() + duration)); diff --git a/src/net/server/channel/worker/MobStatusScheduler.java b/src/net/server/channel/worker/MobStatusScheduler.java index 42dd021026..434a49a4c4 100644 --- a/src/net/server/channel/worker/MobStatusScheduler.java +++ b/src/net/server/channel/worker/MobStatusScheduler.java @@ -20,6 +20,7 @@ package net.server.channel.worker; import client.status.MonsterStatusEffect; +import config.YamlConfig; import constants.ServerConstants; import java.util.HashMap; import java.util.ArrayList; @@ -45,7 +46,7 @@ public class MobStatusScheduler extends BaseScheduler { protected MobStatusOvertimeEntry(int delay, Runnable run) { procCount = 0; - procLimit = (int)Math.ceil((float) delay / ServerConstants.MOB_STATUS_MONITOR_PROC); + procLimit = (int)Math.ceil((float) delay / YamlConfig.config.server.MOB_STATUS_MONITOR_PROC); r = run; } diff --git a/src/net/server/coordinator/LoginStorage.java b/src/net/server/coordinator/LoginStorage.java index 8c889a6a1b..377bd113ee 100644 --- a/src/net/server/coordinator/LoginStorage.java +++ b/src/net/server/coordinator/LoginStorage.java @@ -19,6 +19,7 @@ */ package net.server.coordinator; +import config.YamlConfig; import constants.ServerConstants; import java.util.Collections; import java.util.LinkedList; @@ -40,8 +41,8 @@ public class LoginStorage { List accHist = loginHistory.putIfAbsent(accountId, new LinkedList()); if (accHist != null) { synchronized (accHist) { - if (accHist.size() > ServerConstants.MAX_ACCOUNT_LOGIN_ATTEMPT) { - long blockExpiration = Server.getInstance().getCurrentTime() + ServerConstants.LOGIN_ATTEMPT_DURATION; + if (accHist.size() > YamlConfig.config.server.MAX_ACCOUNT_LOGIN_ATTEMPT) { + long blockExpiration = Server.getInstance().getCurrentTime() + YamlConfig.config.server.LOGIN_ATTEMPT_DURATION; Collections.fill(accHist, blockExpiration); return false; @@ -52,7 +53,7 @@ public class LoginStorage { } synchronized (accHist) { - accHist.add(Server.getInstance().getCurrentTime() + ServerConstants.LOGIN_ATTEMPT_DURATION); + accHist.add(Server.getInstance().getCurrentTime() + YamlConfig.config.server.LOGIN_ATTEMPT_DURATION); return true; } } diff --git a/src/net/server/coordinator/MapleEventRecallCoordinator.java b/src/net/server/coordinator/MapleEventRecallCoordinator.java index e790cce155..6acb64be38 100644 --- a/src/net/server/coordinator/MapleEventRecallCoordinator.java +++ b/src/net/server/coordinator/MapleEventRecallCoordinator.java @@ -19,6 +19,7 @@ */ package net.server.coordinator; +import config.YamlConfig; import constants.ServerConstants; import scripting.event.EventInstanceManager; import java.util.LinkedList; @@ -50,7 +51,7 @@ public class MapleEventRecallCoordinator { } public void storeEventInstance(int characterId, EventInstanceManager eim) { - if (ServerConstants.USE_ENABLE_RECALL_EVENT && isRecallableEvent(eim)) { + if (YamlConfig.config.server.USE_ENABLE_RECALL_EVENT && isRecallableEvent(eim)) { eventHistory.put(characterId, eim); } } diff --git a/src/net/server/coordinator/MapleLoginBypassCoordinator.java b/src/net/server/coordinator/MapleLoginBypassCoordinator.java index 7c21df8dec..cb90d84588 100644 --- a/src/net/server/coordinator/MapleLoginBypassCoordinator.java +++ b/src/net/server/coordinator/MapleLoginBypassCoordinator.java @@ -19,6 +19,7 @@ */ package net.server.coordinator; +import config.YamlConfig; import constants.ServerConstants; import java.util.HashSet; import java.util.LinkedList; @@ -59,7 +60,7 @@ public class MapleLoginBypassCoordinator { } public void registerLoginBypassEntry(String nibbleHwid, int accId, boolean pic) { - long expireTime = (pic ? ServerConstants.BYPASS_PIC_EXPIRATION : ServerConstants.BYPASS_PIN_EXPIRATION); + long expireTime = (pic ? YamlConfig.config.server.BYPASS_PIC_EXPIRATION : YamlConfig.config.server.BYPASS_PIN_EXPIRATION); if (expireTime > 0) { Pair entry = new Pair<>(nibbleHwid, accId); expireTime = Server.getInstance().getCurrentTime() + expireTime * 60 * 1000; diff --git a/src/net/server/coordinator/MapleMonsterAggroCoordinator.java b/src/net/server/coordinator/MapleMonsterAggroCoordinator.java index dd45a07339..06a163d0d9 100644 --- a/src/net/server/coordinator/MapleMonsterAggroCoordinator.java +++ b/src/net/server/coordinator/MapleMonsterAggroCoordinator.java @@ -30,6 +30,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Set; +import config.YamlConfig; import constants.ServerConstants; import client.MapleCharacter; import java.util.concurrent.ScheduledFuture; @@ -101,19 +102,19 @@ public class MapleMonsterAggroCoordinator { runAggroUpdate(1); runSortLeadingCharactersAggro(); } - }, ServerConstants.MOB_STATUS_AGGRO_INTERVAL, ServerConstants.MOB_STATUS_AGGRO_INTERVAL); + }, YamlConfig.config.server.MOB_STATUS_AGGRO_INTERVAL, YamlConfig.config.server.MOB_STATUS_AGGRO_INTERVAL); } finally { idleLock.unlock(); } - int timeDelta = (int) Math.ceil((Server.getInstance().getCurrentTime() - lastStopTime) / ServerConstants.MOB_STATUS_AGGRO_INTERVAL); + int timeDelta = (int) Math.ceil((Server.getInstance().getCurrentTime() - lastStopTime) / YamlConfig.config.server.MOB_STATUS_AGGRO_INTERVAL); if (timeDelta > 0) { runAggroUpdate(timeDelta); } } private static void updateEntryExpiration(PlayerAggroEntry pae) { - pae.toNextUpdate = (int) Math.ceil((120000L / ServerConstants.MOB_STATUS_AGGRO_INTERVAL) / Math.pow(2, pae.expireStreak + pae.currentDamageInstances)); + pae.toNextUpdate = (int) Math.ceil((120000L / YamlConfig.config.server.MOB_STATUS_AGGRO_INTERVAL) / Math.pow(2, pae.expireStreak + pae.currentDamageInstances)); } private static void insertEntryDamage(PlayerAggroEntry pae, int damage) { @@ -318,7 +319,7 @@ public class MapleMonsterAggroCoordinator { if (chr != null) { if (player.getId() == pae.cid) { return true; - } else if (pae.updateStreak < ServerConstants.MOB_STATUS_AGGRO_PERSISTENCE && chr.isAlive()) { // verifies currently leading players activity + } else if (pae.updateStreak < YamlConfig.config.server.MOB_STATUS_AGGRO_PERSISTENCE && chr.isAlive()) { // verifies currently leading players activity return false; } } diff --git a/src/net/server/coordinator/MaplePartySearchCoordinator.java b/src/net/server/coordinator/MaplePartySearchCoordinator.java index 3363ddf562..866f76ac65 100644 --- a/src/net/server/coordinator/MaplePartySearchCoordinator.java +++ b/src/net/server/coordinator/MaplePartySearchCoordinator.java @@ -21,6 +21,7 @@ package net.server.coordinator; import client.MapleCharacter; import client.MapleJob; +import config.YamlConfig; import constants.ServerConstants; import java.io.File; import net.server.world.MapleParty; @@ -370,7 +371,7 @@ public class MaplePartySearchCoordinator { } else { LeaderSearchMetadata settings = searchSettings.get(leader.getId()); if (settings != null) { - if (settings.reentryCount < ServerConstants.PARTY_SEARCH_REENTRY_LIMIT) { + if (settings.reentryCount < YamlConfig.config.server.PARTY_SEARCH_REENTRY_LIMIT) { settings.reentryCount += 1; recalledLeaders.add(leader); } else { @@ -413,7 +414,7 @@ public class MaplePartySearchCoordinator { if (leader.isLoggedinWorld()) { if (settings != null) { recycledLeaders.add(new Pair<>(leader, settings)); - if (ServerConstants.USE_DEBUG && leader.isGM()) leader.dropMessage(5, "Your Party Search token session is now on waiting queue for up to 7 minutes, to get it working right away please stop your Party Search and retry again later."); + if (YamlConfig.config.server.USE_DEBUG && leader.isGM()) leader.dropMessage(5, "Your Party Search token session is now on waiting queue for up to 7 minutes, to get it working right away please stop your Party Search and retry again later."); } else { leader.dropMessage(5, "Your Party Search token session expired, please stop your Party Search and retry again later."); } diff --git a/src/net/server/coordinator/MapleSessionCoordinator.java b/src/net/server/coordinator/MapleSessionCoordinator.java index 1b3ad471ae..f9e30e1f02 100644 --- a/src/net/server/coordinator/MapleSessionCoordinator.java +++ b/src/net/server/coordinator/MapleSessionCoordinator.java @@ -21,6 +21,7 @@ package net.server.coordinator; import client.MapleCharacter; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; import net.server.Server; @@ -163,8 +164,8 @@ public class MapleSessionCoordinator { hwidCount++; } } - - if (hwidCount < ServerConstants.MAX_ALLOWED_ACCOUNT_HWID) { + + if (hwidCount < YamlConfig.config.server.MAX_ALLOWED_ACCOUNT_HWID) { registerAccessAccount(con, remoteHwid, accountId); return true; } @@ -174,15 +175,15 @@ public class MapleSessionCoordinator { } catch (SQLException ex) { ex.printStackTrace(); } - + return false; } - + private static boolean attemptAccessAccount(String nibbleHwid, int accountId, boolean routineCheck) { try { Connection con = DatabaseConnection.getConnection(); int hwidCount = 0; - + try (PreparedStatement ps = con.prepareStatement("SELECT SQL_CACHE * FROM hwidaccounts WHERE accountid = ?")) { ps.setInt(1, accountId); try (ResultSet rs = ps.executeQuery()) { @@ -191,19 +192,19 @@ public class MapleSessionCoordinator { if (rsHwid.endsWith(nibbleHwid)) { if (!routineCheck) { // better update HWID relevance as soon as the login is authenticated - + int loginRelevance = rs.getInt("relevance"); updateAccessAccount(con, rsHwid, accountId, loginRelevance); } - + return true; } - + hwidCount++; } } - - if (hwidCount < ServerConstants.MAX_ALLOWED_ACCOUNT_HWID) { + + if (hwidCount < YamlConfig.config.server.MAX_ALLOWED_ACCOUNT_HWID) { return true; } } finally { @@ -212,25 +213,25 @@ public class MapleSessionCoordinator { } catch (SQLException ex) { ex.printStackTrace(); } - + return false; } - + private Lock getCoodinatorLock(String remoteHost) { return poolLock.get(Math.abs(remoteHost.hashCode()) % 100); } - + public static String getSessionRemoteAddress(IoSession session) { return (String) session.getAttribute(MapleClient.CLIENT_REMOTE_ADDRESS); } - + private static MapleClient getSessionClient(IoSession session) { return (MapleClient) session.getAttribute(MapleClient.CLIENT_KEY); } - + public void updateOnlineSession(IoSession session) { MapleClient client = getSessionClient(session); - + if (client != null) { int accountId = client.getAccID(); MapleClient ingameClient = onlineClients.get(accountId); @@ -241,13 +242,13 @@ public class MapleSessionCoordinator { onlineClients.put(accountId, client); } } - + public boolean canStartLoginSession(IoSession session) { - if (!ServerConstants.DETERRED_MULTICLIENT) return true; - + if (!YamlConfig.config.server.DETERRED_MULTICLIENT) return true; + String remoteHost = getSessionRemoteAddress(session); Lock lock = getCoodinatorLock(remoteHost); - + try { int tries = 0; while (true) { @@ -256,19 +257,19 @@ public class MapleSessionCoordinator { if (pooledRemoteHosts.contains(remoteHost)) { return false; } - + pooledRemoteHosts.add(remoteHost); } finally { lock.unlock(); } - + break; } else { if(tries == 2) { return true; } tries++; - + Thread.sleep(1777); } } @@ -276,7 +277,7 @@ public class MapleSessionCoordinator { e.printStackTrace(); return true; } - + try { String knownHwid = cachedHostHwids.get(remoteHost); if (knownHwid != null) { @@ -284,15 +285,15 @@ public class MapleSessionCoordinator { return false; } } - + if (loginRemoteHosts.containsKey(remoteHost)) { return false; } - + Set lrh = new HashSet<>(2); lrh.add(session); loginRemoteHosts.put(remoteHost, lrh); - + return true; } finally { lock.lock(); @@ -303,7 +304,7 @@ public class MapleSessionCoordinator { } } } - + public void closeLoginSession(IoSession session) { String remoteHost = getSessionRemoteAddress(session); Set lrh = loginRemoteHosts.get(remoteHost); @@ -313,15 +314,15 @@ public class MapleSessionCoordinator { loginRemoteHosts.remove(remoteHost); } } - + String nibbleHwid = (String) session.removeAttribute(MapleClient.CLIENT_NIBBLEHWID); if (nibbleHwid != null) { onlineRemoteHwids.remove(nibbleHwid); - + MapleClient client = getSessionClient(session); if (client != null) { MapleClient loggedClient = onlineClients.get(client.getAccID()); - + // do not remove an online game session here, only login session if (loggedClient != null && loggedClient.getSessionId() == client.getSessionId()) { onlineClients.remove(client.getAccID()); @@ -329,16 +330,16 @@ public class MapleSessionCoordinator { } } } - + public AntiMulticlientResult attemptLoginSession(IoSession session, String nibbleHwid, int accountId, boolean routineCheck) { - if (!ServerConstants.DETERRED_MULTICLIENT) { + if (!YamlConfig.config.server.DETERRED_MULTICLIENT) { session.setAttribute(MapleClient.CLIENT_NIBBLEHWID, nibbleHwid); return AntiMulticlientResult.SUCCESS; } - + String remoteHost = getSessionRemoteAddress(session); Lock lock = getCoodinatorLock(remoteHost); - + try { int tries = 0; while (true) { @@ -347,19 +348,19 @@ public class MapleSessionCoordinator { if (pooledRemoteHosts.contains(remoteHost)) { return AntiMulticlientResult.REMOTE_PROCESSING; } - + pooledRemoteHosts.add(remoteHost); } finally { lock.unlock(); } - + break; } else { if(tries == 2) { return AntiMulticlientResult.COORDINATOR_ERROR; } tries++; - + Thread.sleep(1777); } } @@ -367,12 +368,12 @@ public class MapleSessionCoordinator { e.printStackTrace(); return AntiMulticlientResult.COORDINATOR_ERROR; } - + try { if (!loginStorage.registerLogin(accountId)) { return AntiMulticlientResult.MANY_ACCOUNT_ATTEMPTS; } - + if (!routineCheck) { if (onlineRemoteHwids.contains(nibbleHwid)) { return AntiMulticlientResult.REMOTE_LOGGEDIN; @@ -381,7 +382,7 @@ public class MapleSessionCoordinator { if (!attemptAccessAccount(nibbleHwid, accountId, routineCheck)) { return AntiMulticlientResult.REMOTE_REACHED_LIMIT; } - + session.setAttribute(MapleClient.CLIENT_NIBBLEHWID, nibbleHwid); onlineRemoteHwids.add(nibbleHwid); } else { @@ -389,7 +390,7 @@ public class MapleSessionCoordinator { return AntiMulticlientResult.REMOTE_REACHED_LIMIT; } } - + return AntiMulticlientResult.SUCCESS; } finally { lock.lock(); @@ -400,10 +401,10 @@ public class MapleSessionCoordinator { } } } - + public AntiMulticlientResult attemptGameSession(IoSession session, int accountId, String remoteHwid) { String remoteHost = getSessionRemoteAddress(session); - if (!ServerConstants.DETERRED_MULTICLIENT) { + if (!YamlConfig.config.server.DETERRED_MULTICLIENT) { associateRemoteHostHwid(remoteHost, remoteHwid); return AntiMulticlientResult.SUCCESS; } diff --git a/src/net/server/coordinator/matchchecker/listener/MatchCheckerGuildCreation.java b/src/net/server/coordinator/matchchecker/listener/MatchCheckerGuildCreation.java index ec15535e8d..e5a481f296 100644 --- a/src/net/server/coordinator/matchchecker/listener/MatchCheckerGuildCreation.java +++ b/src/net/server/coordinator/matchchecker/listener/MatchCheckerGuildCreation.java @@ -20,6 +20,7 @@ package net.server.coordinator.matchchecker.listener; import client.MapleCharacter; +import config.YamlConfig; import constants.GameConstants; import constants.ServerConstants; import net.server.coordinator.matchchecker.AbstractMatchCheckerListener; @@ -103,8 +104,8 @@ public class MatchCheckerGuildCreation implements MatchCheckerListenerRecipe { return; } } - if (leader.getMeso() < ServerConstants.CREATE_GUILD_COST) { - leader.dropMessage(1, "You do not have " + GameConstants.numberWithCommas(ServerConstants.CREATE_GUILD_COST) + " mesos to create a Guild."); + if (leader.getMeso() < YamlConfig.config.server.CREATE_GUILD_COST) { + leader.dropMessage(1, "You do not have " + GameConstants.numberWithCommas(YamlConfig.config.server.CREATE_GUILD_COST) + " mesos to create a Guild."); broadcastGuildCreationDismiss(matchPlayers); return; } @@ -115,7 +116,7 @@ public class MatchCheckerGuildCreation implements MatchCheckerListenerRecipe { broadcastGuildCreationDismiss(matchPlayers); return; } - leader.gainMeso(-ServerConstants.CREATE_GUILD_COST, true, false, true); + leader.gainMeso(-YamlConfig.config.server.CREATE_GUILD_COST, true, false, true); leader.getMGC().setGuildId(gid); MapleGuild guild = Server.getInstance().getGuild(leader.getGuildId(), leader.getWorld(), leader); // initialize guild structure diff --git a/src/net/server/guild/MapleGuild.java b/src/net/server/guild/MapleGuild.java index 7a9cffa009..c4776c2f1c 100644 --- a/src/net/server/guild/MapleGuild.java +++ b/src/net/server/guild/MapleGuild.java @@ -23,6 +23,7 @@ package net.server.guild; import client.MapleCharacter; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; import java.sql.Connection; @@ -838,10 +839,10 @@ public class MapleGuild { } public static int getIncreaseGuildCost(int size) { - int cost = ServerConstants.EXPAND_GUILD_BASE_COST + Math.max(0, (size - 15) / 5) * ServerConstants.EXPAND_GUILD_TIER_COST; + int cost = YamlConfig.config.server.EXPAND_GUILD_BASE_COST + Math.max(0, (size - 15) / 5) * YamlConfig.config.server.EXPAND_GUILD_TIER_COST; if (size > 30) { - return Math.min(ServerConstants.EXPAND_GUILD_MAX_COST, Math.max(cost, 5000000)); + return Math.min(YamlConfig.config.server.EXPAND_GUILD_MAX_COST, Math.max(cost, 5000000)); } else { return cost; } diff --git a/src/net/server/handlers/login/LoginPasswordHandler.java b/src/net/server/handlers/login/LoginPasswordHandler.java index 49c35adeed..04756fe491 100644 --- a/src/net/server/handlers/login/LoginPasswordHandler.java +++ b/src/net/server/handlers/login/LoginPasswordHandler.java @@ -26,6 +26,7 @@ import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Calendar; +import config.YamlConfig; import constants.ServerConstants; import net.MaplePacketHandler; import net.server.Server; @@ -64,14 +65,14 @@ public final class LoginPasswordHandler implements MaplePacketHandler { public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) { String remoteHost = getRemoteIp(c.getSession()); if (!remoteHost.contentEquals("null")) { - if (ServerConstants.USE_IP_VALIDATION) { // thanks Alex (CanIGetaPR) for suggesting IP validation as a server flag + if (YamlConfig.config.server.USE_IP_VALIDATION) { // thanks Alex (CanIGetaPR) for suggesting IP validation as a server flag if (remoteHost.startsWith("127.")) { - if (!ServerConstants.LOCALSERVER) { // thanks Mills for noting HOST can also have a field named "localhost" + if (!YamlConfig.config.server.LOCALSERVER) { // thanks Mills for noting HOST can also have a field named "localhost" c.announce(MaplePacketCreator.getLoginFailed(13)); // cannot login as localhost if it's not a local server return; } } else { - if (ServerConstants.LOCALSERVER) { + if (YamlConfig.config.server.LOCALSERVER) { c.announce(MaplePacketCreator.getLoginFailed(13)); // cannot login as non-localhost if it's a local server return; } @@ -93,12 +94,12 @@ public final class LoginPasswordHandler implements MaplePacketHandler { Connection con = null; PreparedStatement ps = null; - if (ServerConstants.AUTOMATIC_REGISTER && loginok == 5) { + if (YamlConfig.config.server.AUTOMATIC_REGISTER && loginok == 5) { try { con = DatabaseConnection.getConnection(); ps = con.prepareStatement("INSERT INTO accounts (name, password, birthday, tempban) VALUES (?, ?, ?, ?);", Statement.RETURN_GENERATED_KEYS); //Jayd: Added birthday, tempban ps.setString(1, login); - ps.setString(2, ServerConstants.BCRYPT_MIGRATION ? BCrypt.hashpw(pwd, BCrypt.gensalt(12)) : hashpwSHA512(pwd)); + ps.setString(2, YamlConfig.config.server.BCRYPT_MIGRATION ? BCrypt.hashpw(pwd, BCrypt.gensalt(12)) : hashpwSHA512(pwd)); ps.setString(3, "2018-06-20"); //Jayd's idea: was added to solve the MySQL 5.7 strict checking (birthday) ps.setString(4, "2018-06-20"); //Jayd's idea: was added to solve the MySQL 5.7 strict checking (tempban) ps.executeUpdate(); @@ -116,7 +117,7 @@ public final class LoginPasswordHandler implements MaplePacketHandler { } } - if (ServerConstants.BCRYPT_MIGRATION && (loginok <= -10)) { // -10 means migration to bcrypt, -23 means TOS wasn't accepted + if (YamlConfig.config.server.BCRYPT_MIGRATION && (loginok <= -10)) { // -10 means migration to bcrypt, -23 means TOS wasn't accepted try { con = DatabaseConnection.getConnection(); ps = con.prepareStatement("UPDATE accounts SET password = ? WHERE name = ?;"); diff --git a/src/net/server/handlers/login/ViewAllCharHandler.java b/src/net/server/handlers/login/ViewAllCharHandler.java index fa04f5ab72..fb695f4474 100644 --- a/src/net/server/handlers/login/ViewAllCharHandler.java +++ b/src/net/server/handlers/login/ViewAllCharHandler.java @@ -23,6 +23,7 @@ package net.server.handlers.login; import client.MapleCharacter; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; import java.util.List; import net.AbstractMaplePacketHandler; @@ -64,7 +65,7 @@ public final class ViewAllCharHandler extends AbstractMaplePacketHandler { c.announce(MaplePacketCreator.showAllCharacter(charsSize, unk)); for (Pair> wchars : worldChars) { - c.announce(MaplePacketCreator.showAllCharacterInfo(wchars.getLeft(), wchars.getRight(), ServerConstants.ENABLE_PIC && !c.canBypassPic())); + c.announce(MaplePacketCreator.showAllCharacterInfo(wchars.getLeft(), wchars.getRight(), YamlConfig.config.server.ENABLE_PIC && !c.canBypassPic())); } } catch (Exception e) { e.printStackTrace(); diff --git a/src/net/server/worker/CharacterAutosaverWorker.java b/src/net/server/worker/CharacterAutosaverWorker.java index a10934d4e8..32e5617ef5 100644 --- a/src/net/server/worker/CharacterAutosaverWorker.java +++ b/src/net/server/worker/CharacterAutosaverWorker.java @@ -19,6 +19,7 @@ */ package net.server.worker; +import config.YamlConfig; import net.server.world.World; import client.MapleCharacter; import constants.ServerConstants; @@ -31,7 +32,7 @@ public class CharacterAutosaverWorker extends BaseWorker implements Runnable { @Override public void run() { - if(!ServerConstants.USE_AUTOSAVE) return; + if(!YamlConfig.config.server.USE_AUTOSAVE) return; PlayerStorage ps = wserv.getPlayerStorage(); for(MapleCharacter chr: ps.getAllCharacters()) { diff --git a/src/net/server/worker/RankingLoginWorker.java b/src/net/server/worker/RankingLoginWorker.java index 32cc51afd7..6288fef75f 100644 --- a/src/net/server/worker/RankingLoginWorker.java +++ b/src/net/server/worker/RankingLoginWorker.java @@ -26,6 +26,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import client.MapleJob; +import config.YamlConfig; import tools.DatabaseConnection; import constants.ServerConstants; import net.server.Server; @@ -85,7 +86,7 @@ public class RankingLoginWorker implements Runnable { con = DatabaseConnection.getConnection(); con.setAutoCommit(false); - if(ServerConstants.USE_REFRESH_RANK_MOVE == true) { + if(YamlConfig.config.server.USE_REFRESH_RANK_MOVE == true) { resetMoveRank(true); resetMoveRank(false); } diff --git a/src/net/server/worker/TimeoutWorker.java b/src/net/server/worker/TimeoutWorker.java index 6a23f441e8..f9c7b921b6 100644 --- a/src/net/server/worker/TimeoutWorker.java +++ b/src/net/server/worker/TimeoutWorker.java @@ -1,6 +1,7 @@ package net.server.worker; import client.MapleCharacter; +import config.YamlConfig; import constants.ServerConstants; import net.server.world.World; import tools.FilePrinter; @@ -17,7 +18,7 @@ public class TimeoutWorker extends BaseWorker implements Runnable { long time = System.currentTimeMillis(); Collection chars = wserv.getPlayerStorage().getAllCharacters(); for(MapleCharacter chr : chars) { - if(time - chr.getClient().getLastPacket() > ServerConstants.TIMEOUT_DURATION) { + if(time - chr.getClient().getLastPacket() > YamlConfig.config.server.TIMEOUT_DURATION) { FilePrinter.print(FilePrinter.DCS + chr.getClient().getAccountName(), chr.getName() + " auto-disconnected due to inactivity."); chr.getClient().disconnect(true, chr.getCashShop().isOpened()); } diff --git a/src/net/server/world/MapleParty.java b/src/net/server/world/MapleParty.java index d4d192e591..d6758c77e4 100644 --- a/src/net/server/world/MapleParty.java +++ b/src/net/server/world/MapleParty.java @@ -23,6 +23,7 @@ package net.server.world; import client.MapleCharacter; import client.MapleClient; +import config.YamlConfig; import constants.ServerConstants; import java.util.Collection; import java.util.Collections; @@ -344,7 +345,7 @@ public class MapleParty { public static boolean createParty(MapleCharacter player, boolean silentCheck) { MapleParty party = player.getParty(); if (party == null) { - if (player.getLevel() < 10 && !ServerConstants.USE_PARTY_FOR_STARTERS) { + if (player.getLevel() < 10 && !YamlConfig.config.server.USE_PARTY_FOR_STARTERS) { player.announce(MaplePacketCreator.partyStatusMessage(10)); return false; } else if (player.getAriantColiseum() != null) { diff --git a/src/net/server/world/World.java b/src/net/server/world/World.java index ddf1e8f7fd..cd9c159c7e 100644 --- a/src/net/server/world/World.java +++ b/src/net/server/world/World.java @@ -27,6 +27,7 @@ import client.BuddyList.BuddyOperation; import client.BuddylistEntry; import client.MapleCharacter; import client.MapleFamily; +import config.YamlConfig; import constants.GameConstants; import constants.ServerConstants; import java.sql.Connection; @@ -211,13 +212,13 @@ public class World { merchantSchedule = tman.register(new HiredMerchantWorker(this), 10 * 60 * 1000, 10 * 60 * 1000); timedMapObjectsSchedule = tman.register(new TimedMapObjectWorker(this), 60 * 1000, 60 * 1000); charactersSchedule = tman.register(new CharacterAutosaverWorker(this), 60 * 60 * 1000, 60 * 60 * 1000); - marriagesSchedule = tman.register(new WeddingReservationWorker(this), ServerConstants.WEDDING_RESERVATION_INTERVAL * 60 * 1000, ServerConstants.WEDDING_RESERVATION_INTERVAL * 60 * 1000); + marriagesSchedule = tman.register(new WeddingReservationWorker(this), YamlConfig.config.server.WEDDING_RESERVATION_INTERVAL * 60 * 1000, YamlConfig.config.server.WEDDING_RESERVATION_INTERVAL * 60 * 1000); mapOwnershipSchedule = tman.register(new MapOwnershipWorker(this), 20 * 1000, 20 * 1000); fishingSchedule = tman.register(new FishingWorker(this), 10 * 1000, 10 * 1000); partySearchSchedule = tman.register(new PartySearchWorker(this), 10 * 1000, 10 * 1000); timeoutSchedule = tman.register(new TimeoutWorker(this), 10 * 1000, 10 * 1000); - if(ServerConstants.USE_FAMILY_SYSTEM) { + if(YamlConfig.config.server.USE_FAMILY_SYSTEM) { long timeLeft = Server.getTimeLeftForNextDay(); FamilyDailyResetWorker.resetEntitlementUsage(this); tman.register(new FamilyDailyResetWorker(this), 24 * 60 * 60 * 1000, timeLeft); @@ -624,7 +625,7 @@ public class World { } public int getWorldCapacityStatus() { - int worldCap = getChannelsSize() * ServerConstants.CHANNEL_LOAD; + int worldCap = getChannelsSize() * YamlConfig.config.server.CHANNEL_LOAD; int num = players.getSize(); int status; @@ -1320,7 +1321,7 @@ public class World { } public List> getOwlSearchedItems() { - if(ServerConstants.USE_ENFORCE_ITEM_SUGGESTION) { + if(YamlConfig.config.server.USE_ENFORCE_ITEM_SUGGESTION) { return new ArrayList<>(0); } @@ -1355,7 +1356,7 @@ public class World { } private List>> getBoughtCashItems() { - if (ServerConstants.USE_ENFORCE_ITEM_SUGGESTION) { + if (YamlConfig.config.server.USE_ENFORCE_ITEM_SUGGESTION) { List>> boughtCounts = new ArrayList<>(9); // thanks GabrielSin for pointing out an issue here @@ -1445,7 +1446,7 @@ public class World { } public void registerPetHunger(MapleCharacter chr, byte petSlot) { - if(chr.isGM() && ServerConstants.GM_PETS_NEVER_HUNGRY || ServerConstants.PETS_NEVER_HUNGRY) { + if(chr.isGM() && YamlConfig.config.server.GM_PETS_NEVER_HUNGRY || YamlConfig.config.server.PETS_NEVER_HUNGRY) { return; } @@ -1454,8 +1455,8 @@ public class World { activePetsLock.lock(); try { int initProc; - if(Server.getInstance().getCurrentTime() - petUpdate > 55000) initProc = ServerConstants.PET_EXHAUST_COUNT - 2; - else initProc = ServerConstants.PET_EXHAUST_COUNT - 1; + if(Server.getInstance().getCurrentTime() - petUpdate > 55000) initProc = YamlConfig.config.server.PET_EXHAUST_COUNT - 2; + else initProc = YamlConfig.config.server.PET_EXHAUST_COUNT - 1; activePets.put(key, initProc); } finally { @@ -1490,7 +1491,7 @@ public class World { if(chr == null || !chr.isLoggedinWorld()) continue; Integer dpVal = dp.getValue() + 1; - if(dpVal == ServerConstants.PET_EXHAUST_COUNT) { + if(dpVal == YamlConfig.config.server.PET_EXHAUST_COUNT) { chr.runFullnessSchedule(dp.getKey() % 4); dpVal = 0; } @@ -1505,7 +1506,7 @@ public class World { } public void registerMountHunger(MapleCharacter chr) { - if(chr.isGM() && ServerConstants.GM_PETS_NEVER_HUNGRY || ServerConstants.PETS_NEVER_HUNGRY) { + if(chr.isGM() && YamlConfig.config.server.GM_PETS_NEVER_HUNGRY || YamlConfig.config.server.PETS_NEVER_HUNGRY) { return; } @@ -1513,8 +1514,8 @@ public class World { activeMountsLock.lock(); try { int initProc; - if(Server.getInstance().getCurrentTime() - mountUpdate > 45000) initProc = ServerConstants.MOUNT_EXHAUST_COUNT - 2; - else initProc = ServerConstants.MOUNT_EXHAUST_COUNT - 1; + if(Server.getInstance().getCurrentTime() - mountUpdate > 45000) initProc = YamlConfig.config.server.MOUNT_EXHAUST_COUNT - 2; + else initProc = YamlConfig.config.server.MOUNT_EXHAUST_COUNT - 1; activeMounts.put(key, initProc); } finally { @@ -1548,7 +1549,7 @@ public class World { if(chr == null || !chr.isLoggedinWorld()) continue; int dpVal = dp.getValue() + 1; - if(dpVal == ServerConstants.MOUNT_EXHAUST_COUNT) { + if(dpVal == YamlConfig.config.server.MOUNT_EXHAUST_COUNT) { if (!chr.runTirednessSchedule()) { continue; } diff --git a/src/scripting/AbstractPlayerInteraction.java b/src/scripting/AbstractPlayerInteraction.java index 6c51a4183d..3f59073190 100644 --- a/src/scripting/AbstractPlayerInteraction.java +++ b/src/scripting/AbstractPlayerInteraction.java @@ -30,6 +30,7 @@ import java.util.LinkedList; import java.util.List; import client.Skill; +import config.YamlConfig; import net.server.Server; import net.server.channel.Channel; import net.server.guild.MapleGuild; @@ -627,9 +628,9 @@ public class AbstractPlayerInteraction { it.setUpgradeSlots(3); } - if(ServerConstants.USE_ENHANCED_CRAFTING == true && c.getPlayer().getCS() == true) { + if(YamlConfig.config.server.USE_ENHANCED_CRAFTING == true && c.getPlayer().getCS() == true) { Equip eqp = (Equip)item; - if(!(c.getPlayer().isGM() && ServerConstants.USE_PERFECT_GM_SCROLL)) { + if(!(c.getPlayer().isGM() && YamlConfig.config.server.USE_PERFECT_GM_SCROLL)) { eqp.setUpgradeSlots((byte)(eqp.getUpgradeSlots() + 1)); } item = MapleItemInformationProvider.getInstance().scrollEquipWithId(item, 2049100, true, 2049100, c.getPlayer().isGM()); @@ -855,8 +856,8 @@ public class AbstractPlayerInteraction { int base = PartyQuest.getExp(PQ, player.getLevel()); int exp = base * bonus / 100; player.gainExp(exp, true, true); - if(ServerConstants.PQ_BONUS_EXP_RATE > 0 && System.currentTimeMillis() <= ServerConstants.EVENT_END_TIMESTAMP) { - player.gainExp((int) (exp * ServerConstants.PQ_BONUS_EXP_RATE), true, true); + if(YamlConfig.config.server.PQ_BONUS_EXP_RATE > 0 && System.currentTimeMillis() <= YamlConfig.config.server.EVENT_END_TIMESTAMP) { + player.gainExp((int) (exp * YamlConfig.config.server.PQ_BONUS_EXP_RATE), true, true); } } } @@ -1159,7 +1160,7 @@ public class AbstractPlayerInteraction { } public boolean canGetFirstJob(int jobType) { - if (ServerConstants.USE_AUTOASSIGN_STARTERS_AP) { + if (YamlConfig.config.server.USE_AUTOASSIGN_STARTERS_AP) { return true; } diff --git a/src/scripting/event/EventInstanceManager.java b/src/scripting/event/EventInstanceManager.java index 109c4f4b40..2f888ac7ba 100644 --- a/src/scripting/event/EventInstanceManager.java +++ b/src/scripting/event/EventInstanceManager.java @@ -31,6 +31,8 @@ import java.util.Set; import java.util.Iterator; import java.util.Properties; import javax.script.ScriptException; + +import config.YamlConfig; import net.server.audit.LockCollector; import net.server.audit.locks.MonitoredLockType; import net.server.audit.locks.MonitoredReentrantLock; @@ -102,9 +104,9 @@ public class EventInstanceManager { private boolean eventStarted = false; // multi-leveled PQ rewards! - private Map> collectionSet = new HashMap<>(ServerConstants.MAX_EVENT_LEVELS); - private Map> collectionQty = new HashMap<>(ServerConstants.MAX_EVENT_LEVELS); - private Map collectionExp = new HashMap<>(ServerConstants.MAX_EVENT_LEVELS); + private Map> collectionSet = new HashMap<>(YamlConfig.config.server.MAX_EVENT_LEVELS); + private Map> collectionQty = new HashMap<>(YamlConfig.config.server.MAX_EVENT_LEVELS); + private Map collectionExp = new HashMap<>(YamlConfig.config.server.MAX_EVENT_LEVELS); // Exp/Meso rewards by CLEAR on a stage private List onMapClearExp = new ArrayList<>(); @@ -995,7 +997,7 @@ public class EventInstanceManager { public final void setEventRewards(int eventLevel, List rwds, List qtys, int expGiven) { // fixed EXP will be rewarded at the same time the random item is given - if(eventLevel <= 0 || eventLevel > ServerConstants.MAX_EVENT_LEVELS) return; + if(eventLevel <= 0 || eventLevel > YamlConfig.config.server.MAX_EVENT_LEVELS) return; eventLevel--; //event level starts from 1 List rewardIds = convertToIntegerArray(rwds); @@ -1105,7 +1107,7 @@ public class EventInstanceManager { eventCleared = true; for (MapleCharacter chr : getPlayers()) { - chr.awardQuestPoint(ServerConstants.QUEST_POINT_PER_EVENT_CLEAR); + chr.awardQuestPoint(YamlConfig.config.server.QUEST_POINT_PER_EVENT_CLEAR); } sL.lock(); diff --git a/src/scripting/event/EventManager.java b/src/scripting/event/EventManager.java index 4daeeade36..d7245805b5 100644 --- a/src/scripting/event/EventManager.java +++ b/src/scripting/event/EventManager.java @@ -21,6 +21,7 @@ */ package scripting.event; +import config.YamlConfig; import jdk.nashorn.api.scripting.ScriptObjectMirror; import jdk.nashorn.api.scripting.ScriptUtils; import tools.exceptions.EventInstanceInProgressException; @@ -184,7 +185,7 @@ public class EventManager { } public long getLobbyDelay() { - return ServerConstants.EVENT_LOBBY_DELAY; + return YamlConfig.config.server.EVENT_LOBBY_DELAY; } private List getLobbyRange() { @@ -312,7 +313,7 @@ public class EventManager { instances.remove(name); } } - }, ServerConstants.EVENT_LOBBY_DELAY * 1000); + }, YamlConfig.config.server.EVENT_LOBBY_DELAY * 1000); } public void setProperty(String key, String value) { @@ -839,7 +840,7 @@ public class EventManager { public boolean isQueueFull() { synchronized(queuedGuilds) { - return queuedGuilds.size() >= ServerConstants.EVENT_MAX_GUILD_QUEUE; + return queuedGuilds.size() >= YamlConfig.config.server.EVENT_MAX_GUILD_QUEUE; } } diff --git a/src/scripting/event/worker/EventScriptScheduler.java b/src/scripting/event/worker/EventScriptScheduler.java index a9b1f4b421..fc935e0572 100644 --- a/src/scripting/event/worker/EventScriptScheduler.java +++ b/src/scripting/event/worker/EventScriptScheduler.java @@ -19,6 +19,7 @@ */ package scripting.event.worker; +import config.YamlConfig; import constants.ServerConstants; import java.util.HashMap; import java.util.LinkedList; @@ -66,7 +67,7 @@ public class EventScriptScheduler { if (registeredEntries.isEmpty()) { idleProcs++; - if (idleProcs >= ServerConstants.MOB_STATUS_MONITOR_LIFE) { + if (idleProcs >= YamlConfig.config.server.MOB_STATUS_MONITOR_LIFE) { if (schedulerTask != null) { schedulerTask.cancel(false); schedulerTask = null; @@ -118,7 +119,7 @@ public class EventScriptScheduler { return; } - schedulerTask = TimerManager.getInstance().register(monitorTask, ServerConstants.MOB_STATUS_MONITOR_PROC, ServerConstants.MOB_STATUS_MONITOR_PROC); + schedulerTask = TimerManager.getInstance().register(monitorTask, YamlConfig.config.server.MOB_STATUS_MONITOR_PROC, YamlConfig.config.server.MOB_STATUS_MONITOR_PROC); } registeredEntries.put(scheduledAction, Server.getInstance().getCurrentTime() + duration); diff --git a/src/scripting/npc/NPCConversationManager.java b/src/scripting/npc/NPCConversationManager.java index 3a99a829b3..549c5e3c02 100644 --- a/src/scripting/npc/NPCConversationManager.java +++ b/src/scripting/npc/NPCConversationManager.java @@ -24,6 +24,7 @@ package scripting.npc; import java.io.File; import java.sql.SQLException; +import config.YamlConfig; import constants.ServerConstants; import net.server.Server; import net.server.guild.MapleAlliance; @@ -340,7 +341,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction { public boolean canSpawnPlayerNpc(int mapid) { MapleCharacter chr = getPlayer(); - return !ServerConstants.PLAYERNPC_AUTODEPLOY && chr.getLevel() >= chr.getMaxClassLevel() && !chr.isGM() && MaplePlayerNPC.canSpawnPlayerNpc(chr.getName(), mapid); + return !YamlConfig.config.server.PLAYERNPC_AUTODEPLOY && chr.getLevel() >= chr.getMaxClassLevel() && !chr.isGM() && MaplePlayerNPC.canSpawnPlayerNpc(chr.getName(), mapid); } public MaplePlayerNPC getPlayerNPCByScriptid(int scriptId) { @@ -592,7 +593,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction { } public boolean isUsingOldPqNpcStyle() { - return ServerConstants.USE_OLD_GMS_STYLED_PQ_NPCS && this.getPlayer().getParty() != null; + return YamlConfig.config.server.USE_OLD_GMS_STYLED_PQ_NPCS && this.getPlayer().getParty() != null; } public Object[] getAvailableMasteryBooks() { diff --git a/src/scripting/reactor/ReactorActionManager.java b/src/scripting/reactor/ReactorActionManager.java index 084ceac838..67c8d1f602 100644 --- a/src/scripting/reactor/ReactorActionManager.java +++ b/src/scripting/reactor/ReactorActionManager.java @@ -26,6 +26,7 @@ import client.MapleClient; import client.inventory.Equip; import client.inventory.Item; import client.inventory.MapleInventoryType; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; import java.awt.Point; @@ -288,7 +289,7 @@ public class ReactorActionManager extends AbstractPlayerInteraction { } public void hitMonsterWithReactor(int id, int hitsToKill) { // until someone comes with a better solution, why not? - int customTime = ServerConstants.MOB_REACTOR_REFRESH_TIME; + int customTime = YamlConfig.config.server.MOB_REACTOR_REFRESH_TIME; if(customTime > 0) { reactor.setDelay(customTime); } diff --git a/src/server/CashShop.java b/src/server/CashShop.java index acdd2ddc5f..8a245e3167 100644 --- a/src/server/CashShop.java +++ b/src/server/CashShop.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.locks.Lock; +import config.YamlConfig; import net.server.Server; import net.server.audit.locks.factory.MonitoredReentrantLockFactory; @@ -278,7 +279,7 @@ public class CashShop { this.accountId = accountId; this.characterId = characterId; - if (!ServerConstants.USE_JOINT_CASHSHOP_INVENTORY) { + if (!YamlConfig.config.server.USE_JOINT_CASHSHOP_INVENTORY) { if (jobType == 0) { factory = ItemFactory.CASH_EXPLORER; } else if (jobType == 1) { @@ -358,7 +359,7 @@ public class CashShop { public void gainCash(int type, CashItem buyItem, int world) { gainCash(type, -buyItem.getPrice()); - if(!ServerConstants.USE_ENFORCE_ITEM_SUGGESTION) Server.getInstance().getWorld(world).addCashItemBought(buyItem.getSN()); + if(!YamlConfig.config.server.USE_ENFORCE_ITEM_SUGGESTION) Server.getInstance().getWorld(world).addCashItemBought(buyItem.getSN()); } public boolean isOpened() { diff --git a/src/server/MakerItemFactory.java b/src/server/MakerItemFactory.java index bdfaf6a38a..c7201b1fe7 100644 --- a/src/server/MakerItemFactory.java +++ b/src/server/MakerItemFactory.java @@ -21,6 +21,7 @@ */ package server; +import config.YamlConfig; import constants.EquipType; import constants.ServerConstants; import java.util.ArrayList; @@ -74,7 +75,7 @@ public class MakerItemFactory { } private static double getMakerStimulantFee(int itemid) { - if(ServerConstants.USE_MAKER_FEE_HEURISTICS) { + if(YamlConfig.config.server.USE_MAKER_FEE_HEURISTICS) { EquipType et = EquipType.getEquipTypeById(itemid); int eqpLevel = ii.getEquipLevelReq(itemid); @@ -109,7 +110,7 @@ public class MakerItemFactory { } private static double getMakerReagentFee(int itemid, int reagentLevel) { - if(ServerConstants.USE_MAKER_FEE_HEURISTICS) { + if(YamlConfig.config.server.USE_MAKER_FEE_HEURISTICS) { EquipType et = EquipType.getEquipTypeById(itemid); int eqpLevel = ii.getEquipLevelReq(itemid); diff --git a/src/server/MapleItemInformationProvider.java b/src/server/MapleItemInformationProvider.java index 9f669eb0b3..c2206724c2 100644 --- a/src/server/MapleItemInformationProvider.java +++ b/src/server/MapleItemInformationProvider.java @@ -36,6 +36,7 @@ import java.util.Map.Entry; import java.util.Set; import java.util.HashSet; +import config.YamlConfig; import net.server.Server; import provider.MapleData; import provider.MapleDataDirectoryEntry; @@ -619,7 +620,7 @@ public class MapleItemInformationProvider { } public static boolean rollSuccessChance(double propPercent) { - return Math.random() >= testYourLuck(propPercent / 100.0, ServerConstants.SCROLL_CHANCE_RATE); + return Math.random() >= testYourLuck(propPercent / 100.0, YamlConfig.config.server.SCROLL_CHANCE_RATE); } private static short getMaximumShortMaxIfOverflow(int value1, int value2) { @@ -640,72 +641,72 @@ public class MapleItemInformationProvider { if(!option) { if (nEquip.getStr() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setStr(getMaximumShortMaxIfOverflow(nEquip.getStr(), (nEquip.getStr() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setStr(getMaximumShortMaxIfOverflow(nEquip.getStr(), (nEquip.getStr() + chscrollRandomizedStat(range)))); else nEquip.setStr(getMaximumShortMaxIfOverflow(0, (nEquip.getStr() + chscrollRandomizedStat(range)))); } if (nEquip.getDex() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setDex(getMaximumShortMaxIfOverflow(nEquip.getDex(), (nEquip.getDex() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setDex(getMaximumShortMaxIfOverflow(nEquip.getDex(), (nEquip.getDex() + chscrollRandomizedStat(range)))); else nEquip.setDex(getMaximumShortMaxIfOverflow(0, (nEquip.getDex() + chscrollRandomizedStat(range)))); } if (nEquip.getInt() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setInt(getMaximumShortMaxIfOverflow(nEquip.getInt(), (nEquip.getInt() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setInt(getMaximumShortMaxIfOverflow(nEquip.getInt(), (nEquip.getInt() + chscrollRandomizedStat(range)))); else nEquip.setInt(getMaximumShortMaxIfOverflow(0, (nEquip.getInt() + chscrollRandomizedStat(range)))); } if (nEquip.getLuk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setLuk(getMaximumShortMaxIfOverflow(nEquip.getLuk(), (nEquip.getLuk() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setLuk(getMaximumShortMaxIfOverflow(nEquip.getLuk(), (nEquip.getLuk() + chscrollRandomizedStat(range)))); else nEquip.setLuk(getMaximumShortMaxIfOverflow(0, (nEquip.getLuk() + chscrollRandomizedStat(range)))); } if (nEquip.getAcc() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setAcc(getMaximumShortMaxIfOverflow(nEquip.getAcc(), (nEquip.getAcc() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setAcc(getMaximumShortMaxIfOverflow(nEquip.getAcc(), (nEquip.getAcc() + chscrollRandomizedStat(range)))); else nEquip.setAcc(getMaximumShortMaxIfOverflow(0, (nEquip.getAcc() + chscrollRandomizedStat(range)))); } if (nEquip.getAvoid() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setAvoid(getMaximumShortMaxIfOverflow(nEquip.getAvoid(), (nEquip.getAvoid() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setAvoid(getMaximumShortMaxIfOverflow(nEquip.getAvoid(), (nEquip.getAvoid() + chscrollRandomizedStat(range)))); else nEquip.setAvoid(getMaximumShortMaxIfOverflow(0, (nEquip.getAvoid() + chscrollRandomizedStat(range)))); } } else { if (nEquip.getWatk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setWatk(getMaximumShortMaxIfOverflow(nEquip.getWatk(), (nEquip.getWatk() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setWatk(getMaximumShortMaxIfOverflow(nEquip.getWatk(), (nEquip.getWatk() + chscrollRandomizedStat(range)))); else nEquip.setWatk(getMaximumShortMaxIfOverflow(0, (nEquip.getWatk() + chscrollRandomizedStat(range)))); } if (nEquip.getWdef() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setWdef(getMaximumShortMaxIfOverflow(nEquip.getWdef(), (nEquip.getWdef() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setWdef(getMaximumShortMaxIfOverflow(nEquip.getWdef(), (nEquip.getWdef() + chscrollRandomizedStat(range)))); else nEquip.setWdef(getMaximumShortMaxIfOverflow(0, (nEquip.getWdef() + chscrollRandomizedStat(range)))); } if (nEquip.getMatk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setMatk(getMaximumShortMaxIfOverflow(nEquip.getMatk(), (nEquip.getMatk() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setMatk(getMaximumShortMaxIfOverflow(nEquip.getMatk(), (nEquip.getMatk() + chscrollRandomizedStat(range)))); else nEquip.setMatk(getMaximumShortMaxIfOverflow(0, (nEquip.getMatk() + chscrollRandomizedStat(range)))); } if (nEquip.getMdef() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setMdef(getMaximumShortMaxIfOverflow(nEquip.getMdef(), (nEquip.getMdef() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setMdef(getMaximumShortMaxIfOverflow(nEquip.getMdef(), (nEquip.getMdef() + chscrollRandomizedStat(range)))); else nEquip.setMdef(getMaximumShortMaxIfOverflow(0, (nEquip.getMdef() + chscrollRandomizedStat(range)))); } if (nEquip.getSpeed() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setSpeed(getMaximumShortMaxIfOverflow(nEquip.getSpeed(), (nEquip.getSpeed() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setSpeed(getMaximumShortMaxIfOverflow(nEquip.getSpeed(), (nEquip.getSpeed() + chscrollRandomizedStat(range)))); else nEquip.setSpeed(getMaximumShortMaxIfOverflow(0, (nEquip.getSpeed() + chscrollRandomizedStat(range)))); } if (nEquip.getJump() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setJump(getMaximumShortMaxIfOverflow(nEquip.getJump(), (nEquip.getJump() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setJump(getMaximumShortMaxIfOverflow(nEquip.getJump(), (nEquip.getJump() + chscrollRandomizedStat(range)))); else nEquip.setJump(getMaximumShortMaxIfOverflow(0, (nEquip.getJump() + chscrollRandomizedStat(range)))); } if (nEquip.getHp() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setHp(getMaximumShortMaxIfOverflow(nEquip.getHp(), (nEquip.getHp() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setHp(getMaximumShortMaxIfOverflow(nEquip.getHp(), (nEquip.getHp() + chscrollRandomizedStat(range)))); else nEquip.setHp(getMaximumShortMaxIfOverflow(0, (nEquip.getHp() + chscrollRandomizedStat(range)))); } if (nEquip.getMp() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setMp(getMaximumShortMaxIfOverflow(nEquip.getMp(), (nEquip.getMp() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setMp(getMaximumShortMaxIfOverflow(nEquip.getMp(), (nEquip.getMp() + chscrollRandomizedStat(range)))); else nEquip.setMp(getMaximumShortMaxIfOverflow(0, (nEquip.getMp() + chscrollRandomizedStat(range)))); } } } private void scrollEquipWithChaos(Equip nEquip, int range) { - if(ServerConstants.CHSCROLL_STAT_RATE > 0) { + if(YamlConfig.config.server.CHSCROLL_STAT_RATE > 0) { int temp; short curStr, curDex, curInt, curLuk, curWatk, curWdef, curMatk, curMdef, curAcc, curAvoid, curSpeed, curJump, curHp, curMp; - if(ServerConstants.USE_ENHANCED_CHSCROLL) { + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) { curStr = nEquip.getStr(); curDex = nEquip.getDex(); curInt = nEquip.getInt(); @@ -737,100 +738,100 @@ public class MapleItemInformationProvider { curMp = Short.MIN_VALUE; } - for(int i = 0; i < ServerConstants.CHSCROLL_STAT_RATE; i++) { + for(int i = 0; i < YamlConfig.config.server.CHSCROLL_STAT_RATE; i++) { if (nEquip.getStr() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curStr + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curStr + chscrollRandomizedStat(range); else temp = nEquip.getStr() + chscrollRandomizedStat(range); curStr = getMaximumShortMaxIfOverflow(temp, curStr); } if (nEquip.getDex() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curDex + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curDex + chscrollRandomizedStat(range); else temp = nEquip.getDex() + chscrollRandomizedStat(range); curDex = getMaximumShortMaxIfOverflow(temp, curDex); } if (nEquip.getInt() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curInt + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curInt + chscrollRandomizedStat(range); else temp = nEquip.getInt() + chscrollRandomizedStat(range); curInt = getMaximumShortMaxIfOverflow(temp, curInt); } if (nEquip.getLuk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curLuk + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curLuk + chscrollRandomizedStat(range); else temp = nEquip.getLuk() + chscrollRandomizedStat(range); curLuk = getMaximumShortMaxIfOverflow(temp, curLuk); } if (nEquip.getWatk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curWatk + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curWatk + chscrollRandomizedStat(range); else temp = nEquip.getWatk() + chscrollRandomizedStat(range); curWatk = getMaximumShortMaxIfOverflow(temp, curWatk); } if (nEquip.getWdef() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curWdef + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curWdef + chscrollRandomizedStat(range); else temp = nEquip.getWdef() + chscrollRandomizedStat(range); curWdef = getMaximumShortMaxIfOverflow(temp, curWdef); } if (nEquip.getMatk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curMatk + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curMatk + chscrollRandomizedStat(range); else temp = nEquip.getMatk() + chscrollRandomizedStat(range); curMatk = getMaximumShortMaxIfOverflow(temp, curMatk); } if (nEquip.getMdef() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curMdef + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curMdef + chscrollRandomizedStat(range); else temp = nEquip.getMdef() + chscrollRandomizedStat(range); curMdef = getMaximumShortMaxIfOverflow(temp, curMdef); } if (nEquip.getAcc() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curAcc + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curAcc + chscrollRandomizedStat(range); else temp = nEquip.getAcc() + chscrollRandomizedStat(range); curAcc = getMaximumShortMaxIfOverflow(temp, curAcc); } if (nEquip.getAvoid() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curAvoid + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curAvoid + chscrollRandomizedStat(range); else temp = nEquip.getAvoid() + chscrollRandomizedStat(range); curAvoid = getMaximumShortMaxIfOverflow(temp, curAvoid); } if (nEquip.getSpeed() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curSpeed + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curSpeed + chscrollRandomizedStat(range); else temp = nEquip.getSpeed() + chscrollRandomizedStat(range); curSpeed = getMaximumShortMaxIfOverflow(temp, curSpeed); } if (nEquip.getJump() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curJump + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curJump + chscrollRandomizedStat(range); else temp = nEquip.getJump() + chscrollRandomizedStat(range); curJump = getMaximumShortMaxIfOverflow(temp, curJump); } if (nEquip.getHp() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curHp + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curHp + chscrollRandomizedStat(range); else temp = nEquip.getHp() + chscrollRandomizedStat(range); curHp = getMaximumShortMaxIfOverflow(temp, curHp); } if (nEquip.getMp() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) temp = curMp + chscrollRandomizedStat(range); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) temp = curMp + chscrollRandomizedStat(range); else temp = nEquip.getMp() + chscrollRandomizedStat(range); curMp = getMaximumShortMaxIfOverflow(temp, curMp); @@ -855,59 +856,59 @@ public class MapleItemInformationProvider { else { if (nEquip.getStr() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setStr(getMaximumShortMaxIfOverflow(nEquip.getStr(), (nEquip.getStr() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setStr(getMaximumShortMaxIfOverflow(nEquip.getStr(), (nEquip.getStr() + chscrollRandomizedStat(range)))); else nEquip.setStr(getMaximumShortMaxIfOverflow(0, (nEquip.getStr() + chscrollRandomizedStat(range)))); } if (nEquip.getDex() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setDex(getMaximumShortMaxIfOverflow(nEquip.getDex(), (nEquip.getDex() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setDex(getMaximumShortMaxIfOverflow(nEquip.getDex(), (nEquip.getDex() + chscrollRandomizedStat(range)))); else nEquip.setDex(getMaximumShortMaxIfOverflow(0, (nEquip.getDex() + chscrollRandomizedStat(range)))); } if (nEquip.getInt() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setInt(getMaximumShortMaxIfOverflow(nEquip.getInt(), (nEquip.getInt() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setInt(getMaximumShortMaxIfOverflow(nEquip.getInt(), (nEquip.getInt() + chscrollRandomizedStat(range)))); else nEquip.setInt(getMaximumShortMaxIfOverflow(0, (nEquip.getInt() + chscrollRandomizedStat(range)))); } if (nEquip.getLuk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setLuk(getMaximumShortMaxIfOverflow(nEquip.getLuk(), (nEquip.getLuk() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setLuk(getMaximumShortMaxIfOverflow(nEquip.getLuk(), (nEquip.getLuk() + chscrollRandomizedStat(range)))); else nEquip.setLuk(getMaximumShortMaxIfOverflow(0, (nEquip.getLuk() + chscrollRandomizedStat(range)))); } if (nEquip.getWatk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setWatk(getMaximumShortMaxIfOverflow(nEquip.getWatk(), (nEquip.getWatk() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setWatk(getMaximumShortMaxIfOverflow(nEquip.getWatk(), (nEquip.getWatk() + chscrollRandomizedStat(range)))); else nEquip.setWatk(getMaximumShortMaxIfOverflow(0, (nEquip.getWatk() + chscrollRandomizedStat(range)))); } if (nEquip.getWdef() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setWdef(getMaximumShortMaxIfOverflow(nEquip.getWdef(), (nEquip.getWdef() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setWdef(getMaximumShortMaxIfOverflow(nEquip.getWdef(), (nEquip.getWdef() + chscrollRandomizedStat(range)))); else nEquip.setWdef(getMaximumShortMaxIfOverflow(0, (nEquip.getWdef() + chscrollRandomizedStat(range)))); } if (nEquip.getMatk() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setMatk(getMaximumShortMaxIfOverflow(nEquip.getMatk(), (nEquip.getMatk() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setMatk(getMaximumShortMaxIfOverflow(nEquip.getMatk(), (nEquip.getMatk() + chscrollRandomizedStat(range)))); else nEquip.setMatk(getMaximumShortMaxIfOverflow(0, (nEquip.getMatk() + chscrollRandomizedStat(range)))); } if (nEquip.getMdef() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setMdef(getMaximumShortMaxIfOverflow(nEquip.getMdef(), (nEquip.getMdef() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setMdef(getMaximumShortMaxIfOverflow(nEquip.getMdef(), (nEquip.getMdef() + chscrollRandomizedStat(range)))); else nEquip.setMdef(getMaximumShortMaxIfOverflow(0, (nEquip.getMdef() + chscrollRandomizedStat(range)))); } if (nEquip.getAcc() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setAcc(getMaximumShortMaxIfOverflow(nEquip.getAcc(), (nEquip.getAcc() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setAcc(getMaximumShortMaxIfOverflow(nEquip.getAcc(), (nEquip.getAcc() + chscrollRandomizedStat(range)))); else nEquip.setAcc(getMaximumShortMaxIfOverflow(0, (nEquip.getAcc() + chscrollRandomizedStat(range)))); } if (nEquip.getAvoid() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setAvoid(getMaximumShortMaxIfOverflow(nEquip.getAvoid(), (nEquip.getAvoid() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setAvoid(getMaximumShortMaxIfOverflow(nEquip.getAvoid(), (nEquip.getAvoid() + chscrollRandomizedStat(range)))); else nEquip.setAvoid(getMaximumShortMaxIfOverflow(0, (nEquip.getAvoid() + chscrollRandomizedStat(range)))); } if (nEquip.getSpeed() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setSpeed(getMaximumShortMaxIfOverflow(nEquip.getSpeed(), (nEquip.getSpeed() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setSpeed(getMaximumShortMaxIfOverflow(nEquip.getSpeed(), (nEquip.getSpeed() + chscrollRandomizedStat(range)))); else nEquip.setSpeed(getMaximumShortMaxIfOverflow(0, (nEquip.getSpeed() + chscrollRandomizedStat(range)))); } if (nEquip.getJump() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setJump(getMaximumShortMaxIfOverflow(nEquip.getJump(), (nEquip.getJump() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setJump(getMaximumShortMaxIfOverflow(nEquip.getJump(), (nEquip.getJump() + chscrollRandomizedStat(range)))); else nEquip.setJump(getMaximumShortMaxIfOverflow(0, (nEquip.getJump() + chscrollRandomizedStat(range)))); } if (nEquip.getHp() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setHp(getMaximumShortMaxIfOverflow(nEquip.getHp(), (nEquip.getHp() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setHp(getMaximumShortMaxIfOverflow(nEquip.getHp(), (nEquip.getHp() + chscrollRandomizedStat(range)))); else nEquip.setHp(getMaximumShortMaxIfOverflow(0, (nEquip.getHp() + chscrollRandomizedStat(range)))); } if (nEquip.getMp() > 0) { - if(ServerConstants.USE_ENHANCED_CHSCROLL) nEquip.setMp(getMaximumShortMaxIfOverflow(nEquip.getMp(), (nEquip.getMp() + chscrollRandomizedStat(range)))); + if(YamlConfig.config.server.USE_ENHANCED_CHSCROLL) nEquip.setMp(getMaximumShortMaxIfOverflow(nEquip.getMp(), (nEquip.getMp() + chscrollRandomizedStat(range)))); else nEquip.setMp(getMaximumShortMaxIfOverflow(0, (nEquip.getMp() + chscrollRandomizedStat(range)))); } } @@ -915,11 +916,11 @@ public class MapleItemInformationProvider { public boolean canUseCleanSlate(Equip nEquip) { Map eqstats = this.getEquipStats(nEquip.getItemId()); - return ServerConstants.USE_ENHANCED_CLNSLATE || nEquip.getUpgradeSlots() < (byte) (eqstats.get("tuc") + nEquip.getVicious()); // issue with clean slate found thanks to Masterrulax, vicious added in the check thanks to Crypter (CrypterDEV) + return YamlConfig.config.server.USE_ENHANCED_CLNSLATE || nEquip.getUpgradeSlots() < (byte) (eqstats.get("tuc") + nEquip.getVicious()); // issue with clean slate found thanks to Masterrulax, vicious added in the check thanks to Crypter (CrypterDEV) } public Item scrollEquipWithId(Item equip, int scrollId, boolean usingWhiteScroll, int vegaItemId, boolean isGM) { - boolean assertGM = (isGM && ServerConstants.USE_PERFECT_GM_SCROLL); + boolean assertGM = (isGM && YamlConfig.config.server.USE_PERFECT_GM_SCROLL); if (equip instanceof Equip) { Equip nEquip = (Equip) equip; @@ -966,7 +967,7 @@ public class MapleItemInformationProvider { case 2049100: case 2049101: case 2049102: - scrollEquipWithChaos(nEquip, ServerConstants.CHSCROLL_STAT_RANGE); + scrollEquipWithChaos(nEquip, YamlConfig.config.server.CHSCROLL_STAT_RANGE); break; default: @@ -980,7 +981,7 @@ public class MapleItemInformationProvider { nEquip.setLevel((byte) (nEquip.getLevel() + 1)); } } else { - if (!ServerConstants.USE_PERFECT_SCROLLING && !usingWhiteScroll && !ItemConstants.isCleanSlate(scrollId) && !assertGM && !ItemConstants.isModifierScroll(scrollId)) { + if (!YamlConfig.config.server.USE_PERFECT_SCROLLING && !usingWhiteScroll && !ItemConstants.isCleanSlate(scrollId) && !assertGM && !ItemConstants.isModifierScroll(scrollId)) { nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() - 1)); } if (Randomizer.nextInt(100) < stats.get("cursed")) { @@ -1606,11 +1607,11 @@ public class MapleItemInformationProvider { } public boolean isUnmerchable(int itemId) { - if(ServerConstants.USE_ENFORCE_UNMERCHABLE_CASH && isCash(itemId)) { + if(YamlConfig.config.server.USE_ENFORCE_UNMERCHABLE_CASH && isCash(itemId)) { return true; } - if (ServerConstants.USE_ENFORCE_UNMERCHABLE_PET && ItemConstants.isPet(itemId)) { + if (YamlConfig.config.server.USE_ENFORCE_UNMERCHABLE_PET && ItemConstants.isPet(itemId)) { return true; } diff --git a/src/server/MapleStatEffect.java b/src/server/MapleStatEffect.java index d15904122e..b3044446c8 100644 --- a/src/server/MapleStatEffect.java +++ b/src/server/MapleStatEffect.java @@ -29,6 +29,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import config.YamlConfig; import net.server.Server; import provider.MapleData; import provider.MapleDataTool; @@ -444,7 +445,7 @@ public class MapleStatEffect { } else { if (isMapChair(sourceid)) { addBuffStatPairToListIfNotZero(statups, MapleBuffStat.MAP_CHAIR, 1); - } else if ((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && ServerConstants.USE_ULTRA_NIMBLE_FEET == true) { + } else if ((sourceid == Beginner.NIMBLE_FEET || sourceid == Noblesse.NIMBLE_FEET || sourceid == Evan.NIMBLE_FEET || sourceid == Legend.AGILE_BODY) && YamlConfig.config.server.USE_ULTRA_NIMBLE_FEET == true) { ret.jump = (short) (ret.speed * 4); ret.speed *= 15; } @@ -465,7 +466,7 @@ public class MapleStatEffect { ret.lt = (Point) ltd.getData(); ret.rb = (Point) source.getChildByPath("rb").getData(); - if (ServerConstants.USE_MAXRANGE_ECHO_OF_HERO && (sourceid == Beginner.ECHO_OF_HERO || sourceid == Noblesse.ECHO_OF_HERO || sourceid == Legend.ECHO_OF_HERO || sourceid == Evan.ECHO_OF_HERO)) { + if (YamlConfig.config.server.USE_MAXRANGE_ECHO_OF_HERO && (sourceid == Beginner.ECHO_OF_HERO || sourceid == Noblesse.ECHO_OF_HERO || sourceid == Legend.ECHO_OF_HERO || sourceid == Evan.ECHO_OF_HERO)) { ret.lt = new Point(Integer.MIN_VALUE, Integer.MIN_VALUE); ret.rb = new Point(Integer.MAX_VALUE, Integer.MAX_VALUE); } @@ -473,7 +474,7 @@ public class MapleStatEffect { int x = MapleDataTool.getInt("x", source, 0); - if ((sourceid == Beginner.RECOVERY || sourceid == Noblesse.RECOVERY || sourceid == Evan.RECOVERY || sourceid == Legend.RECOVERY) && ServerConstants.USE_ULTRA_RECOVERY == true) { + if ((sourceid == Beginner.RECOVERY || sourceid == Noblesse.RECOVERY || sourceid == Evan.RECOVERY || sourceid == Legend.RECOVERY) && YamlConfig.config.server.USE_ULTRA_RECOVERY == true) { x *= 10; } ret.x = x; @@ -1233,7 +1234,7 @@ public class MapleStatEffect { } public int getBuffLocalDuration() { - return !ServerConstants.USE_BUFF_EVERLASTING ? duration : Integer.MAX_VALUE; + return !YamlConfig.config.server.USE_BUFF_EVERLASTING ? duration : Integer.MAX_VALUE; } public void silentApplyBuff(MapleCharacter chr, long localStartTime) { diff --git a/src/server/MapleStorageInventory.java b/src/server/MapleStorageInventory.java index b9702b8667..d224e89b5d 100644 --- a/src/server/MapleStorageInventory.java +++ b/src/server/MapleStorageInventory.java @@ -25,6 +25,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; @@ -359,7 +360,7 @@ public class MapleStorageInventory { } int invTypeCriteria = 1; - int sortCriteria = (ServerConstants.USE_ITEM_SORT_BY_NAME == true) ? 2 : 0; + int sortCriteria = (YamlConfig.config.server.USE_ITEM_SORT_BY_NAME == true) ? 2 : 0; PairedQuicksort pq = new PairedQuicksort(itemarray, sortCriteria, invTypeCriteria); inventory.clear(); diff --git a/src/server/MapleTrade.java b/src/server/MapleTrade.java index b14faade94..dea46307ad 100644 --- a/src/server/MapleTrade.java +++ b/src/server/MapleTrade.java @@ -26,6 +26,7 @@ import java.util.LinkedList; import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; +import config.YamlConfig; import tools.LogHelper; import tools.MaplePacketCreator; import client.MapleCharacter; @@ -114,7 +115,7 @@ public class MapleTrade { private void completeTrade() { byte result; - boolean show = ServerConstants.USE_DEBUG; + boolean show = YamlConfig.config.server.USE_DEBUG; items.clear(); meso = 0; @@ -147,7 +148,7 @@ public class MapleTrade { } private void cancel(byte result) { - boolean show = ServerConstants.USE_DEBUG; + boolean show = YamlConfig.config.server.USE_DEBUG; for (Item item : items) { MapleInventoryManipulator.addFromDrop(chr.getClient(), item, show); diff --git a/src/server/expeditions/MapleExpeditionBossLog.java b/src/server/expeditions/MapleExpeditionBossLog.java index fac70f4ae3..8dadc6001b 100644 --- a/src/server/expeditions/MapleExpeditionBossLog.java +++ b/src/server/expeditions/MapleExpeditionBossLog.java @@ -27,6 +27,8 @@ import java.sql.Timestamp; import java.util.Calendar; import java.util.LinkedList; import java.util.List; + +import config.YamlConfig; import constants.ServerConstants; import tools.DatabaseConnection; import tools.Pair; @@ -182,7 +184,7 @@ public class MapleExpeditionBossLog { } public static boolean attemptBoss(int cid, int channel, MapleExpedition exped, boolean log) { - if (!ServerConstants.USE_ENABLE_DAILY_EXPEDITIONS) { + if (!YamlConfig.config.server.USE_ENABLE_DAILY_EXPEDITIONS) { return true; } diff --git a/src/server/expeditions/MapleExpeditionType.java b/src/server/expeditions/MapleExpeditionType.java index c94007f176..3b1c2f96f6 100644 --- a/src/server/expeditions/MapleExpeditionType.java +++ b/src/server/expeditions/MapleExpeditionType.java @@ -22,6 +22,7 @@ package server.expeditions; +import config.YamlConfig; import constants.ServerConstants; /** @@ -60,7 +61,7 @@ public enum MapleExpeditionType { } public int getMinSize() { - return !ServerConstants.USE_ENABLE_SOLO_EXPEDITIONS ? minSize : 1; + return !YamlConfig.config.server.USE_ENABLE_SOLO_EXPEDITIONS ? minSize : 1; } public int getMaxSize() { diff --git a/src/server/life/MapleMonster.java b/src/server/life/MapleMonster.java index 0a2e6e7206..b6e4f44380 100644 --- a/src/server/life/MapleMonster.java +++ b/src/server/life/MapleMonster.java @@ -30,6 +30,7 @@ import client.Skill; import client.SkillFactory; import client.status.MonsterStatus; import client.status.MonsterStatusEffect; +import config.YamlConfig; import constants.ServerConstants; import constants.skills.Crusader; import constants.skills.FPMage; @@ -451,7 +452,7 @@ public class MapleMonster extends AbstractLoadedMapleLife { return; } - if (ServerConstants.USE_DEBUG) { + if (YamlConfig.config.server.USE_DEBUG) { from.dropMessage(5, "Hitted MOB " + this.getId() + ", OID " + this.getObjectId()); } @@ -525,8 +526,8 @@ public class MapleMonster extends AbstractLoadedMapleLife { } private void distributePlayerExperience(MapleCharacter chr, float exp, float partyBonusMod, int totalPartyLevel, boolean highestPartyDamager, boolean whiteExpGain, boolean hasPartySharers) { - float playerExp = (ServerConstants.EXP_SPLIT_COMMON_MOD * chr.getLevel()) / totalPartyLevel; - if (highestPartyDamager) playerExp += ServerConstants.EXP_SPLIT_MVP_MOD; + float playerExp = (YamlConfig.config.server.EXP_SPLIT_COMMON_MOD * chr.getLevel()) / totalPartyLevel; + if (highestPartyDamager) playerExp += YamlConfig.config.server.EXP_SPLIT_MVP_MOD; playerExp *= exp; float bonusExp = partyBonusMod * playerExp; @@ -537,7 +538,7 @@ public class MapleMonster extends AbstractLoadedMapleLife { private void distributePartyExperience(Map partyParticipation, float expPerDmg, Set underleveled, Map personalRatio, double sdevRatio) { IntervalBuilder leechInterval = new IntervalBuilder(); - leechInterval.addInterval(this.getLevel() - ServerConstants.EXP_SPLIT_LEVEL_INTERVAL, this.getLevel() + ServerConstants.EXP_SPLIT_LEVEL_INTERVAL); + leechInterval.addInterval(this.getLevel() - YamlConfig.config.server.EXP_SPLIT_LEVEL_INTERVAL, this.getLevel() + YamlConfig.config.server.EXP_SPLIT_LEVEL_INTERVAL); long maxDamage = 0, partyDamage = 0; MapleCharacter participationMvp = null; @@ -552,14 +553,14 @@ public class MapleMonster extends AbstractLoadedMapleLife { // thanks Thora for pointing out leech level limitation int chrLevel = e.getKey().getLevel(); - leechInterval.addInterval(chrLevel - ServerConstants.EXP_SPLIT_LEECH_INTERVAL, chrLevel + ServerConstants.EXP_SPLIT_LEECH_INTERVAL); + leechInterval.addInterval(chrLevel - YamlConfig.config.server.EXP_SPLIT_LEECH_INTERVAL, chrLevel + YamlConfig.config.server.EXP_SPLIT_LEECH_INTERVAL); } List expMembers = new LinkedList<>(); int totalPartyLevel = 0; // thanks G h o s t, Alfred, Vcoc, BHB for poiting out a bug in detecting party members after membership transactions in a party took place - if (ServerConstants.USE_ENFORCE_MOB_LEVEL_RANGE) { + if (YamlConfig.config.server.USE_ENFORCE_MOB_LEVEL_RANGE) { for (MapleCharacter member : partyParticipation.keySet().iterator().next().getPartyMembersOnSameMap()) { if (!leechInterval.inInterval(member.getLevel())) { underleveled.add(member); @@ -685,7 +686,7 @@ public class MapleMonster extends AbstractLoadedMapleLife { // thanks Prophecy & Aika for finding out Holy Symbol not being applied on party bonuses Integer holySymbol = attacker.getBuffedValue(MapleBuffStat.HOLY_SYMBOL); if (holySymbol != null) { - if (ServerConstants.USE_FULL_HOLY_SYMBOL) { // thanks Mordred, xinyifly, AyumiLove, andy33 for noticing HS hands out 20% of its potential on less than 3 players + if (YamlConfig.config.server.USE_FULL_HOLY_SYMBOL) { // thanks Mordred, xinyifly, AyumiLove, andy33 for noticing HS hands out 20% of its potential on less than 3 players multiplier *= (1.0 + (holySymbol.doubleValue() / 100.0)); } else { multiplier *= (1.0 + (holySymbol.doubleValue() / (hasPartySharers ? 100.0 : 500.0))); @@ -734,7 +735,7 @@ public class MapleMonster extends AbstractLoadedMapleLife { if (partyExp != null) { partyExp *= getStatusExpMultiplier(attacker, hasPartySharers); partyExp *= attacker.getExpRate(); - partyExp *= ServerConstants.PARTY_BONUS_EXP_RATE; + partyExp *= YamlConfig.config.server.PARTY_BONUS_EXP_RATE; } else { partyExp = 0.0f; } @@ -964,7 +965,7 @@ public class MapleMonster extends AbstractLoadedMapleLife { private void giveFamilyRep(MapleFamilyEntry entry) { if(entry != null) { - int repGain = isBoss() ? ServerConstants.FAMILY_REP_PER_BOSS_KILL : ServerConstants.FAMILY_REP_PER_KILL; + int repGain = isBoss() ? YamlConfig.config.server.FAMILY_REP_PER_BOSS_KILL : YamlConfig.config.server.FAMILY_REP_PER_KILL; if(getMaxHp() <= 1) repGain = 0; //don't count trash mobs entry.giveReputationToSenior(repGain, true); } @@ -1401,7 +1402,7 @@ public class MapleMonster extends AbstractLoadedMapleLife { int i = (skillid == Crusader.ARMOR_CRASH ? 1 : (skillid == WhiteKnight.MAGIC_CRASH ? 2 : 0)); debuffMobStat(statups[i]); - if(ServerConstants.USE_ANTI_IMMUNITY_CRASH) { + if(YamlConfig.config.server.USE_ANTI_IMMUNITY_CRASH) { if (skillid == Crusader.ARMOR_CRASH) { if(!isBuffed(MonsterStatus.WEAPON_REFLECT)) { debuffMobStat(MonsterStatus.WEAPON_IMMUNITY); @@ -2213,7 +2214,7 @@ public class MapleMonster extends AbstractLoadedMapleLife { }; // had to schedule this since mob wouldn't stick to puppet aggro who knows why - this.getMap().getChannelServer().registerOverallAction(this.getMap().getId(), r, ServerConstants.UPDATE_INTERVAL); + this.getMap().getChannelServer().registerOverallAction(this.getMap().getId(), r, YamlConfig.config.server.UPDATE_INTERVAL); } /** diff --git a/src/server/life/MapleMonsterInformationProvider.java b/src/server/life/MapleMonsterInformationProvider.java index f5c4394331..45d6f7fa6e 100644 --- a/src/server/life/MapleMonsterInformationProvider.java +++ b/src/server/life/MapleMonsterInformationProvider.java @@ -20,6 +20,7 @@ */ package server.life; +import config.YamlConfig; import constants.ItemConstants; import constants.ServerConstants; import java.io.File; @@ -138,7 +139,7 @@ public class MapleMonsterInformationProvider { // this reads the drop entries searching for multi-equip, properly processing them List list = retrieveDrop(monsterId); - if (hasNoMultiEquipDrops.contains(monsterId) || !ServerConstants.USE_MULTIPLE_SAME_EQUIP_DROP) { + if (hasNoMultiEquipDrops.contains(monsterId) || !YamlConfig.config.server.USE_MULTIPLE_SAME_EQUIP_DROP) { return list; } diff --git a/src/server/life/MaplePlayerNPC.java b/src/server/life/MaplePlayerNPC.java index f956a04864..9b31d70235 100644 --- a/src/server/life/MaplePlayerNPC.java +++ b/src/server/life/MaplePlayerNPC.java @@ -21,6 +21,7 @@ */ package server.life; +import config.YamlConfig; import server.life.positioner.MaplePlayerNPCPositioner; import server.life.positioner.MaplePlayerNPCPodium; import java.awt.Point; @@ -426,7 +427,7 @@ public class MaplePlayerNPC extends AbstractMapleMapObject { } } - if(ServerConstants.USE_DEBUG) System.out.println("GOT SID " + scriptId + " POS " + pos); + if(YamlConfig.config.server.USE_DEBUG) System.out.println("GOT SID " + scriptId + " POS " + pos); int worldId = chr.getWorld(); int jobId = (chr.getJob().getId() / 100) * 100; diff --git a/src/server/life/positioner/MaplePlayerNPCPodium.java b/src/server/life/positioner/MaplePlayerNPCPodium.java index c97e8f7807..ffe33daaf9 100644 --- a/src/server/life/positioner/MaplePlayerNPCPodium.java +++ b/src/server/life/positioner/MaplePlayerNPCPodium.java @@ -19,6 +19,7 @@ */ package server.life.positioner; +import config.YamlConfig; import constants.ServerConstants; import java.awt.Point; import java.util.ArrayList; @@ -85,7 +86,7 @@ public class MaplePlayerNPCPodium { private static Point reorganizePlayerNpcs(MapleMap map, int newStep, List mmoList) { if(!mmoList.isEmpty()) { - if(ServerConstants.USE_DEBUG) System.out.println("Reorganizing pnpc map, step " + newStep); + if(YamlConfig.config.server.USE_DEBUG) System.out.println("Reorganizing pnpc map, step " + newStep); List playerNpcs = new ArrayList<>(mmoList.size()); for(MapleMapObject mmo : mmoList) { @@ -135,7 +136,7 @@ public class MaplePlayerNPCPodium { int podiumStep = podiumData % (1 << 5), podiumCount = (podiumData / (1 << 5)); if(podiumCount >= 3 * podiumStep) { - if(podiumStep >= ServerConstants.PLAYERNPC_AREA_STEPS) return null; + if(podiumStep >= YamlConfig.config.server.PLAYERNPC_AREA_STEPS) return null; List mmoList = map.getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.PLAYER_NPC)); map.getWorldServer().setPlayerNpcMapPodiumData(map.getId(), encodePodiumData(podiumStep + 1, podiumCount + 1)); diff --git a/src/server/life/positioner/MaplePlayerNPCPositioner.java b/src/server/life/positioner/MaplePlayerNPCPositioner.java index 58e6054ab7..7fcd145489 100644 --- a/src/server/life/positioner/MaplePlayerNPCPositioner.java +++ b/src/server/life/positioner/MaplePlayerNPCPositioner.java @@ -19,6 +19,7 @@ */ package server.life.positioner; +import config.YamlConfig; import constants.ServerConstants; import java.awt.Point; import java.awt.Rectangle; @@ -59,18 +60,18 @@ public class MaplePlayerNPCPositioner { } private static int calcDx(int newStep) { - return ServerConstants.PLAYERNPC_AREA_X / (newStep + 1); + return YamlConfig.config.server.PLAYERNPC_AREA_X / (newStep + 1); } private static int calcDy(int newStep) { - return (ServerConstants.PLAYERNPC_AREA_Y / 2) + (ServerConstants.PLAYERNPC_AREA_Y / (1 << (newStep + 1))); + return (YamlConfig.config.server.PLAYERNPC_AREA_Y / 2) + (YamlConfig.config.server.PLAYERNPC_AREA_Y / (1 << (newStep + 1))); } private static List rearrangePlayerNpcPositions(MapleMap map, int newStep, int pnpcsSize) { Rectangle mapArea = map.getMapArea(); - int leftPx = mapArea.x + ServerConstants.PLAYERNPC_INITIAL_X, px, py = mapArea.y + ServerConstants.PLAYERNPC_INITIAL_Y; - int outx = mapArea.x + mapArea.width - ServerConstants.PLAYERNPC_INITIAL_X, outy = mapArea.y + mapArea.height; + int leftPx = mapArea.x + YamlConfig.config.server.PLAYERNPC_INITIAL_X, px, py = mapArea.y + YamlConfig.config.server.PLAYERNPC_INITIAL_Y; + int outx = mapArea.x + mapArea.width - YamlConfig.config.server.PLAYERNPC_INITIAL_X, outy = mapArea.y + mapArea.height; int cx = calcDx(newStep), cy = calcDy(newStep); List otherPlayerNpcs = new LinkedList<>(); @@ -101,8 +102,8 @@ public class MaplePlayerNPCPositioner { private static Point rearrangePlayerNpcs(MapleMap map, int newStep, List pnpcs) { Rectangle mapArea = map.getMapArea(); - int leftPx = mapArea.x + ServerConstants.PLAYERNPC_INITIAL_X, px, py = mapArea.y + ServerConstants.PLAYERNPC_INITIAL_Y; - int outx = mapArea.x + mapArea.width - ServerConstants.PLAYERNPC_INITIAL_X, outy = mapArea.y + mapArea.height; + int leftPx = mapArea.x + YamlConfig.config.server.PLAYERNPC_INITIAL_X, px, py = mapArea.y + YamlConfig.config.server.PLAYERNPC_INITIAL_Y; + int outx = mapArea.x + mapArea.width - YamlConfig.config.server.PLAYERNPC_INITIAL_X, outy = mapArea.y + mapArea.height; int cx = calcDx(newStep), cy = calcDy(newStep); List otherPlayerNpcs = new LinkedList<>(); @@ -138,7 +139,7 @@ public class MaplePlayerNPCPositioner { private static Point reorganizePlayerNpcs(MapleMap map, int newStep, List mmoList) { if(!mmoList.isEmpty()) { - if(ServerConstants.USE_DEBUG) System.out.println("Reorganizing pnpc map, step " + newStep); + if(YamlConfig.config.server.USE_DEBUG) System.out.println("Reorganizing pnpc map, step " + newStep); List playerNpcs = new ArrayList<>(mmoList.size()); for(MapleMapObject mmo : mmoList) { @@ -189,12 +190,12 @@ public class MaplePlayerNPCPositioner { int cx = calcDx(initStep), cy = calcDy(initStep); Rectangle mapArea = map.getMapArea(); - int outx = mapArea.x + mapArea.width - ServerConstants.PLAYERNPC_INITIAL_X, outy = mapArea.y + mapArea.height; + int outx = mapArea.x + mapArea.width - YamlConfig.config.server.PLAYERNPC_INITIAL_X, outy = mapArea.y + mapArea.height; boolean reorganize = false; int i = initStep; - while(i < ServerConstants.PLAYERNPC_AREA_STEPS) { - int leftPx = mapArea.x + ServerConstants.PLAYERNPC_INITIAL_X, px, py = mapArea.y + ServerConstants.PLAYERNPC_INITIAL_Y; + while(i < YamlConfig.config.server.PLAYERNPC_AREA_STEPS) { + int leftPx = mapArea.x + YamlConfig.config.server.PLAYERNPC_INITIAL_X, px, py = mapArea.y + YamlConfig.config.server.PLAYERNPC_INITIAL_Y; while(py < outy) { px = leftPx; @@ -207,7 +208,7 @@ public class MaplePlayerNPCPositioner { map.getWorldServer().setPlayerNpcMapStep(map.getId(), i); } - if(reorganize && ServerConstants.PLAYERNPC_ORGANIZE_AREA) { + if(reorganize && YamlConfig.config.server.PLAYERNPC_ORGANIZE_AREA) { return reorganizePlayerNpcs(map, i, mmoList); } @@ -226,13 +227,13 @@ public class MaplePlayerNPCPositioner { cx = calcDx(i); cy = calcDy(i); - if(ServerConstants.PLAYERNPC_ORGANIZE_AREA) { + if(YamlConfig.config.server.PLAYERNPC_ORGANIZE_AREA) { otherPlayerNpcs = rearrangePlayerNpcPositions(map, i, mmoList.size()); } } if(i > initStep) { - map.getWorldServer().setPlayerNpcMapStep(map.getId(), ServerConstants.PLAYERNPC_AREA_STEPS - 1); + map.getWorldServer().setPlayerNpcMapStep(map.getId(), YamlConfig.config.server.PLAYERNPC_AREA_STEPS - 1); } return null; } diff --git a/src/server/maps/MapleDoor.java b/src/server/maps/MapleDoor.java index 6f270cca9d..de2749548c 100644 --- a/src/server/maps/MapleDoor.java +++ b/src/server/maps/MapleDoor.java @@ -23,6 +23,8 @@ package server.maps; import java.awt.Point; import java.util.Collection; + +import config.YamlConfig; import tools.Pair; import client.MapleCharacter; @@ -50,7 +52,7 @@ public class MapleDoor { this.target = owner.getMap(); if(target.canDeployDoor(targetPosition)) { - if(ServerConstants.USE_ENFORCE_MDOOR_POSITION) { + if(YamlConfig.config.server.USE_ENFORCE_MDOOR_POSITION) { posStatus = target.getDoorPositionStatus(targetPosition); } diff --git a/src/server/maps/MapleHiredMerchant.java b/src/server/maps/MapleHiredMerchant.java index f4f40a6b2d..f3681be2d9 100644 --- a/src/server/maps/MapleHiredMerchant.java +++ b/src/server/maps/MapleHiredMerchant.java @@ -31,6 +31,7 @@ import client.inventory.manipulator.MapleInventoryManipulator; import client.inventory.manipulator.MapleKarmaManipulator; import client.processor.FredrickProcessor; import com.mysql.jdbc.Statement; +import config.YamlConfig; import constants.ServerConstants; import java.sql.Connection; import java.sql.PreparedStatement; @@ -232,7 +233,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject { chr.announce(MaplePacketCreator.updateHiredMerchant(this, chr)); } - if (ServerConstants.USE_ENFORCE_MERCHANT_SAVE) { + if (YamlConfig.config.server.USE_ENFORCE_MERCHANT_SAVE) { chr.saveCharToDB(false); } } @@ -287,7 +288,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject { pItem.setDoesExist(false); } - if(ServerConstants.USE_ANNOUNCE_SHOPITEMSOLD) { // idea thanks to Vcoc + if(YamlConfig.config.server.USE_ANNOUNCE_SHOPITEMSOLD) { // idea thanks to Vcoc announceItemSold(newItem, price, getQuantityLeft(pItem.getItem().getItemId())); } @@ -448,7 +449,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject { e.printStackTrace(); } - if (ServerConstants.USE_ENFORCE_MERCHANT_SAVE) { + if (YamlConfig.config.server.USE_ENFORCE_MERCHANT_SAVE) { c.getPlayer().saveCharToDB(false); } diff --git a/src/server/maps/MapleMap.java b/src/server/maps/MapleMap.java index f60d03c499..bcdcb3f25e 100644 --- a/src/server/maps/MapleMap.java +++ b/src/server/maps/MapleMap.java @@ -31,6 +31,7 @@ import client.inventory.MapleInventoryType; import client.inventory.MaplePet; import client.status.MonsterStatus; import client.status.MonsterStatusEffect; +import config.YamlConfig; import constants.GameConstants; import constants.ItemConstants; import constants.ServerConstants; @@ -251,7 +252,7 @@ public class MapleMap { private static double getRangedDistance() { - return(ServerConstants.USE_MAXRANGE ? Double.POSITIVE_INFINITY : 722500); + return(YamlConfig.config.server.USE_MAXRANGE ? Double.POSITIVE_INFINITY : 722500); } public List getMapObjectsInRect(Rectangle box, List types) { @@ -752,7 +753,7 @@ public class MapleMap { final List dropEntry = new ArrayList<>(); final List visibleQuestEntry = new ArrayList<>(); final List otherQuestEntry = new ArrayList<>(); - sortDropEntries(ServerConstants.USE_SPAWN_RELEVANT_LOOT ? mob.retrieveRelevantDrops() : mi.retrieveEffectiveDrop(mob.getId()), dropEntry, visibleQuestEntry, otherQuestEntry, chr); + sortDropEntries(YamlConfig.config.server.USE_SPAWN_RELEVANT_LOOT ? mob.retrieveRelevantDrops() : mi.retrieveEffectiveDrop(mob.getId()), dropEntry, visibleQuestEntry, otherQuestEntry, chr); registerMobItemDrops(droptype, mobpos, chRate, pos, dropEntry, visibleQuestEntry, otherQuestEntry, globalEntry, chr, mob); } @@ -786,7 +787,7 @@ public class MapleMap { expireItemsTask.cancel(false); expireItemsTask = null; - if(ServerConstants.USE_SPAWN_LOOT_ON_ANIMATION) { + if(YamlConfig.config.server.USE_SPAWN_LOOT_ON_ANIMATION) { mobSpawnLootTask.cancel(false); mobSpawnLootTask = null; } @@ -846,16 +847,16 @@ public class MapleMap { cleanItemMonitor(); } } - }, ServerConstants.ITEM_MONITOR_TIME, ServerConstants.ITEM_MONITOR_TIME); + }, YamlConfig.config.server.ITEM_MONITOR_TIME, YamlConfig.config.server.ITEM_MONITOR_TIME); expireItemsTask = TimerManager.getInstance().register(new Runnable() { @Override public void run() { makeDisappearExpiredItemDrops(); } - }, ServerConstants.ITEM_EXPIRE_CHECK, ServerConstants.ITEM_EXPIRE_CHECK); + }, YamlConfig.config.server.ITEM_EXPIRE_CHECK, YamlConfig.config.server.ITEM_EXPIRE_CHECK); - if(ServerConstants.USE_SPAWN_LOOT_ON_ANIMATION) { + if(YamlConfig.config.server.USE_SPAWN_LOOT_ON_ANIMATION) { lootLock.lock(); try { mobLootEntries.clear(); @@ -898,7 +899,7 @@ public class MapleMap { } private void instantiateItemDrop(MapleMapItem mdrop) { - if(droppedItemCount.get() >= ServerConstants.ITEM_LIMIT_ON_MAP) { + if(droppedItemCount.get() >= YamlConfig.config.server.ITEM_LIMIT_ON_MAP) { MapleMapObject mapobj; do { @@ -930,7 +931,7 @@ public class MapleMap { } private void registerItemDrop(MapleMapItem mdrop) { - droppedItems.put(mdrop, !everlast ? Server.getInstance().getCurrentTime() + ServerConstants.ITEM_EXPIRE_TIME : Long.MAX_VALUE); + droppedItems.put(mdrop, !everlast ? Server.getInstance().getCurrentTime() + YamlConfig.config.server.ITEM_EXPIRE_TIME : Long.MAX_VALUE); } private void unregisterItemDrop(MapleMapItem mdrop) { @@ -975,7 +976,7 @@ public class MapleMap { private void registerMobItemDrops(byte droptype, int mobpos, int chRate, Point pos, List dropEntry, List visibleQuestEntry, List otherQuestEntry, List globalEntry, MapleCharacter chr, MapleMonster mob) { MobLootEntry mle = new MobLootEntry(droptype, mobpos, chRate, pos, dropEntry, visibleQuestEntry, otherQuestEntry, globalEntry, chr, mob); - if(ServerConstants.USE_SPAWN_LOOT_ON_ANIMATION) { + if(YamlConfig.config.server.USE_SPAWN_LOOT_ON_ANIMATION) { int animationTime = mob.getAnimationTime("die1"); lootLock.lock(); @@ -2218,7 +2219,7 @@ public class MapleMap { } }; - getWorldServer().registerTimedMapObject(expireKite, ServerConstants.KITE_EXPIRE_TIME); + getWorldServer().registerTimedMapObject(expireKite, YamlConfig.config.server.KITE_EXPIRE_TIME); } public final void spawnItemDrop(final MapleMapObject dropper, final MapleCharacter owner, final Item item, Point pos, final boolean ffaDrop, final boolean playerDrop) { @@ -3680,7 +3681,7 @@ public class MapleMap { System.out.println("----------------------------------"); */ - if(ServerConstants.USE_ENABLE_FULL_RESPAWN) { + if(YamlConfig.config.server.USE_ENABLE_FULL_RESPAWN) { return (monsterSpawn.size() - spawnedMonstersOnMap.get()); } diff --git a/src/server/maps/MapleReactor.java b/src/server/maps/MapleReactor.java index 68ef3c9e05..81cc1327f4 100644 --- a/src/server/maps/MapleReactor.java +++ b/src/server/maps/MapleReactor.java @@ -23,6 +23,7 @@ package server.maps; import client.MapleClient; import client.status.MonsterStatus; +import config.YamlConfig; import constants.ServerConstants; import java.awt.Rectangle; @@ -256,7 +257,7 @@ public class MapleReactor extends AbstractMapleMapObject { cancelReactorTimeout(); attackHit = wHit; - if (ServerConstants.USE_DEBUG == true) { + if (YamlConfig.config.server.USE_DEBUG == true) { c.getPlayer().dropMessage(5, "Hitted REACTOR " + this.getId() + " with POS " + charPos + " , STANCE " + stance + " , SkillID " + skillid + " , STATE " + stats.getType(state) + " STATESIZE " + stats.getStateSize(state)); } ReactorScriptManager.getInstance().onHit(c, this); diff --git a/src/server/partyquest/MonsterCarnival.java b/src/server/partyquest/MonsterCarnival.java index a96d0fc6e9..69443fda2f 100644 --- a/src/server/partyquest/MonsterCarnival.java +++ b/src/server/partyquest/MonsterCarnival.java @@ -2,6 +2,7 @@ package server.partyquest; import java.util.concurrent.ScheduledFuture; import client.MapleCharacter; +import config.YamlConfig; import constants.LanguageConstants; import constants.ServerConstants; import net.server.Server; @@ -112,7 +113,7 @@ public class MonsterCarnival { public void run() { respawn(); } - }, ServerConstants.RESPAWN_INTERVAL); + }, YamlConfig.config.server.RESPAWN_INTERVAL); cs.initMonsterCarnival(cpq1, room); } catch (Exception e) { diff --git a/src/server/quest/MapleQuest.java b/src/server/quest/MapleQuest.java index 88d081dab1..8f560169f5 100644 --- a/src/server/quest/MapleQuest.java +++ b/src/server/quest/MapleQuest.java @@ -31,6 +31,7 @@ import client.MapleCharacter; import client.MapleCharacter.DelayedQuestUpdate; import client.MapleQuestStatus; import client.MapleQuestStatus.Status; +import config.YamlConfig; import constants.ServerConstants; import java.util.EnumMap; import java.util.Set; @@ -228,7 +229,7 @@ public class MapleQuest { if(!repeatable) return false; IntervalRequirement ir = (IntervalRequirement) startReqs.get(MapleQuestRequirementType.INTERVAL); - return ir.getInterval() < ServerConstants.QUEST_POINT_REPEATABLE_INTERVAL * 60 * 60 * 1000; + return ir.getInterval() < YamlConfig.config.server.QUEST_POINT_REPEATABLE_INTERVAL * 60 * 60 * 1000; } public boolean canStartWithoutRequirements(MapleCharacter c) { @@ -331,8 +332,8 @@ public class MapleQuest { c.updateQuest(newStatus); - if(id / 100 == 35 && ServerConstants.TOT_MOB_QUEST_REQUIREMENT > 0) { - int setProg = 999 - Math.min(999, ServerConstants.TOT_MOB_QUEST_REQUIREMENT); + if(id / 100 == 35 && YamlConfig.config.server.TOT_MOB_QUEST_REQUIREMENT > 0) { + int setProg = 999 - Math.min(999, YamlConfig.config.server.TOT_MOB_QUEST_REQUIREMENT); for(Integer pid : newStatus.getProgress().keySet()) { if(pid >= 8200000 && pid <= 8200012) { diff --git a/src/server/quest/actions/ExpAction.java b/src/server/quest/actions/ExpAction.java index 2ad65b3928..4022e7982b 100644 --- a/src/server/quest/actions/ExpAction.java +++ b/src/server/quest/actions/ExpAction.java @@ -22,6 +22,7 @@ package server.quest.actions; import client.MapleCharacter; +import config.YamlConfig; import constants.ServerConstants; import provider.MapleData; import provider.MapleDataTool; @@ -52,7 +53,7 @@ public class ExpAction extends MapleQuestAction { } public static void runAction(MapleCharacter chr, int gain) { - if (!ServerConstants.USE_QUEST_RATE) { + if (!YamlConfig.config.server.USE_QUEST_RATE) { chr.gainExp(gain * chr.getExpRate(), true, true); } else { chr.gainExp(gain * chr.getQuestExpRate(), true, true); diff --git a/src/server/quest/actions/MesoAction.java b/src/server/quest/actions/MesoAction.java index 8f84d6d299..139888d38f 100644 --- a/src/server/quest/actions/MesoAction.java +++ b/src/server/quest/actions/MesoAction.java @@ -22,6 +22,7 @@ package server.quest.actions; import client.MapleCharacter; +import config.YamlConfig; import constants.ServerConstants; import provider.MapleData; import provider.MapleDataTool; @@ -56,7 +57,7 @@ public class MesoAction extends MapleQuestAction { if (gain < 0) { chr.gainMeso(gain, true, false, true); } else { - if (!ServerConstants.USE_QUEST_RATE) { + if (!YamlConfig.config.server.USE_QUEST_RATE) { chr.gainMeso(gain * chr.getMesoRate(), true, false, true); } else { chr.gainMeso(gain * chr.getQuestMesoRate(), true, false, true); diff --git a/src/tools/DatabaseConnection.java b/src/tools/DatabaseConnection.java index 802c2ef47f..70da1f6673 100644 --- a/src/tools/DatabaseConnection.java +++ b/src/tools/DatabaseConnection.java @@ -8,7 +8,7 @@ import java.sql.SQLException; import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariDataSource; -import constants.ServerConstants; +import config.YamlConfig; /** * @author Frz - Big Daddy @@ -30,7 +30,7 @@ public class DatabaseConnection { int denies = 0; while(true) { // There is no way it can pass with a null out of here? try { - return DriverManager.getConnection(ServerConstants.DB_URL, ServerConstants.DB_USER, ServerConstants.DB_PASS); + return DriverManager.getConnection(YamlConfig.config.server.DB_URL, YamlConfig.config.server.DB_USER, YamlConfig.config.server.DB_PASS); } catch (SQLException sqle) { denies++; @@ -45,7 +45,7 @@ public class DatabaseConnection { private static int getNumberOfAccounts() { try { - Connection con = DriverManager.getConnection(ServerConstants.DB_URL, ServerConstants.DB_USER, ServerConstants.DB_PASS); + Connection con = DriverManager.getConnection(YamlConfig.config.server.DB_URL, YamlConfig.config.server.DB_USER, YamlConfig.config.server.DB_PASS); try (PreparedStatement ps = con.prepareStatement("SELECT count(*) FROM accounts")) { try (ResultSet rs = ps.executeQuery()) { rs.next(); @@ -69,14 +69,14 @@ public class DatabaseConnection { ds = null; - if(ServerConstants.DB_CONNECTION_POOL) { + if(YamlConfig.config.server.DB_CONNECTION_POOL) { // Connection Pool on database ftw! HikariConfig config = new HikariConfig(); - config.setJdbcUrl(ServerConstants.DB_URL); + config.setJdbcUrl(YamlConfig.config.server.DB_URL); - config.setUsername(ServerConstants.DB_USER); - config.setPassword(ServerConstants.DB_PASS); + config.setUsername(YamlConfig.config.server.DB_USER); + config.setPassword(YamlConfig.config.server.DB_PASS); // Make sure pool size is comfortable for the worst case scenario. // Under 100 accounts? Make it 10. Over 10000 accounts? Make it 30. diff --git a/src/tools/MaplePacketCreator.java b/src/tools/MaplePacketCreator.java index 7258b2720c..8f9ff19d30 100644 --- a/src/tools/MaplePacketCreator.java +++ b/src/tools/MaplePacketCreator.java @@ -62,6 +62,7 @@ import client.inventory.ModifyInventory; import client.newyear.NewYearCardRecord; import client.status.MonsterStatus; import client.status.MonsterStatusEffect; +import config.YamlConfig; import constants.ExpTable; import constants.GameConstants; import constants.ItemConstants; @@ -712,8 +713,8 @@ public class MaplePacketCreator { mplew.write(c.getGender()); boolean canFly = Server.getInstance().canFly(c.getAccID()); - mplew.writeBool((ServerConstants.USE_ENFORCE_ADMIN_ACCOUNT || canFly) ? c.getGMLevel() > 1 : false); // thanks Steve(kaito1410) for pointing the GM account boolean here - mplew.write(((ServerConstants.USE_ENFORCE_ADMIN_ACCOUNT || canFly) && c.getGMLevel() > 1) ? 0x80 : 0); // Admin Byte. 0x80,0x40,0x20.. Rubbish. + mplew.writeBool((YamlConfig.config.server.USE_ENFORCE_ADMIN_ACCOUNT || canFly) ? c.getGMLevel() > 1 : false); // thanks Steve(kaito1410) for pointing the GM account boolean here + mplew.write(((YamlConfig.config.server.USE_ENFORCE_ADMIN_ACCOUNT || canFly) && c.getGMLevel() > 1) ? 0x80 : 0); // Admin Byte. 0x80,0x40,0x20.. Rubbish. mplew.write(0); // Country Code. mplew.writeMapleAsciiString(c.getAccountName()); @@ -725,8 +726,8 @@ public class MaplePacketCreator { mplew.writeInt(1); // 1: Remove the "Select the world you want to play in" - mplew.write(ServerConstants.ENABLE_PIN && !c.canBypassPin() ? 0 : 1); // 0 = Pin-System Enabled, 1 = Disabled - mplew.write(ServerConstants.ENABLE_PIC && !c.canBypassPic() ? (c.getPic() == null || c.getPic().equals("") ? 0 : 1) : 2); // 0 = Register PIC, 1 = Ask for PIC, 2 = Disabled + mplew.write(YamlConfig.config.server.ENABLE_PIN && !c.canBypassPin() ? 0 : 1); // 0 = Pin-System Enabled, 1 = Disabled + mplew.write(YamlConfig.config.server.ENABLE_PIC && !c.canBypassPic() ? (c.getPic() == null || c.getPic().equals("") ? 0 : 1) : 2); // 0 = Register PIC, 1 = Ask for PIC, 2 = Disabled return mplew.getPacket(); } @@ -912,8 +913,8 @@ public class MaplePacketCreator { addCharEntry(mplew, chr, false); } - mplew.write(ServerConstants.ENABLE_PIC && !c.canBypassPic() ? (c.getPic() == null || c.getPic().equals("") ? 0 : 1) : 2); - mplew.writeInt(ServerConstants.COLLECTIVE_CHARSLOT ? chars.size() + c.getAvailableCharacterSlots() : c.getCharacterSlots()); + mplew.write(YamlConfig.config.server.ENABLE_PIC && !c.canBypassPic() ? (c.getPic() == null || c.getPic().equals("") ? 0 : 1) : 2); + mplew.writeInt(YamlConfig.config.server.COLLECTIVE_CHARSLOT ? chars.size() + c.getAvailableCharacterSlots() : c.getCharacterSlots()); return mplew.getPacket(); } diff --git a/src/tools/packets/Fishing.java b/src/tools/packets/Fishing.java index e4569ad261..c658548b60 100644 --- a/src/tools/packets/Fishing.java +++ b/src/tools/packets/Fishing.java @@ -20,6 +20,7 @@ package tools.packets; import client.MapleCharacter; +import config.YamlConfig; import constants.GameConstants; import constants.ItemConstants; import constants.ServerConstants; @@ -56,7 +57,7 @@ public class Fishing { private static boolean hitFishingTime(MapleCharacter chr, int baitLevel, double yearLikelihood, double timeLikelihood) { double baitLikelihood = 0.0002 * chr.getWorldServer().getFishingRate() * baitLevel; // can improve 10.0 at "max level 50000" on rate 1x - if (ServerConstants.USE_DEBUG) { + if (YamlConfig.config.server.USE_DEBUG) { chr.dropMessage(5, "----- FISHING RESULT -----"); chr.dropMessage(5, "Likelihoods - Year: " + yearLikelihood + " Time: " + timeLikelihood + " Meso: " + baitLikelihood); chr.dropMessage(5, "Score rolls - Year: " + (0.23 * yearLikelihood) + " Time: " + (0.77 * timeLikelihood) + " Meso: " + baitLikelihood); diff --git a/world.ini b/world.ini deleted file mode 100644 index 0dda7a5575..0000000000 --- a/world.ini +++ /dev/null @@ -1,153 +0,0 @@ -#Author: Ronan, Vcoc -#World Name: (0 "Scania", 1 "Bera", 2 "Broa", 3 "Windia", 4 "Khaini", 5 "Bellocan", 6 "Mardia", 7 "Kradia", 8 "Yellonde", 9 "Demethos", 10 "Galicia", 11 "El Nido", 12 "Zenith", 13 "Arcenia", 14 "Kastia", 15 "Judis", 16 "Plana", 17 "Kalluna", 18 "Stius", 19 "Croa", 20 "Medere") -#Flag types: (0 = nothing, 1 = event, 2 = new, 3 = hot) -#Recommended to use only up to 15 worlds -gmserver=false -worlds=1 - -#Properties for Scania 0 -flag0=0 -servermessage0=Welcome to Scania! -eventmessage0=Scania! -whyamirecommended0=Welcome to Scania! -channels0=3 - -#Properties for Bera 1 -flag1=0 -servermessage1=Welcome to Bera! -eventmessage1=Bera! -whyamirecommended1=Welcome to Bera! -channels1=3 - -#Properties for Broa 2 -flag2=0 -servermessage2=Welcome to Broa! -eventmessage2=Broa! -whyamirecommended2=Welcome to Broa! -channels2=3 - -#Properties for Windia 3 -flag3=0 -servermessage3=Welcome to Windia! -eventmessage3=Windia! -whyamirecommended3=Welcome to Windia! -channels3=3 - -#Properties for Khaini 4 -flag4=0 -servermessage4=Welcome to Khaini! -eventmessage4=Khaini! -whyamirecommended4=Welcome to Khaini! -channels4=3 - -#Properties for Bellocan 5 -flag5=0 -servermessage5=Welcome to Bellocan! -eventmessage5=Bellocan! -whyamirecommended5=Welcome to Bellocan! -channels5=3 - -#Properties for Mardia 6 -flag6=0 -servermessage6=Welcome to Mardia! -eventmessage6=Mardia! -whyamirecommended6=Welcome to Mardia! -channels6=3 - -#Properties for Kradia 7 -flag7=0 -servermessage7=Welcome to Kradia! -eventmessage7=Kradia! -whyamirecommended7=Welcome to Kradia! -channels7=3 - -#Properties for Yellonde 8 -flag8=0 -servermessage8=Welcome to Yellonde! -eventmessage8=Yellonde! -whyamirecommended8=Welcome to Yellonde! -channels8=3 - -#Properties for Demethos 9 -flag9=0 -servermessage9=Welcome to Demethos! -eventmessage9=Demethos! -whyamirecommended9=Welcome to Demethos! -channels9=3 - -#Properties for Galicia 10 -flag10=0 -servermessage10=Welcome to Galicia! -eventmessage10=Galicia! -whyamirecommended10=Welcome to Galicia! -channels10=3 - -#Properties for El Nido 11 -flag11=0 -servermessage11=Welcome to El Nido! -eventmessage11=El Nido! -whyamirecommended11=Welcome to El Nido! -channels11=3 - -#Properties for Zenith 12 -flag12=0 -servermessage12=Welcome to Zenith! -eventmessage12=Zenith! -whyamirecommended12=Welcome to Zenith! -channels12=3 - -#Properties for Arcenia 13 -flag13=0 -servermessage13=Welcome to Arcenia! -eventmessage13=Arcenia! -whyamirecommended13=Welcome to Arcenia! -channels13=3 - -#Properties for Kastia 14 -flag14=0 -servermessage14=Welcome to Kastia! -eventmessage14=Kastia! -whyamirecommended14=Welcome to Kastia! -channels14=3 - -#Properties for Judis 15 -flag15=0 -servermessage15=Welcome to Judis! -eventmessage15=Judis! -whyamirecommended15=Welcome to Judis! -channels15=3 - -#Properties for Plana 16 -flag16=0 -servermessage16=Welcome to Plana! -eventmessage16=Plana! -whyamirecommended16=Welcome to Plana! -channels16=3 - -#Properties for Kalluna 17 -flag17=0 -servermessage17=Welcome to Kalluna! -eventmessage17=Kalluna! -whyamirecommended17=Welcome to Kalluna! -channels17=3 - -#Properties for Stius 18 -flag18=0 -servermessage18=Welcome to Stius! -eventmessage18=Stius! -whyamirecommended18=Welcome to Stius! -channels18=3 - -#Properties for Croa 19 -flag19=0 -servermessage19=Welcome to Croa! -eventmessage19=Croa! -whyamirecommended19=Welcome to Croa! -channels19=3 - -#Properties for Medere 20 -flag20=0 -servermessage20=Welcome to Medere! -eventmessage20=Medere! -whyamirecommended20=Welcome to Medere! -channels20=3