summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <notind@gmail.com>2013-06-08 12:46:37 -0700
committershennetsind <notind@gmail.com>2013-06-08 12:46:37 -0700
commit9fdea24a67a39e86c2ae4dd032f08021b35942dc (patch)
treefeea3cd428cee18be3da9bf0bee6d4570d9cad02
parentb0f866ca419d87fcb3625b45e2437e0a0bb1810e (diff)
parentd73783f22b2bb881aab74524d153d89a5932a199 (diff)
downloadhercules-9fdea24a67a39e86c2ae4dd032f08021b35942dc.tar.gz
hercules-9fdea24a67a39e86c2ae4dd032f08021b35942dc.tar.bz2
hercules-9fdea24a67a39e86c2ae4dd032f08021b35942dc.tar.xz
hercules-9fdea24a67a39e86c2ae4dd032f08021b35942dc.zip
Merge pull request #4 from Earisu/master
Attempt to Merge Earisu's Hercules
-rw-r--r--.travis.yml7
-rw-r--r--conf/battle/client.conf3
-rw-r--r--conf/battlegrounds.conf101
-rw-r--r--conf/channels.conf42
-rw-r--r--conf/help.txt1
-rw-r--r--conf/map-server.conf5
-rw-r--r--conf/messages.conf16
-rw-r--r--conf/motd.txt2
-rw-r--r--conf/packet.conf10
-rw-r--r--db/item_db2.txt4
-rw-r--r--db/pre-re/item_db.txt2
-rw-r--r--db/pre-re/map_zone_db.conf4
-rw-r--r--db/quest_db.txt14
-rw-r--r--db/re/item_db.txt2
-rw-r--r--db/re/map_zone_db.conf4
-rw-r--r--doc/atcommands.txt2
-rw-r--r--doc/ea_job_system.txt2
-rw-r--r--doc/effect_list.txt2
-rw-r--r--doc/item_bonus.txt2
-rw-r--r--doc/item_db.txt21
-rw-r--r--doc/map_cache.txt2
-rw-r--r--doc/md5_hashcheck.txt2
-rw-r--r--doc/mob_db_mode_list.txt2
-rw-r--r--doc/packet_struct_notation.txt2
-rw-r--r--doc/permissions.txt6
-rw-r--r--doc/quest_variables.txt2
-rw-r--r--doc/script_commands.txt5161
-rw-r--r--doc/whisper_sys.txt2
-rw-r--r--doc/woe_time_explanation.txt2
-rw-r--r--npc/MOTD.txt15
-rw-r--r--npc/airports/airships.txt14
-rw-r--r--npc/airports/hugel.txt10
-rw-r--r--npc/airports/izlude.txt10
-rw-r--r--npc/airports/rachel.txt10
-rw-r--r--npc/custom/breeder.txt9
-rw-r--r--npc/custom/etc/floating_rates.txt4
-rw-r--r--npc/custom/etc/lottery.txt4
-rw-r--r--npc/custom/etc/marriage.txt4
-rw-r--r--npc/custom/etc/monster_arena.txt4
-rw-r--r--npc/custom/etc/morroc_raceway.txt4
-rw-r--r--npc/custom/etc/mvp_arena.txt4
-rw-r--r--npc/custom/etc/penal_servitude.txt4
-rw-r--r--npc/custom/etc/quest_warper.txt16
-rw-r--r--npc/custom/etc/rpsroulette.txt4
-rw-r--r--npc/custom/etc/shifty_assassin.txt4
-rw-r--r--npc/custom/etc/stock_market.txt4
-rw-r--r--npc/custom/events/disguise.txt4
-rw-r--r--npc/custom/events/hallow06.txt4
-rw-r--r--npc/custom/events/mushroom_event.txt12
-rw-r--r--npc/custom/events/uneasy_cemetery.txt4
-rw-r--r--npc/custom/events/valentinesdayexp.txt4
-rw-r--r--npc/custom/events/xmas_rings_event.txt4
-rw-r--r--npc/custom/healer.txt4
-rw-r--r--npc/custom/item_signer.txt4
-rw-r--r--npc/custom/itemmall.txt6
-rw-r--r--npc/custom/jobmaster.txt4
-rw-r--r--npc/custom/platinum_skills.txt4
-rw-r--r--npc/custom/quests/dead_branch.txt12
-rw-r--r--npc/custom/quests/elvenear.txt4
-rw-r--r--npc/custom/quests/event_6_new_hats.txt4
-rw-r--r--npc/custom/quests/hunting_missions.txt4
-rw-r--r--npc/custom/quests/jewel_case.txt6
-rw-r--r--npc/custom/quests/kaho_balmung.txt4
-rw-r--r--npc/custom/quests/kahohorn.txt4
-rw-r--r--npc/custom/quests/kings_items.txt4
-rw-r--r--npc/custom/quests/may_hats.txt4
-rw-r--r--npc/custom/quests/quest_shop.txt4
-rw-r--r--npc/custom/quests/questboard.txt4
-rw-r--r--npc/custom/quests/sphinx_mask.txt4
-rw-r--r--npc/custom/quests/sunglasses.txt4
-rw-r--r--npc/custom/quests/tha_statues.txt4
-rw-r--r--npc/custom/quests/thq/THQS_ChatingNPC.txt4
-rw-r--r--npc/custom/quests/thq/THQS_GuildNPC.txt4
-rw-r--r--npc/custom/quests/thq/THQS_QuestNPC.txt4
-rw-r--r--npc/custom/quests/thq/THQS_Quests.txt4
-rw-r--r--npc/custom/quests/thq/THQS_TTShop.txt4
-rw-r--r--npc/custom/quests/umbalian_language.txt14
-rw-r--r--npc/custom/quests/valhallen.txt16
-rw-r--r--npc/custom/resetnpc.txt2
-rw-r--r--npc/custom/stylist.txt4
-rw-r--r--npc/custom/warper.txt4
-rw-r--r--npc/custom/woe_controller.txt4
-rw-r--r--npc/guild/payg_cas02.txt33
-rw-r--r--npc/guild/payg_cas04.txt33
-rw-r--r--npc/instances/EndlessTower.txt444
-rw-r--r--npc/instances/NydhoggsNest.txt83
-rw-r--r--npc/instances/OrcsMemory.txt88
-rw-r--r--npc/instances/SealedShrine.txt76
-rw-r--r--npc/mapflag/battleground.txt (renamed from conf/mapflag/battleground.txt)2
-rw-r--r--npc/mapflag/gvg.txt (renamed from conf/mapflag/gvg.txt)2
-rw-r--r--npc/mapflag/jail.txt (renamed from conf/mapflag/jail.txt)2
-rw-r--r--npc/mapflag/night.txt (renamed from conf/mapflag/night.txt)2
-rw-r--r--npc/mapflag/nightmare.txt (renamed from conf/mapflag/nightmare.txt)2
-rw-r--r--npc/mapflag/nobranch.txt (renamed from conf/mapflag/nobranch.txt)2
-rw-r--r--npc/mapflag/noexp.txt (renamed from conf/mapflag/noexp.txt)2
-rw-r--r--npc/mapflag/noicewall.txt (renamed from conf/mapflag/noicewall.txt)2
-rw-r--r--npc/mapflag/noloot.txt (renamed from conf/mapflag/noloot.txt)2
-rw-r--r--npc/mapflag/nomemo.txt (renamed from conf/mapflag/nomemo.txt)2
-rw-r--r--npc/mapflag/nopenalty.txt (renamed from conf/mapflag/nopenalty.txt)2
-rw-r--r--npc/mapflag/nopvp.txt (renamed from conf/mapflag/nopvp.txt)2
-rw-r--r--npc/mapflag/noreturn.txt (renamed from conf/mapflag/noreturn.txt)2
-rw-r--r--npc/mapflag/nosave.txt (renamed from conf/mapflag/nosave.txt)2
-rw-r--r--npc/mapflag/noskill.txt (renamed from conf/mapflag/noskill.txt)2
-rw-r--r--npc/mapflag/noteleport.txt (renamed from conf/mapflag/noteleport.txt)2
-rw-r--r--npc/mapflag/novending.txt (renamed from conf/mapflag/novending.txt)2
-rw-r--r--npc/mapflag/nowarp.txt (renamed from conf/mapflag/nowarp.txt)2
-rw-r--r--npc/mapflag/nowarpto.txt (renamed from conf/mapflag/nowarpto.txt)2
-rw-r--r--npc/mapflag/partylock.txt (renamed from conf/mapflag/partylock.txt)2
-rw-r--r--npc/mapflag/pvp.txt (renamed from conf/mapflag/pvp.txt)2
-rw-r--r--npc/mapflag/pvp_noguild.txt (renamed from conf/mapflag/pvp_noguild.txt)2
-rw-r--r--npc/mapflag/pvp_noparty.txt (renamed from conf/mapflag/pvp_noparty.txt)2
-rw-r--r--npc/mapflag/reset.txt (renamed from conf/mapflag/reset.txt)2
-rw-r--r--npc/mapflag/skillduration.txt (renamed from conf/mapflag/skillduration.txt)0
-rw-r--r--npc/mapflag/skillmodifier.txt (renamed from conf/mapflag/skillmodifier.txt)0
-rw-r--r--npc/mapflag/town.txt (renamed from conf/mapflag/town.txt)2
-rw-r--r--npc/mapflag/zone.txt (renamed from conf/mapflag/zone.txt)0
-rw-r--r--npc/merchants/hd_refine.txt318
-rw-r--r--npc/other/poring_war.txt23
-rw-r--r--npc/pre-re/scripts.conf (renamed from npc/pre-re/scripts_athena.conf)0
-rw-r--r--npc/pre-re/scripts_main.conf4
-rw-r--r--npc/quests/cooking_quest.txt16
-rw-r--r--npc/quests/doomed_swords.txt4
-rw-r--r--npc/quests/doomed_swords_quest.txt4
-rw-r--r--npc/quests/first_class/tu_acolyte.txt6
-rw-r--r--npc/quests/first_class/tu_merchant.txt6
-rw-r--r--npc/quests/gunslinger_quests.txt4
-rw-r--r--npc/quests/juice_maker.txt4
-rw-r--r--npc/quests/kiel_hyre_quest.txt143
-rw-r--r--npc/quests/lvl4_weapon_quest.txt16
-rw-r--r--npc/quests/quests_13_1.txt6
-rw-r--r--npc/quests/quests_13_2.txt10
-rw-r--r--npc/quests/seals/god_global.txt4
-rw-r--r--npc/quests/seals/god_weapon_creation.txt14
-rw-r--r--npc/quests/skills/archer_skills.txt2
-rw-r--r--npc/quests/skills/knight_skills.txt4
-rw-r--r--npc/quests/skills/novice_skills.txt4
-rw-r--r--npc/quests/skills/wizard_skills.txt14
-rw-r--r--npc/re/airports/izlude.txt2
-rw-r--r--npc/re/cities/dewata.txt4
-rw-r--r--npc/re/cities/dicastes.txt14
-rw-r--r--npc/re/cities/izlude.txt72
-rw-r--r--npc/re/cities/malangdo.txt4
-rw-r--r--npc/re/cities/malaya.txt1520
-rw-r--r--npc/re/cities/mora.txt4
-rw-r--r--npc/re/guides/guides_alberta.txt16
-rw-r--r--npc/re/guides/guides_aldebaran.txt16
-rw-r--r--npc/re/guides/guides_amatsu.txt16
-rw-r--r--npc/re/guides/guides_ayothaya.txt16
-rw-r--r--npc/re/guides/guides_brasilis.txt16
-rw-r--r--npc/re/guides/guides_comodo.txt16
-rw-r--r--npc/re/guides/guides_dewata.txt4
-rw-r--r--npc/re/guides/guides_dicastes.txt4
-rw-r--r--npc/re/guides/guides_einbroch.txt4
-rw-r--r--npc/re/guides/guides_geffen.txt4
-rw-r--r--npc/re/guides/guides_gonryun.txt4
-rw-r--r--npc/re/guides/guides_hugel.txt4
-rw-r--r--npc/re/guides/guides_izlude.txt4
-rw-r--r--npc/re/guides/guides_juno.txt4
-rw-r--r--npc/re/guides/guides_lighthalzen.txt4
-rw-r--r--npc/re/guides/guides_louyang.txt4
-rw-r--r--npc/re/guides/guides_lutie.txt4
-rw-r--r--npc/re/guides/guides_mora.txt215
-rw-r--r--npc/re/guides/guides_morroc.txt4
-rw-r--r--npc/re/guides/guides_moscovia.txt4
-rw-r--r--npc/re/guides/guides_niflheim.txt4
-rw-r--r--npc/re/guides/guides_payon.txt4
-rw-r--r--npc/re/guides/guides_prontera.txt4
-rw-r--r--npc/re/guides/guides_rachel.txt4
-rw-r--r--npc/re/guides/guides_umbala.txt4
-rw-r--r--npc/re/guides/guides_veins.txt4
-rw-r--r--npc/re/instances/HazyForest.txt1193
-rw-r--r--npc/re/jobs/1-1/mage.txt4
-rw-r--r--npc/re/jobs/1-1/merchant.txt4
-rw-r--r--npc/re/jobs/1-1/swordman.txt4
-rw-r--r--npc/re/jobs/1-1/thief.txt4
-rw-r--r--npc/re/jobs/3-1/guillotine_cross.txt4
-rw-r--r--npc/re/jobs/3-1/mechanic.txt4
-rw-r--r--npc/re/jobs/3-1/ranger.txt4
-rw-r--r--npc/re/jobs/3-1/warlock.txt4
-rw-r--r--npc/re/jobs/3-2/genetic.txt14
-rw-r--r--npc/re/jobs/3-2/minstrel.txt4
-rw-r--r--npc/re/jobs/3-2/royal_guard.txt4
-rw-r--r--npc/re/jobs/3-2/shadow_chaser.txt4
-rw-r--r--npc/re/jobs/3-2/sorcerer.txt4
-rw-r--r--npc/re/jobs/3-2/sura.txt4
-rw-r--r--npc/re/jobs/3-2/wanderer.txt4
-rw-r--r--npc/re/jobs/novice/supernovice_ex.txt4
-rw-r--r--npc/re/kafras/kafras.txt4
-rw-r--r--npc/re/merchants/card_separation.txt4
-rw-r--r--npc/re/merchants/coin_exchange.txt4
-rw-r--r--npc/re/merchants/diamond.txt4
-rw-r--r--npc/re/merchants/enchan_mal.txt16
-rw-r--r--npc/re/merchants/enchan_mora.txt2356
-rw-r--r--npc/re/merchants/flute.txt16
-rw-r--r--npc/re/merchants/inn.txt4
-rw-r--r--npc/re/merchants/quivers.txt121
-rw-r--r--npc/re/merchants/refine.txt2
-rw-r--r--npc/re/merchants/renters.txt6
-rw-r--r--npc/re/merchants/shops.txt2
-rw-r--r--npc/re/mobs/dungeons/dew_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/dic_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/ein_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/gef_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/gefenia.txt2
-rw-r--r--npc/re/mobs/dungeons/glastheim.txt4
-rw-r--r--npc/re/mobs/dungeons/gld_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/gld_dunSE.txt4
-rw-r--r--npc/re/mobs/dungeons/gon_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/ice_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/in_sphinx.txt4
-rw-r--r--npc/re/mobs/dungeons/iz_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/juperos.txt2
-rw-r--r--npc/re/mobs/dungeons/kh_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/lhz_dun.txt2
-rw-r--r--npc/re/mobs/dungeons/lou_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/ma_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/mag_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/mal_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/mjo_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/moc_pryd.txt4
-rw-r--r--npc/re/mobs/dungeons/mosk_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/nyd_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/odin.txt4
-rw-r--r--npc/re/mobs/dungeons/orcsdun.txt4
-rw-r--r--npc/re/mobs/dungeons/pay_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/prt_maze.txt4
-rw-r--r--npc/re/mobs/dungeons/prt_sew.txt4
-rw-r--r--npc/re/mobs/dungeons/ra_san.txt4
-rw-r--r--npc/re/mobs/dungeons/tha_t.txt4
-rw-r--r--npc/re/mobs/dungeons/thor_v.txt4
-rw-r--r--npc/re/mobs/dungeons/treasure.txt4
-rw-r--r--npc/re/mobs/dungeons/tur_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/xmas_dun.txt4
-rw-r--r--npc/re/mobs/dungeons/yggdrasil.txt4
-rw-r--r--npc/re/mobs/fields/bifrost.txt25
-rw-r--r--npc/re/mobs/fields/lighthalzen.txt2
-rw-r--r--npc/re/other/mercenary_rent.txt4
-rw-r--r--npc/re/quests/cupet.txt4
-rw-r--r--npc/re/quests/eden/56-70.txt1395
-rw-r--r--npc/re/quests/eden/eden_common.txt4
-rw-r--r--npc/re/quests/eden/eden_quests.txt4
-rw-r--r--npc/re/quests/eden/eden_service.txt4
-rw-r--r--npc/re/quests/homu_s.txt4
-rw-r--r--npc/re/quests/magic_books.txt4
-rw-r--r--npc/re/quests/mrsmile.txt4
-rw-r--r--npc/re/quests/pile_bunker.txt4
-rw-r--r--npc/re/quests/quests_brasilis.txt4
-rw-r--r--npc/re/quests/quests_dewata.txt4
-rw-r--r--npc/re/quests/quests_dicastes.txt408
-rw-r--r--npc/re/quests/quests_izlude.txt4
-rw-r--r--npc/re/quests/quests_mora.txt5315
-rw-r--r--npc/re/quests/quests_veins.txt4
-rw-r--r--npc/re/quests/skills/sage_skills.txt53
-rw-r--r--npc/re/scripts.conf (renamed from npc/re/scripts_athena.conf)5
-rw-r--r--npc/re/scripts_main.conf12
-rw-r--r--npc/re/warps/cities/dewata.txt4
-rw-r--r--npc/re/warps/cities/dicastes.txt4
-rw-r--r--npc/re/warps/cities/eclage.txt4
-rw-r--r--npc/re/warps/cities/malaya.txt122
-rw-r--r--npc/re/warps/cities/rachel.txt4
-rw-r--r--npc/re/warps/cities/yggdrasil.txt4
-rw-r--r--npc/re/warps/dungeons/dic_dun.txt4
-rw-r--r--npc/re/warps/dungeons/ecl_dun.txt4
-rw-r--r--npc/re/warps/dungeons/iz_dun.txt4
-rw-r--r--npc/re/warps/fields/bif_fild.txt42
-rw-r--r--npc/re/warps/fields/com_fild.txt4
-rw-r--r--npc/re/warps/fields/dic_fild.txt4
-rw-r--r--npc/re/warps/fields/geffen_fild.txt4
-rw-r--r--npc/re/warps/fields/hugel_fild.txt4
-rw-r--r--npc/re/warps/fields/morroc_fild.txt4
-rw-r--r--npc/re/warps/fields/payon_fild.txt4
-rw-r--r--npc/re/warps/fields/prontera_fild.txt4
-rw-r--r--npc/re/warps/fields/rachel_fild.txt4
-rw-r--r--npc/re/warps/fields/veins_fild.txt4
-rw-r--r--npc/re/warps/fields/yuno_fild.txt4
-rw-r--r--npc/re/warps/other/jobquests.txt4
-rw-r--r--npc/re/warps/other/paradise.txt4
-rw-r--r--npc/re/warps/other/s_workshop.txt4
-rw-r--r--npc/re/warps/other/sign.txt4
-rw-r--r--npc/scripts.conf (renamed from npc/scripts_athena.conf)7
-rw-r--r--npc/scripts_mapflags.conf56
-rw-r--r--npc/warps/guildcastles.txt4
-rw-r--r--npc/warps/pvp.txt2
-rw-r--r--src/char/char.c94
-rw-r--r--src/char/char.h2
-rw-r--r--src/char/int_auction.c8
-rw-r--r--src/char/int_guild.c10
-rw-r--r--src/char/inter.c6
-rw-r--r--src/common/HPM.c12
-rw-r--r--src/common/cbasetypes.h18
-rw-r--r--src/common/console.c12
-rw-r--r--src/common/core.c14
-rw-r--r--src/common/db.c2026
-rw-r--r--src/common/db.h90
-rw-r--r--src/common/des.c10
-rw-r--r--src/common/ers.c117
-rw-r--r--src/common/ers.h6
-rw-r--r--src/common/grfio.c14
-rw-r--r--src/common/malloc.c152
-rw-r--r--src/common/malloc.h16
-rw-r--r--src/common/mapindex.c2
-rw-r--r--src/common/mapindex.h2
-rw-r--r--src/common/mmo.h68
-rw-r--r--src/common/mutex.c2
-rw-r--r--src/common/random.c2
-rw-r--r--src/common/socket.c72
-rw-r--r--src/common/socket.h14
-rw-r--r--src/common/sql.c4
-rw-r--r--src/common/timer.c37
-rw-r--r--src/common/timer.h39
-rw-r--r--src/login/account_sql.c4
-rw-r--r--src/login/ipban_sql.c6
-rw-r--r--src/login/login.c36
-rw-r--r--src/map/atcommand.c598
-rw-r--r--src/map/battle.c286
-rw-r--r--src/map/battle.h3
-rw-r--r--src/map/battleground.c520
-rw-r--r--src/map/battleground.h66
-rw-r--r--src/map/buyingstore.c32
-rw-r--r--src/map/chat.c40
-rw-r--r--src/map/chrif.c99
-rw-r--r--src/map/clif.c806
-rw-r--r--src/map/clif.h44
-rw-r--r--src/map/duel.c4
-rw-r--r--src/map/elemental.c67
-rw-r--r--src/map/guild.c104
-rw-r--r--src/map/homunculus.c40
-rw-r--r--src/map/instance.c508
-rw-r--r--src/map/instance.h76
-rw-r--r--src/map/intif.c72
-rw-r--r--src/map/irc-bot.c30
-rw-r--r--src/map/irc-bot.h3
-rw-r--r--src/map/itemdb.c38
-rw-r--r--src/map/log.c2
-rw-r--r--src/map/mail.c20
-rw-r--r--src/map/map.c2237
-rw-r--r--src/map/map.h494
-rw-r--r--src/map/mapreg_sql.c4
-rw-r--r--src/map/mercenary.c20
-rw-r--r--src/map/mob.c281
-rw-r--r--src/map/npc.c601
-rw-r--r--src/map/npc.h28
-rw-r--r--src/map/npc_chat.c8
-rw-r--r--src/map/packets.h75
-rw-r--r--src/map/packets_struct.h69
-rw-r--r--src/map/party.c246
-rw-r--r--src/map/party.h97
-rw-r--r--src/map/path.c36
-rw-r--r--src/map/pc.c1284
-rw-r--r--src/map/pc.h519
-rw-r--r--src/map/pet.c124
-rw-r--r--src/map/quest.c12
-rw-r--r--src/map/script.c1637
-rw-r--r--src/map/script.h39
-rw-r--r--src/map/searchstore.c2
-rw-r--r--src/map/skill.c1262
-rw-r--r--src/map/skill.h30
-rw-r--r--src/map/status.c475
-rw-r--r--src/map/storage.c38
-rw-r--r--src/map/trade.c50
-rw-r--r--src/map/unit.c335
-rw-r--r--src/map/vending.c28
362 files changed, 25124 insertions, 11943 deletions
diff --git a/.travis.yml b/.travis.yml
index 8c8e7e66f..9ae3460cb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,11 +1,10 @@
language: c
compiler:
- - gcc
- clang
-# Change this to your needs
-script: ./configure --enable-debug && make
+ - gcc
+
+script: uname -a && ./configure --enable-debug && make
-# Disallow 'rathena' branch to be compiled by Travis
branches:
only:
- master
diff --git a/conf/battle/client.conf b/conf/battle/client.conf
index 086932d4b..e638ed0a0 100644
--- a/conf/battle/client.conf
+++ b/conf/battle/client.conf
@@ -87,9 +87,6 @@ summer_ignorepalette: no
// Set this to yes if your cloth palettes pack doesn't has Hanbok palettes (or has less than the other jobs)
hanbok_ignorepalette: no
-// Set this to 1 if your clients have langtype problems and can't display motd properly
-motd_type: 0
-
// Show Hercules version to users when the login?
display_version: no
diff --git a/conf/battlegrounds.conf b/conf/battlegrounds.conf
new file mode 100644
index 000000000..b43899dd7
--- /dev/null
+++ b/conf/battlegrounds.conf
@@ -0,0 +1,101 @@
+//====================================================
+//= _ _ _
+//= | | | | | |
+//= | |_| | ___ _ __ ___ _ _| | ___ ___
+//= | _ |/ _ \ '__/ __| | | | |/ _ \/ __|
+//= | | | | __/ | | (__| |_| | | __/\__ \
+//= \_| |_/\___|_| \___|\__,_|_|\___||___/
+//=
+//= http://hercules.ws/board/
+//====================================================
+//= Link~u! <description> <link to wiki/topic>
+//= http://hercules.ws/board/topic/928-memory-slasher-may-30-patch/
+battlegrounds: (
+{
+ /* feature is not complete */
+ feature_off:true
+ /* character variable for global bg delay */
+ global_delay_var: "BG_Delay_Tick"
+ /* how many seconds to consider a player "afk" and kick him out? */
+ maximum_afk_seconds: 30
+
+ /* one can add as many as he wishes */
+ /* for custom ones, need to edit "lua files/entryqueue/entryqueuelist.lua" [Ind/Hercules] */
+ arenas: ({
+ name: "Tierra Gorge" //must match the name in client files
+ event: "Tierra_BG2::OnPlayerListReady"
+ minLevel: 80
+ maxLevel: 150
+ reward: {/* amount of badges awarded on each case */
+ win: 3
+ loss: 1
+ draw: 1
+ }
+ minPlayers: 6 /* minimum amount of players to start */
+ maxPlayers: 60 /* maximum amount of players */
+ minTeamPlayers: 6 /* minimum amount of team members required for a team (party or guild) to join */
+ delay_var: "Tierra_BG_Tick" /* npc variable name that will store the delay for this match */
+ maxDuration: 30 /* maximum duration in minutes, if reached game ends and highest score wins (or calls a draw if scores are equal) */
+ },{
+ name: "Flavius" //must match the name in client files
+ event: "Flavius_BG1::OnPlayerListReady"
+ minLevel: 80
+ maxLevel: 150
+ reward: {/* amount of badges awarded on each case */
+ win: 9
+ loss: 3
+ draw: 3
+ }
+ minPlayers: 6 /* minimum amount of players to start */
+ maxPlayers: 60 /* maximum amount of players */
+ minTeamPlayers: 6 /* minimum amount of team members required for a team (party or guild) to join */
+ delay_var: "Flavius_BG_Tick" /* npc variable name that will store the delay for this match */
+ maxDuration: 30 /* maximum duration in minutes, if reached game ends and highest score wins (or calls a draw if scores are equal) */
+ },{
+ name: "KVM (Level 80 and up)" //must match the name in client files
+ event: "KvM03_BG::OnPlayerListReady"
+ minLevel: 80
+ maxLevel: 150
+ reward: {/* amount of badges awarded on each case */
+ win: 5
+ loss: 1
+ draw: 1
+ }
+ minPlayers: 4 /* minimum amount of players to start */
+ maxPlayers: 60 /* maximum amount of players */
+ minTeamPlayers: 5 /* minimum amount of team members required for a team (party or guild) to join */
+ delay_var: "KVM_BG_Tick" /* npc variable name that will store the delay for this match */
+ maxDuration: 30 /* maximum duration in minutes, if reached game ends and highest score wins (or calls a draw if scores are equal) */
+ },{
+ name: "KVM (Level 60~79)" //must match the name in client files
+ event: "KvM03_BG::OnPlayerListReady"
+ minLevel: 60
+ maxLevel: 79
+ reward: {/* amount of badges awarded on each case */
+ win: 2
+ loss: 0
+ draw: 1
+ }
+ minPlayers: 4 /* minimum amount of players to start */
+ maxPlayers: 60 /* maximum amount of players */
+ minTeamPlayers: 5 /* minimum amount of team members required for a team (party or guild) to join */
+ delay_var: "KVM_BG_Tick" /* npc variable name that will store the delay for this match */
+ maxDuration: 30 /* maximum duration in minutes, if reached game ends and highest score wins (or calls a draw if scores are equal) */
+ },{
+ name: "KVM (Level 59 and below)" //must match the name in client files
+ event: "KvM03_BG::OnPlayerListReady"
+ minLevel: 1
+ maxLevel: 59
+ reward: {/* amount of badges awarded on each case */
+ win: 1
+ loss: 0
+ draw: 0
+ }
+ minPlayers: 4 /* minimum amount of players to start */
+ maxPlayers: 60 /* maximum amount of players */
+ minTeamPlayers: 5 /* minimum amount of team members required for a team (party or guild) to join */
+ delay_var: "KVM_BG_Tick" /* npc variable name that will store the delay for this match */
+ maxDuration: 30 /* maximum duration in minutes, if reached game ends and highest score wins (or calls a draw if scores are equal) */
+ }
+ )
+}) \ No newline at end of file
diff --git a/conf/channels.conf b/conf/channels.conf
index 3584fc2ea..f17d2aed1 100644
--- a/conf/channels.conf
+++ b/conf/channels.conf
@@ -8,21 +8,23 @@
//=
//= http://hercules.ws/board/
//====================================================
-//= http://hercules.ws/board/topic/316-introducing-hercules-channel-system/
+//================= More Information =================
+// http://hercules.ws/board/topic/316-introducing-hercules-channel-system/
+//====================================================
chsys: (
{
- /* default channels (available on boot) */
+ /* Default Channels (available on boot) */
default_channels: {
/* channel_name : channel_messages_color */
- main: "Orange" /* available as #main */
- support: "Blue" /* available as #support */
- trade: "Red" /* available as #trade */
- offtopic: "Cyan" /* available as #offtopic */
- /* as many channels as you like */
+ main: "Orange" /* Available as #main */
+ support: "Blue" /* Available as #support */
+ trade: "Red" /* Available as #trade */
+ offtopic: "Cyan" /* Available as #offtopic */
+ /* You may add as many channels as you like */
}
- /* colors available */
+ /* Colors Available */
colors: {
- Default: "0xffffff" /* custom channels will use the first in the list unless a font is selected thru @channel */
+ Default: "0xffffff" /* Custom channels use the first color listed unless a font is selected through @channel. */
Red: "0xff0000"
Blue: "0x83cfe9"
Orange: "0xe57c00"
@@ -31,22 +33,25 @@ chsys: (
Green: "0x28bf00"
Light_Green: "0x3dff98"
Normal: "0x00ff00"
- /* as many colors as you like */
+ /* As many colors as you like */
}
- /* allow users to create their own (private) channels through @channels command? */
+ /* Allow users to create their own (private) channels through @channels command? */
/* (must also allow players to use @channels in groups.conf) */
allow_user_channel_creation: true
- /* "map_local_channel" is a instanced channel unique to each map */
+
+ /* "map_local_channel" is a instanced channel unique to each map. */
map_local_channel: true
- map_local_channel_name: "map" /* available as #map */
+ map_local_channel_name: "map" /* Available as #map */
map_local_channel_color: "Yellow"
- map_local_channel_autojoin: true /* can disable autojoin in specific maps through a mapflag or zone */
+ map_local_channel_autojoin: true /* You can disable autojoin in specific maps through a mapflag or zone. */
+
/* "ally_channel" is a channel shared by all your guild allies */
ally_channel_enabled: true
- ally_channel_name: "ally" /* available as #ally */
+ ally_channel_name: "ally" /* Available as #ally */
ally_channel_color: "Green"
- ally_channel_autojoin: true /* will members autojoin to their respective #ally chats when they log-in? */
- /* "irc_channel" is a special channel connected to a specific chat room in any irc network */
+ ally_channel_autojoin: true /* Will members autojoin to their respective #ally chats when they log-in? */
+
+ /* "irc_channel" is a special channel connected to a specific chat room in any irc network. */
irc_channel_enabled: false
irc_channel_name: "irc" /* available as #irc */
irc_channel_color: "Light_Green"
@@ -55,5 +60,4 @@ chsys: (
irc_channel_nick: "Hercules_chSysBot" /* nick the bot will use */
irc_channel_nick_pw: "" /* password to this nick (if any) to identify to nick server on the irc network */
}
-)
-
+) \ No newline at end of file
diff --git a/conf/help.txt b/conf/help.txt
index 6f202091e..16e7c2981 100644
--- a/conf/help.txt
+++ b/conf/help.txt
@@ -7,7 +7,6 @@
help: "Params: <command>\n" "Shows help for specified command."
noask: "Auto rejects deals/invites."
-gmotd: "Broadcasts the Message of The Day to all players."
me: "Params: <message>\n" "Displays normal text as a message in this format: *name message* (like /me in mIRC)."
fakename: "Params: <name>\n" "Changes your name to your choice temporarily."
npctalk: "Params: <NPC name> <message>\n" "Forces a NPC to display a message in normal chat."
diff --git a/conf/map-server.conf b/conf/map-server.conf
index cac5421e6..446bb0d0e 100644
--- a/conf/map-server.conf
+++ b/conf/map-server.conf
@@ -1,5 +1,5 @@
//--------------------------------------------------------------
-//Hercules Map-Server Configuration File
+// Hercules Map-Server Configuration File
//--------------------------------------------------------------
// Note: "Comments" are all text on the right side of a double slash "//"
@@ -103,9 +103,6 @@ minsave_time: 100
// these off.
save_settings: 255
-// Message of the day file, when a character logs on, this message is displayed.
-motd_txt: conf/motd.txt
-
// When @help or @h is typed when you are a gm, this is displayed for helping new gms understand gm commands.
help_txt: conf/help.txt
help2_txt: conf/help2.txt
diff --git a/conf/messages.conf b/conf/messages.conf
index ac2be835a..e2886a57d 100644
--- a/conf/messages.conf
+++ b/conf/messages.conf
@@ -1,12 +1,18 @@
-// Hercules messages.conf
-// Message Configuration
-// For translation, just change msg here (second line), no need to modify source code,
-// or alternatively, use conf/import/msg_conf.txt
+//===== Hercules Message Configuration =======================
+//= Hercules messages.conf
+//===== Description: =========================================
+//= This file handles all messages set throughout the server.
+//============================================================
+// For translation, just change msg here (second line),
+// no need to modify source code or alternatively,
+// use conf/import/msg_conf.txt.
+//============================================================
// Format:
// // English message
// msg_number: translated message
+//============================================================
-// 0-410: reserved for GM commands
+// 0-410: reserved for GM commands
// 500-900 reserved for others
// 900-1300: @atcommand
diff --git a/conf/motd.txt b/conf/motd.txt
deleted file mode 100644
index 445fac937..000000000
--- a/conf/motd.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-// Internal default is limited to 128 lines. If you need more, you will need to modify the MOTD_LINE_SIZE definition in pc.c
-Welcome to Hercules! Enjoy! Please report any bugs you find.
diff --git a/conf/packet.conf b/conf/packet.conf
index 3528d73bb..85996f4e3 100644
--- a/conf/packet.conf
+++ b/conf/packet.conf
@@ -1,11 +1,13 @@
-// Hercules Sockets Configuration file
-// translated (davidsiaw)
-
+//===== Hercules Sockets Configuration =======================
+//= Hercules Sockets Configuration File
+//===== Translated by: =======================================
+// Davidsiaw
+//============================================================
// Display debug reports (When something goes wrong during the report, the report is saved.)
debug: no
-// How long can a socket stall before closing the connection (in seconds)
+// How long can a socket stall before closing the connection (in seconds)?
stall_time: 60
// Maximum allowed size for clients packets in bytes (default: 24576).
diff --git a/db/item_db2.txt b/db/item_db2.txt
index cba8d5186..5ca7a825a 100644
--- a/db/item_db2.txt
+++ b/db/item_db2.txt
@@ -59,5 +59,5 @@
// Old Tuxedo and Wedding Dress, will display the outfit when worn.
//==================================================================
-//2338,Wedding_Dress,Wedding Dress,5,43000,,500,,0,,0,0xFFFFFFFE,7,0,16,,0,1,0,{},{ setoption Option_Wedding,1; },{ setoption Option_Wedding,0; }
-//7170,Tuxedo,Tuxedo,5,43000,,10,,0,,0,0xFFFFFFFE,7,1,16,,0,1,0,{},{ setoption Option_Wedding,1; },{ setoption Option_Wedding,0; }
+//2338,Wedding_Dress,Wedding Dress,5,43000,,500,,0,,0,0xFFFFFFFE,7,0,16,,0,1,0,{},{ sc_start SC_WEDDING,-1,0; },{ sc_end SC_WEDDING; }
+//7170,Tuxedo,Tuxedo,5,43000,,10,,0,,0,0xFFFFFFFE,7,1,16,,0,1,0,{},{ sc_start SC_WEDDING,-1,0; },{ sc_end SC_WEDDING; }
diff --git a/db/pre-re/item_db.txt b/db/pre-re/item_db.txt
index 44237ee80..501e657cc 100644
--- a/db/pre-re/item_db.txt
+++ b/db/pre-re/item_db.txt
@@ -5203,7 +5203,7 @@
12772,Cool_Hat_Box2,Cool Hat Box2,2,0,,0,,,,,0xFFFFFFFF,7,2,,,,,,{},{},{}
12773,Victory_Hat_Box2,Victory Hat Box2,2,0,,0,,,,,0xFFFFFFFF,7,2,,,,,,{},{},{}
12786,Change_Slot_Card,Character Position Change Coupon,2,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ set SlotChange, SlotChange + 1; },{},{}
-12790,Char_Rename_Card,Character Name Change Coupon,2,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ set CharRename, CharRename + 1; },{},{}
+12790,Change_Name_Card,Name Change Coupon,2,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ set CharRename, CharRename + 1; },{},{}
12848,Falcon_Flute,Falcon Flute,11,0,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ if(getskilllv("HT_FALCON")) { if(checkoption(Option_Wug)||checkoption(Option_Wugrider)) end; if(checkfalcon()==1) { setfalcon 0; } else { setfalcon 1; } } },{},{}
12900,Battle_Manual_Box,Battle Manual Box,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ getitem 12208,10; },{},{}
12901,Insurance_Package,Insurance Package,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ getitem 12209,10; },{},{}
diff --git a/db/pre-re/map_zone_db.conf b/db/pre-re/map_zone_db.conf
index ea995b712..96dbd0c7a 100644
--- a/db/pre-re/map_zone_db.conf
+++ b/db/pre-re/map_zone_db.conf
@@ -47,8 +47,8 @@ zones: (
skill_damage_cap: {
//Exemple Below caps firebolt damage in maps within this zone to a maximum 50 damage,
// (depends on HMAP_ZONE_DAMAGE_CAP_TYPE in src/config/core.h)
- // to players and monsters.
- //MG_FIREBOLT: (50,"PLAYER | MONSTER")
+ // when cast vs players and monsters.
+ //MG_COLDBOLT: (50,"PLAYER | MONSTER")
}
},
{
diff --git a/db/quest_db.txt b/db/quest_db.txt
index dc3b87d2d..025a9e6ec 100644
--- a/db/quest_db.txt
+++ b/db/quest_db.txt
@@ -33,6 +33,7 @@
1117,0,0,0,0,0,0,0,"Ropewa & Yuridi - Eternal Promise, Broken Ring"
// Ropewa Clue Quest
1118,0,0,0,0,0,0,0,"Neighborhood Knight - I Need Clues"
+1119,82800,0,0,0,0,0,0,"Neighborhood Knight - Cooldown"
1145,0,0,0,0,0,0,0,"Help the poor cat"
1146,0,0,0,0,0,0,0,"Help the poor cat"
@@ -419,7 +420,7 @@
3256,0,0,0,0,0,0,0,"Request - Ready for waiting summer"
3257,0,1170,30,0,0,0,0,"Request - A grudge of women"
3258,0,0,0,0,0,0,0,"Request - A material of delicacy"
-3259,0,1143,30,0,0,0,0,"Request - A agony of a doll maste"
+3259,0,1143,30,0,0,0,0,"Request - A agony of a doll master"
3260,0,1035,30,0,0,0,0,"Request - Tiresome flies"
3261,0,1026,30,0,0,0,0,"Request - Unclean girl"
3262,0,0,0,0,0,0,0,"Request - Queer hobby"
@@ -527,6 +528,11 @@
5028,43200,0,0,0,0,0,0,"Inspection of the Sample"
5029,3600,0,0,0,0,0,0,"Unidentified Creature"
+5030,0,0,0,0,0,0,0,"The creature's family"
+5031,0,0,0,0,0,0,0,"The creature's family"
+5032,0,0,0,0,0,0,0,"The creature's family"
+5033,0,0,0,0,0,0,0,"The creature's family"
+5034,0,0,0,0,0,0,0,"News from the family"
5035,0,0,0,0,0,0,0,"Help the old man!"
5036,0,0,0,0,0,0,0,"Help the old man!"
5037,0,0,0,0,0,0,0,"Help the old man!"
@@ -854,7 +860,7 @@
// New Sapha's Honor Quest
7206,0,0,0,0,0,0,0,"New Day for Cheshire"
7207,0,0,0,0,0,0,0,"Cheshire's Box"
-7208,82800,0,0,0,0,0,0,"Wait for Cheshire?"
+7208,86400,0,0,0,0,0,0,"Wait for Cheshire?"
// Misty Forest Labyrinth
7211,9000,0,0,0,0,0,0,"Misty Forest Labyrinth Exploration"
@@ -1683,8 +1689,8 @@
//Mora Quests
// == Roast Beef Quest
-11182,180,0,0,0,0,0,0,"Teohre's Report"
-11183,0,0,0,0,0,0,0,"Teohre's Favor"
+11182,60,0,0,0,0,0,0,"Theore's Report"
+11183,0,0,0,0,0,0,0,"Theore's Favor"
// == Theo
11184,0,0,0,0,0,0,0,"Runaway Laphine"
11185,0,0,0,0,0,0,0,"Pouch"
diff --git a/db/re/item_db.txt b/db/re/item_db.txt
index a28fbd711..5dccc5442 100644
--- a/db/re/item_db.txt
+++ b/db/re/item_db.txt
@@ -5984,7 +5984,7 @@
12775,Ancient_Spirit_Amulet,Ancient Spirit Amulet,2,20,,600,,,,,0xFFFFFFFF,7,2,,,,,,{},{},{}
//
12786,Change_Slot_Card,Character Position Change Coupon,2,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ set SlotChange, SlotChange + 1; },{},{}
-12790,Char_Rename_Card,Character Name Change Coupon,2,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ set CharRename, CharRename + 1; },{},{}
+12790,Change_Name_Card,Name Change Coupon,2,,,,,,,,0xFFFFFFFF,7,2,,,,,,{ set CharRename, CharRename + 1; },{},{}
//
12848,Falcon_Flute,Falcon Flute,11,0,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ if(getskilllv("HT_FALCON")) { if(checkoption(Option_Wug)||checkoption(Option_Wugrider)) end; if(checkfalcon()==1) { setfalcon 0; } else { setfalcon 1; } } },{},{}
12900,Battle_Manual_Box,Battle Manual Box,18,20,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ getitem 12208,10; },{},{}
diff --git a/db/re/map_zone_db.conf b/db/re/map_zone_db.conf
index ea995b712..96dbd0c7a 100644
--- a/db/re/map_zone_db.conf
+++ b/db/re/map_zone_db.conf
@@ -47,8 +47,8 @@ zones: (
skill_damage_cap: {
//Exemple Below caps firebolt damage in maps within this zone to a maximum 50 damage,
// (depends on HMAP_ZONE_DAMAGE_CAP_TYPE in src/config/core.h)
- // to players and monsters.
- //MG_FIREBOLT: (50,"PLAYER | MONSTER")
+ // when cast vs players and monsters.
+ //MG_COLDBOLT: (50,"PLAYER | MONSTER")
}
},
{
diff --git a/doc/atcommands.txt b/doc/atcommands.txt
index b31fe4cef..1e2985f66 100644
--- a/doc/atcommands.txt
+++ b/doc/atcommands.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= Atcommand List
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/doc/ea_job_system.txt b/doc/ea_job_system.txt
index 034b4a617..997debf4d 100644
--- a/doc/ea_job_system.txt
+++ b/doc/ea_job_system.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= eAthena Job System
//===== By: ==================================================
//= Skotlex
diff --git a/doc/effect_list.txt b/doc/effect_list.txt
index 19b323cc6..01ea2753b 100644
--- a/doc/effect_list.txt
+++ b/doc/effect_list.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= Client Effects List
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/doc/item_bonus.txt b/doc/item_bonus.txt
index 559e49414..fce54b24e 100644
--- a/doc/item_bonus.txt
+++ b/doc/item_bonus.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= Hercules Item Bonuses List
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/doc/item_db.txt b/doc/item_db.txt
index 742a27089..6630dd065 100644
--- a/doc/item_db.txt
+++ b/doc/item_db.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= Item Database
//===== By: ==================================================
//= Hercules Dev Team
@@ -86,20 +86,21 @@ Upper: Equippable upper-types. Uses the following bitmasks:
Gender: Gender restriction. 0 is female, 1 is male, 2 for both.
Loc: Equipment's placement. Values are:
- 2^13 8192 = Costume Garment/Robe
- 2^12 4096 = Costume Low Headgear
- 2^11 2048 = Costume Mid Headgear
- 2^10 1024 = Costume Top Headgear
- 2^8 256 = Upper Headgear
- 2^9 512 = Middle Headgear
+
2^0 001 = Lower Headgear
- 2^4 016 = Armor
2^1 002 = Weapon
- 2^5 032 = Shield
2^2 004 = Garment
- 2^6 064 = Footgear
2^3 008 = Accessory 1
+ 2^4 016 = Armor
+ 2^5 032 = Shield
+ 2^6 064 = Footgear
2^7 128 = Accessory 2
+ 2^8 256 = Upper Headgear
+ 2^9 512 = Middle Headgear
+ 2^10 1024 = Costume Top Headgear
+ 2^11 2048 = Costume Mid Headgear
+ 2^12 4096 = Costume Low Headgear
+ 2^13 8192 = Costume Garment/Robe
wLV: Weapon level.
diff --git a/doc/map_cache.txt b/doc/map_cache.txt
index 99e54ef06..19ab92a4d 100644
--- a/doc/map_cache.txt
+++ b/doc/map_cache.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= Hercules Map Cache Builder and Format Documentation
//===== By: ==================================================
//= DracoRPG
diff --git a/doc/md5_hashcheck.txt b/doc/md5_hashcheck.txt
index 12681f367..a2dbf42fa 100644
--- a/doc/md5_hashcheck.txt
+++ b/doc/md5_hashcheck.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= MD5 Hash Check
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/doc/mob_db_mode_list.txt b/doc/mob_db_mode_list.txt
index f747e38b0..08abf800d 100644
--- a/doc/mob_db_mode_list.txt
+++ b/doc/mob_db_mode_list.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= Hercules Monster Modes Reference
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/doc/packet_struct_notation.txt b/doc/packet_struct_notation.txt
index c1598f3be..0e9c5d055 100644
--- a/doc/packet_struct_notation.txt
+++ b/doc/packet_struct_notation.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= Packet Structure Notation
//===== By: ==================================================
//= Ai4rei
diff --git a/doc/permissions.txt b/doc/permissions.txt
index 1dbfd0056..6cfb98897 100644
--- a/doc/permissions.txt
+++ b/doc/permissions.txt
@@ -1,9 +1,9 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= Permission List
//===== By: ==================================================
//= Hercules Dev Team
//===== Current Version: =====================================
-//= 20130330
+//= 20130528
//===== Description: =========================================
//= Player group permissions, configured in /conf/groups.conf.
//============================================================
@@ -31,4 +31,4 @@ show_bossmobs : Ability to see boss mobs with @showmobs.
disable_pvm : Ability to disable Player vs. Monster.
disable_pvp : Ability to disable Player vs. Player.
disable_commands_when_dead : Ability to disable @command usage when dead.
-hchsys_admin : Hercules Chat System Admin (can modify channels settings regardless of ownership and join password-protected channels without password) \ No newline at end of file
+hchsys_admin : Hercules Chat System Admin (Ability to modify channel settings regardless of ownership and join password-protected channels without requiring a password.) \ No newline at end of file
diff --git a/doc/quest_variables.txt b/doc/quest_variables.txt
index 556210dca..0be144183 100644
--- a/doc/quest_variables.txt
+++ b/doc/quest_variables.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= Permanent Quest Variables
//===== By: ==================================================
//= Lupus
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index bf462c812..3bac278bb 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= Hercules Script Commands
//===== By: ==================================================
//= Hercules Dev Team
@@ -7,22 +7,24 @@
//= Commands are sorted depending on their functionality.
//============================================================
-This document is a reference manual for all the scripting commands and functions
-available in current Hercules GIT. It is not a simple tutorial. When people tell
-you to "Read The F***ing Manual", they mean this.
-
-The information was mostly acquired through looking up how things actually work
-in the source code of the server, which was written by many people over time,
-and lots of them don't speak English and never left any notes - or are otherwise
-not available for comments. As such, anything written in here might not be
-correct, it is only correct to the best of our knowledge, which is limited.
-
-This is not a place to teach you basic programming. This document will not teach
-you basic programming by itself. It's more of a reference for those who have at
-least a vague idea of what they want to do and want to know what tools they have
-available to do it. We've tried to keep it as simple as feasible, but if you
-don't understand it, getting a clear book on programming in general will help
-better than yelling around the forum for help.
+This document is a reference manual for all the scripting commands and
+functions available in current Hercules GIT. It is not a simple tutorial.
+When people tell you to "Read The F***ing Manual", they mean this.
+
+The information was mostly acquired through looking up how things actually
+work in the source code of the server, which was written by many people
+over time, and lots of them don't speak English and never left any notes -
+or are otherwise not available for comments. As such, anything written in
+here might not be correct, it is only correct to the best of our
+knowledge, which is limited.
+
+This is not a place to teach you basic programming. This document will not
+teach you basic programming by itself. It's more of a reference for those
+who have at least a vague idea of what they want to do and want to know
+what tools they have available to do it. We've tried to keep it as simple
+as feasible, but if you don't understand it, getting a clear book on
+programming in general will help better than yelling around the forum for
+help.
A little learning never caused anyone's head to explode.
@@ -35,53 +37,55 @@ The commands and functions are listed in no particular order:
Descriptive text
- Small example if possible. Will usually be incomplete, it's there just to
- give you an idea of how it works in practice.
+ Small example if possible. Will usually be incomplete, it's there just
+ to give you an idea of how it works in practice.
To find a specific command, use Ctrl+F, (or whatever keys call up a search
-function in whatever you're reading this with) put an * followed by the command
-name, and it should find the command description for you.
+function in whatever you're reading this with) put an * followed by the
+command name, and it should find the command description for you.
-If you find anything omitted, please respond. :)
+If you find anything omitted, please tell us. :)
Syntax
------
-Throughout this document, wherever a command wants an argument, it is given in
-<angle brackets>. This doesn't mean you should type the angle brackets. :) If an
-argument of a command is optional, it is given in {curly brackets}. You've
-doubtlessly seen this convention somewhere, if you didn't, get used to it,
-that's how big boys do it. If a command can optionally take an unspecified
-number of arguments, you'll see a list like this:
+Throughout this document, wherever a command wants an argument, it is
+given in <angle brackets>. This doesn't mean you should type the angle
+brackets. :) If an argument of a command is optional, it is given in
+{curly brackets}. You've doubtlessly seen this convention somewhere, if
+you didn't, get used to it, that's how big boys do it. If a command can
+optionally take an unspecified number of arguments, you'll see a list like
+this:
command <argument>{,<argument>...<argument>}
This still means they will want to be separated by commas.
-Where a command wants a string, it will be given in "quotes", if it's a number,
-it will be given without them. Normally, you can put an expression, like a bunch
-of functions or operators returning a value, in (round brackets) instead of most
-numbers. Round brackets will not always be required, but they're often a good
-idea.
+Where a command wants a string, it will be given in "quotes", if it's a
+number, it will be given without them. Normally, you can put an
+expression, like a bunch of functions or operators returning a value, in
+(round brackets) instead of most numbers. Round brackets will not always
+be required, but they're often a good idea.
-Wherever you refer to a map name, it's always 'mapname' or 'mapname.gat'
+Wherever you refer to a map name, it's always 'mapname' or 'mapname.gat'
(Please, don't use .gat suffix anymore. It's useless.)
Script loading structure
------------------------
-Scripts are loaded by the map server as referenced in the 'conf/map-server.conf'
-configuration file, but in the default configuration, it doesn't load any script
-files itself. Instead, it loads the file 'npc/scripts_main.conf' which itself
-contains references to other files. The actual scripts are loaded from txt
-files, which are linked up like this:
+Scripts are loaded by the map server as referenced in the
+'conf/map-server.conf' configuration file, but in the default
+configuration, it doesn't load any script files itself. Instead, it loads
+the file 'npc/scripts_main.conf' which itself contains references to other
+files. The actual scripts are loaded from txt files, which are linked up
+like this:
npc: <path to a filename>
-Any line like this, invoked, ultimately, by 'map-server.conf' will load up the
-script contained in this file, which will make the script available. No file
-will get loaded twice, to prevent possible errors.
+Any line like this, invoked, ultimately, by 'map-server.conf' will load up
+the script contained in this file, which will make the script available.
+No file will get loaded twice, to prevent possible errors.
Another configuration file option of relevance is:
@@ -90,14 +94,14 @@ delnpc: <path to a filename>
This will unload a specified script filename from memory, which, while
seemingly useless, may sometimes be required.
-Whenever '//' is encountered in a line upon reading, everything beyond this on
-that line is considered to be a comment and is ignored. This works wherever you
-place it.
+Whenever '//' is encountered in a line upon reading, everything beyond
+this on that line is considered to be a comment and is ignored. This works
+wherever you place it.
// This line will be ignored when processing the script.
-Block comments can also be used, where you can place /* and */ between any text you
-wish Hercules to ignore.
+Block comments can also be used, where you can place /* and */ between any
+text you wish Hercules to ignore.
Example:
/* This text,
@@ -105,23 +109,25 @@ Example:
* is ignored, until the following
* symbol is encountered: */
-The asterisks (*) in front of each line is a personal preference, and is not required.
-
-Upon loading all the files, the server will execute all the top-level commands
-in them. No variables exist yet at this point, no commands can be called other
-than those given in this section. These commands set up the basic server script
-structure - create NPC objects, spawn monster objects, set map flags, etc. No
-code is actually executed at this point except them. The top-level commands the
-scripting are pretty confusing, since they aren't structured like you would
-expect commands, command name first, but rather, normally start with a map name.
-
-What's more confusing about the top-level commands is that most of them use a
-tab symbol to divide their arguments.
-
-To prevent problems and confusion, the tab symbols are written as '%TAB%' or '<TAB>'
-throughout this document, even though this makes the text a bit less readable.
-Using an invisible symbol to denote arguments is one of the bad things about
-this language, but we're stuck with it for now. :)
+The asterisks (*) in front of each line is a personal preference, and is
+not required.
+
+Upon loading all the files, the server will execute all the top-level
+commands in them. No variables exist yet at this point, no commands can be
+called other than those given in this section. These commands set up the
+basic server script structure - create NPC objects, spawn monster objects,
+set map flags, etc. No code is actually executed at this point except
+them. The top-level commands the scripting are pretty confusing, since
+they aren't structured like you would expect commands, command name first,
+but rather, normally start with a map name.
+
+What's more confusing about the top-level commands is that most of them
+use a tab symbol to divide their arguments.
+
+To prevent problems and confusion, the tab symbols are written as '%TAB%'
+or '<TAB>' throughout this document, even though this makes the text a bit
+less readable. Using an invisible symbol to denote arguments is one of the
+bad things about this language, but we're stuck with it for now. :)
Here is a list of valid top-level commands:
@@ -129,55 +135,57 @@ Here is a list of valid top-level commands:
<map name>%TAB%mapflag%TAB%<flag>
-This will, upon loading, set a specified map flag on a map you like. These are
-normally in files inside 'conf/mapflag' and are loaded first, so by the time the
-server's up, all the maps have the flags they should have. Map flags determine
-the behavior of the map regarding various common problems, for a better
-explanation, see 'setmapflag'.
+This will, upon loading, set a specified map flag on a map you like. These
+are normally in files inside 'npc/mapflag' and are loaded first, so by the
+time the server's up, all the maps have the flags they should have. Map
+flags determine the behavior of the map regarding various common problems,
+for a better explanation, see 'setmapflag'.
** Create a permanent monster spawn:
<map name>,<x>,<y>,<xs>,<ys>%TAB%monster%TAB%<monster name>%TAB%<mob id>,<amount>,<delay1>,<delay2>,<event>{,<mob size>,<mob ai>}
-Map name is the name of the map the monsters will spawn on. x,y are the
-coordinates where the mob should spawn. If xs and ys are non-zero, they
-specify the 'radius' of a spawn-rectangle area centered at x,y.
-Putting zeros instead of these coordinates will spawn the monsters randomly.
-Note this is only the initial spawn zone, as mobs random-walk, they are free
-to move away from their specified spawn region.
-
-Monster name is the name the monsters will have on screen, and has no relation
-whatsoever to their names anywhere else. It's the mob id that counts, which
-identifies monster record in 'mob_db.txt' database of monsters. If the mob name
-is given as "--ja--", the 'japanese name' field from the monster database is
-used, (which, in Hercules, actually contains an English name) if it's "--en--",
-it's the 'english name' from the monster database (which contains an uppercase
-name used to summon the monster with a GM command).
+Map name is the name of the map the monsters will spawn on. x,y are the
+coordinates where the mob should spawn. If xs and ys are non-zero, they
+specify the 'radius' of a spawn-rectangle area centered at x,y. Putting
+zeros instead of these coordinates will spawn the monsters randomly. Note
+this is only the initial spawn zone, as mobs random-walk, they are free to
+move away from their specified spawn region.
+
+Monster name is the name the monsters will have on screen, and has no
+relation whatsoever to their names anywhere else. It's the mob id that
+counts, which identifies monster record in 'mob_db.txt' database of
+monsters. If the mob name is given as "--ja--", the 'japanese name' field
+from the monster database is used, (which, in Hercules, actually contains
+an English name) if it's "--en--", it's the 'english name' from the
+monster database (which contains an uppercase name used to summon the
+monster with a GM command).
Amount is the amount of monsters that will be spawned when this command is
executed, it is affected by spawn rates in 'battle.conf'.
-Delay1 and delay2 control monster respawn delays - the first one is the fixed
-base respawn time, and the second is random variance on top of the base time.
-Both values are given in milliseconds (1000 = 1 second).
-Note that the server also enforces a minimum respawn delay of 5 seconds.
+Delay1 and delay2 control monster respawn delays - the first one is the
+fixed base respawn time, and the second is random variance on top of the
+base time. Both values are given in milliseconds (1000 = 1 second). Note
+that the server also enforces a minimum respawn delay of 5 seconds.
-You can specify a custom level to use for the mob different from the one of
-the database by adjoining the level after the name with a comma. eg:
+You can specify a custom level to use for the mob different from the one
+of the database by adjoining the level after the name with a comma. eg:
"Poring,50" for a name will spawn a monster with name Poring and level 50.
-Event is a script event to be executed when the mob is killed. The event must
-be in the form "NPCName::OnEventName" to execute, and the event name label
-should start with "On". As with all events, if the NPC is an on-touch NPC, the
-player who triggers the script must be within 'trigger' range for the event to
-work.
+Event is a script event to be executed when the mob is killed. The event
+must be in the form "NPCName::OnEventName" to execute, and the event name
+label should start with "On". As with all events, if the NPC is an
+on-touch NPC, the player who triggers the script must be within 'trigger'
+range for the event to work.
-There are two optional fields for monster size and AI. Size can be 0 (medium),
-1 (small), or 2 (big). AI can be 0 (default), 1 (attack/friendly), 2 (sphere),
-3 (flora), or 4 (zanzou).
+There are two optional fields for monster size and AI. Size can be 0
+(medium), 1 (small), or 2 (big). AI can be 0 (default), 1
+(attack/friendly), 2 (sphere), 3 (flora), or 4 (zanzou).
-Alternately, a monster spawned using 'boss_monster' instead of 'monster' is able
-to be detected on the map with the SC_BOSSMAPINFO status (used by Convex Mirror).
+Alternately, a monster spawned using 'boss_monster' instead of 'monster'
+is able to be detected on the map with the SC_BOSSMAPINFO status (used by
+Convex Mirror, item ID# 12214).
** NPC names
@@ -187,13 +195,14 @@ NPC names are kinda special and are formatted this way:
<Display name>{::<Unique name>}
-All NPCs need to have a unique name that is used for identification purposes.
-When you have to identify a NPC by it's name, you should use <Unique name>.
-If <Unique name> is not provided, use <Display name> instead.
+All NPCs need to have a unique name that is used for identification
+purposes. When you have to identify a NPC by it's name, you should use
+<Unique name>. If <Unique name> is not provided, use <Display name>
+instead.
-The client has a special feature when displaying names:
-if the display name contains a '#' character, it hides that part of the name.
-ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter'
+The client has a special feature when displaying names: if the display
+name contains a '#' character, it hides that part of the name.
+Ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter'
<Display name> must be at most 24 characters in length.
<Unique name> must be at most 24 characters in length.
@@ -202,16 +211,16 @@ ex: if your NPC is named 'Hunter#hunter1', it will be displayed as 'Hunter'
<from map name>,<fromX>,<fromY>,<facing>%TAB%warp%TAB%<warp name>%TAB%<spanx>,<spany>,<to map name>,<toX>,<toY>
-This will define a warp NPC that will warp a player between maps, and while most
-arguments of that are obvious, some deserve special mention.
+This will define a warp NPC that will warp a player between maps, and
+while most arguments of that are obvious, some deserve special mention.
-SpanX and SpanY will make the warp sensitive to a character who didn't step
-directly on it, but walked into a zone which is centered on the warp from
-coordinates and is SpanX in each direction across the X axis and SpanY in each
-direction across the Y axis.
+SpanX and SpanY will make the warp sensitive to a character who didn't
+step directly on it, but walked into a zone which is centered on the warp
+from coordinates and is SpanX in each direction across the X axis and
+SpanY in each direction across the Y axis.
-Warp NPC objects also have a name, because you can use it to refer to them later
-with 'enablenpc'/'disablenpc'
+Warp NPC objects also have a name, because you can use it to refer to them
+later with 'enablenpc'/'disablenpc'.
Facing of a warp object is irrelevant, it is not used in the code and all
current scripts have a zero in there.
@@ -221,41 +230,42 @@ current scripts have a zero in there.
<map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,{<code>}
<map name>,<x>,<y>,<facing>%TAB%script%TAB%<NPC Name>%TAB%<sprite id>,<triggerX>,<triggerY>,{<code>}
-This will place an NPC object on a specified map at the specified location, and
-is a top-level command you will use the most in your custom scripting. The NPCs
-are triggered by clicking on them, and/or by walking in their trigger area, if
-defined, see that below.
-
-Facing is a direction the NPC sprite will face in. Not all NPC sprites have
-different images depending on the direction you look from, so for some facing
-will be meaningless. Facings are counted counterclockwise in increments of 45
-degrees, where 0 means facing towards the top of the map. (So to turn the sprite
-towards the bottom of the map, you use facing 4, and to make it look southeast
-it's facing 5.)
-
-Sprite id is the sprite number used to display this particular NPC. For a full
-list of sprite id numbers see http://kalen.s79.xrea.com/npc/npce.shtml You may
-also use a monster's ID number instead to display a monster sprite for this NPC.
-It is possible to use a job sprite as well, but you must first define it as a
-monster sprite in 'mob_avail.txt', a full description on how to do this is not
-in the scope of this manual.
+This will place an NPC object on a specified map at the specified
+location, and is a top-level command you will use the most in your custom
+scripting. The NPCs are triggered by clicking on them, and/or by walking
+in their trigger area, if defined. See that below.
+
+Facing is a direction the NPC sprite will face in. Not all NPC sprites
+have different images depending on the direction you look from, so for
+some facing will be meaningless. Facings are counted counterclockwise in
+increments of 45 degrees, where 0 means facing towards the top of the map.
+(So to turn the sprite towards the bottom of the map, you use facing 4,
+and to make it look southeast it's facing 5.)
+
+Sprite id is the sprite number used to display this particular NPC. For a
+full list of sprite id numbers see http://kalen.s79.xrea.com/npc/npce.shtml
+You may also use a monster's ID number instead to display a monster sprite
+for this NPC. It is possible to use a job sprite as well, but you must
+first define it as a monster sprite in 'mob_avail.txt', a full description
+on how to do this is not in the scope of this manual.
A '-1' sprite id will make the NPC invisible (and unclickable).
-A '111' sprite id will make an NPC which does not have a sprite, but is still
-clickable, which is useful if you want to make a clickable object of the 3D
-terrain.
+A '111' sprite id will make an NPC which does not have a sprite, but is
+still clickable, which is useful if you want to make a clickable object of
+the 3D terrain.
TriggerX and triggerY, if given, will define an area, centered on NPC and
spanning triggerX cells in every direction across X and triggerY in every
direction across Y. Walking into that area will trigger the NPC. If no
-'OnTouch:' special label is present in the NPC code, the execution will start
-from the beginning of the script, otherwise, it will start from the 'OnTouch:'
-label. Monsters can also trigger the NPC, though the label 'OnTouchNPC:' is
-used in this case.
+'OnTouch:' special label is present in the NPC code, the execution will
+start from the beginning of the script, otherwise, it will start from the
+'OnTouch:' label. Monsters can also trigger the NPC, though the label
+'OnTouchNPC:' is used in this case.
The code part is the script code that will execute whenever the NPC is
-triggered. It may contain commands and function calls, descriptions of which
-compose most of this document. It has to be in curly brackets, unlike elsewhere
-where we use curly brackets, these do NOT signify an optional parameter.
+triggered. It may contain commands and function calls, descriptions of
+which compose most of this document. It has to be in curly brackets,
+unlike elsewhere where we use curly brackets, these do NOT signify an
+optional parameter.
** Define a 'floating' NPC object.
@@ -263,30 +273,30 @@ where we use curly brackets, these do NOT signify an optional parameter.
This will define an NPC object not triggerable by normal means. This would
normally mean it's pointless since it can't do anything, but there are
-exceptions, mostly related to running scripts at specified time, which is what
-these floating NPC objects are for. More on that below.
+exceptions, mostly related to running scripts at specified time, which is
+what these floating NPC objects are for. More on that below.
** Define a shop/cashshop NPC.
-%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
<map name>,<x>,<y>,<facing>%TAB%shop%TAB%<NPC Name>%TAB%<sprite id>,<itemid>:<price>{,<itemid>:<price>...}
-This will define a shop NPC, which, when triggered (which can only be done by
-clicking) will cause a shop window to come up. No code whatsoever runs in shop
-NPCs and you can't change the prices otherwise than by editing the script
-itself. (No variables even exist at this point of scripting, so don't even
-bother trying to use them.)
-
-The item id is the number of item in the 'item_db.txt' database. If Price is set
-to -1, the 'buy price' given in the item database will be used. Otherwise, the
-price you gave will be used for this item, which is how you create differing
-prices for items in different shops.
-
-You can alternatively use "cashshop" in place of "shop" to use the Cash Shop
-interface, allowing you to buy items with special points (Currently stored as
-account vars in global_reg #CASHPOINTS and #KAFRAPOINTS).
-This type of shop will not allow you to sell items at it, you may only
-purchase items here. The layout used to define sale items still count, and
+This will define a shop NPC, which, when triggered (which can only be done
+by clicking) will cause a shop window to come up. No code whatsoever runs
+in shop NPCs and you can't change the prices otherwise than by editing the
+script itself (no variables even exist at this point of scripting, so
+don't even bother trying to use them).
+
+The item id is the number of item in the 'item_db.txt' database. If Price
+is set to -1, the 'buy price' given in the item database will be used.
+Otherwise, the price you gave will be used for this item, which is how you
+create differing prices for items in different shops.
+
+You can alternatively use "cashshop" in place of "shop" to use the Cash
+Shop interface, allowing you to buy items with special points (Currently
+stored as account vars in global_reg #CASHPOINTS and #KAFRAPOINTS). This
+type of shop will not allow you to sell items at it, you may only purchase
+items here. The layout used to define sale items still count, and
"<price>" refers to how many points will be spent purchasing the them.
** Define an warp/shop/cashshop/NPC duplicate.
@@ -301,25 +311,25 @@ This will duplicate an warp/shop/cashshop/NPC referred to by 'label'.
Warp duplicates inherit the target location.
Shop/cashshop duplicates inherit the item list.
NPC duplicates inherit the script code.
-The rest (name, location, facing, sprite ID, span/trigger area)
-is obtained from the definition of the duplicate (not inherited).
+The rest (name, location, facing, sprite ID, span/trigger area) is
+obtained from the definition of the duplicate (not inherited).
** Define a function object
function%TAB%script%TAB%<function name>%TAB%{<code>}
-This will define a function object, callable with the 'callfunc' command (see
-below). This object will load on every map server separately, so you can get at
-it from anywhere. It's not possible to call the code in this object by
-anything other than the 'callfunc' script command.
-
-The code part is the script code that will execute whenever the function is
-called with 'callfunc'. It has to be in curly brackets, unlike elsewhere where
-we use curly brackets, these do NOT signify an optional parameter.
+This will define a function object, callable with the 'callfunc' command
+(see below). This object will load on every map server separately, so you
+can get at it from anywhere. It's not possible to call the code in this
+object by anything other than the 'callfunc' script command.
+The code part is the script code that will execute whenever the function
+is called with 'callfunc'. It has to be in curly brackets, unlike
+elsewhere where we use curly brackets, these do NOT signify an optional
+parameter.
Once an object is defined which has a 'code' field to it's definition, it
-contains script commands which can actually be triggered and executed.
+contains script commands which can actually be triggered and executed.
~ RID? GID? ~
@@ -328,82 +338,83 @@ What a RID is and why do you need to know
Most scripting commands and functions will want to request data about a
character, store variables referenced to that character, send stuff to the
-client connected to that specific character. Whenever a script is invoked by a
-character, it is passed a so-called RID - this is the account ID number of a
-character that caused the code to execute by clicking on it, walking into it's
-OnTouch zone, or otherwise.
-
-If you are only writing common NPCs, you don't need to bother with it. However,
-if you use functions, if you use timers, if you use clock-based script
-activation, you need to be aware of all cases when a script execution can be
-triggered without a RID attached. This will make a lot of commands and functions
-unusable, since they want data from a specific character, want to send stuff to
-a specific client, want to store variables specific to that character, and they
-would not know what character to work on if there's no RID.
-
-Unless you use 'attachrid' to explicitly attach a character to the script first.
+client connected to that specific character. Whenever a script is invoked
+by a character, it is passed a so-called RID - this is the account ID
+number of a character that caused the code to execute by clicking on it,
+walking into it's OnTouch zone, or otherwise.
+
+If you are only writing common NPCs, you don't need to bother with it.
+However, if you use functions, if you use timers, if you use clock-based
+script activation, you need to be aware of all cases when a script
+execution can be triggered without a RID attached. This will make a lot of
+commands and functions unusable, since they want data from a specific
+character, want to send stuff to a specific client, want to store
+variables specific to that character, and they would not know what
+character to work on if there's no RID.
+
+Unless you use 'attachrid' to explicitly attach a character to the script
+first (see player-related commands).
Whenever we say 'invoking character', we mean 'the character who's RID is
-attached to the running script. The script function "playerattached" can be
-used to check which is the currently attached player to the script (it will
-return 0 if the there is no player attached or the attached player no longer
-is logged on to the map-server).
+attached to the running script. The script function "playerattached" can
+be used to check which is the currently attached player to the script (it
+will return 0 if the there is no player attached or the attached player no
+longer is logged on to the map-server).
But what about GID?
--- ---- ----- ----
-GID stands for the Game ID of something, this can either be the GID obtained
-through mobspawn (mob control commands) or the account ID of a character.
-Another way would be to right click on a mob,
-NPC or char as GM sprited char to view the GID.
-
-This is mostly used for the new version of skill and the mob control commands
-implemented (but NEVER documented by Lance. Shame on you...).
+GID stands for the Game ID of something, this can either be the GID of a
+mob obtained through the monster script command (if only summoned one),
+the GID of a NPC obtained through the getnpcid script command or the
+account ID of a character (same as its RID). Another way would be to right
+click on a mob, NPC or char as GM sprited char to view its GID.
Item and pet scripts
--------------------
-Each item in the item database has three special fields - Script , OnEquip_Script
-and OnUnequip_Script. The first is script code run every time a character equips the item,
-with the RID of the equipping character. Every time they unequip an item, all
-temporary bonuses given by the script commands are cleared, and all the scripts
-are executed once again to rebuild them. This also happens in several other
-situations (like upon login) but the full list is currently unknown.
+Each item in the item database has three special fields - Script,
+OnEquip_Script and OnUnequip_Script. The first is script code run every
+time a character equips the item, with the RID of the equipping character.
+Every time they unequip an item, all temporary bonuses given by the script
+commands are cleared, and all the scripts are executed once again to
+rebuild them. This also happens in several other situations (like upon
+login) but the full list is currently unknown.
-OnEquip_Script is a piece of script code run whenever the item is used by a character
-by double-clicking on it. OnUnequip_Script runs whenever the
-equipment is unequip by a character
+OnEquip_Script is a piece of script code run whenever the item is used by
+a character by double-clicking on it. OnUnequip_Script runs whenever the
+equipment is unequipped by a character.
-Not all script commands work properly in the item scripts. Where commands and
-functions are known to be meant specifically for use in item scripts, they are
-described as such.
+Not all script commands work properly in the item scripts. Where commands
+and functions are known to be meant specifically for use in item scripts,
+they are described as such.
Every pet in the pet database has a PetScript field, which determines pet
-behavior. It is invoked wherever a pet of the specified type is spawned.
-(hatched from an egg, or loaded from the char server when a character who had
-that pet following them connects) This may occur in some other situations as
-well. Don't expect anything other than commands definitely marked as usable in
-pet scripts to work in there reliably.
+behavior. It is invoked wherever a pet of the specified type is spawned
+(hatched from an egg, or loaded from the char server when a character who
+had that pet following them connects). This may occur in some other
+situations as well. Don't expect anything other than commands definitely
+marked as usable in pet scripts to work in there reliably.
Numbers
-------
-Beside the common decimal numbers, which are nothing special whatsoever (though
-do not expect to use fractions, since ALL numbers are integer in this language),
-the script engine also handles hexadecimal numbers, which are otherwise
-identical. Writing a number like '0x<hex digits>' will make it recognized as a
-hexadecimal value. Notice that 0x10 is equal to 16. Also notice that if you try
-to 'mes 0x10' it will print '16'.
+Beside the common decimal numbers, which are nothing special whatsoever
+(though do not expect to use fractions, since ALL numbers are integer in
+this language), the script engine also handles hexadecimal numbers, which
+are otherwise identical. Writing a number like '0x<hex digits>' will make
+it recognized as a hexadecimal value. Notice that 0x10 is equal to 16.
+Also notice that if you try to 'mes 0x10' it will print '16'.
This is not used much, but it pays to know about it.
Variables
---------
-The meat of every programming language is variables - places where you store
-data.
+The meat of every programming language is variables - places where you
+store data.
-In the Hercules scripting language, variable names are not case sensitive.
+In Hercules scripting language, variable names are not case sensitive.
Variables are divided into and uniquely identified by the combination of:
prefix - determines the scope and extent (or lifetime) of the variable
@@ -423,51 +434,45 @@ permanent - They still exist when the server resets.
temporary - They cease to exist when the server resets.
Prefix: scope and extent
-nothing - A permanent variable attached to the character, the default variable
- type. They are stored with all the account data in "save\athena.txt"
- in TXT versions and in the SQL versions in the `global_reg_value`
- table using type 3.
-"@" - A temporary variable attached to the character.
- SVN versions before 2094 revision and RC5 version will also treat
- 'l' as a temporary variable prefix, so beware of having variable
- names starting with 'l' if you want full backward compatibility.
-"$" - A global permanent variable.
- They are stored in "save\mapreg.txt" or database table `mapreg`,
- depending on server type.
+nothing - A permanent variable attached to the character, the default
+ variable type. They are stored with all the account data in the
+ `global_reg_value` table using type 3.
+"@" - A temporary variable attached to the character.
+ They disappear when the character logs out.
+"$" - A global permanent variable.
+ They are stored in database table `mapreg`.
"$@" - A global temporary variable.
- This is important for scripts which are called with no RID
+ Thhey are important for scripts which are called with no RID
attached, that is, not triggered by a specific character object.
"." - A NPC variable.
- They exist in the NPC and disappear when the server restarts or the
- NPC is reloaded. Can be accessed from inside the NPC or by calling
- 'getvariableofnpc'. Function objects can also have .variables which
- are accessible from inside the function, however 'getvariableofnpc'
- does NOT work on function objects.
+ They exist in the NPC and disappear when the server restarts or
+ the NPC is reloaded. Can be accessed from inside the NPC or by
+ calling 'getvariableofnpc'. Function objects can also have
+ .variables which are accessible from inside the function,
+ however 'getvariableofnpc' does NOT work on function objects.
".@" - A scope variable.
- They are unique to the instance and scope. Each instance has it's
- own scope that ends when the script ends. Calling a function with
- callsub/callfunc starts a new scope, returning from the function
- ends it. When a scope ends, it's variables are converted to values
- ('return .@var;' returns a value, not a reference).
-"'" - An instance variable
- These are used with the instancing system, and are unique to each
- party's instance.
+ They are unique to the instance and scope. Each instance has
+ its own scope that ends when the script ends. Calling a
+ function with callsub/callfunc starts a new scope, returning
+ from the function ends it. When a scope ends, it's variables
+ are converted to values ('return .@var;' returns a value, not a
+ reference).
+"'" - An instance variable.
+ These are used with the instancing system, and are unique to
+ each party's instance.
"#" - A permanent local account variable.
- They are stored with all the account data in "save\accreg.txt" in
- TXT versions and in the SQL versions in the 'global_reg_value'
- table using type 2.
-"##" - A permanent global account variable stored by the login server.
- They are stored in "save\account.txt" and in the SQL versions in the
- 'global_reg_value' table, using type 1. The only difference you will
- note from normal # variables is when you have multiple char-servers
- connected to the same login server. The # variables are unique to
- each char-server, while the ## variables are shared by all these
- char-servers.
+ They are stored in the 'global_reg_value' table using type 2.
+"##" - A permanent global account variable stored by the login server.
+ They are stored in the 'global_reg_value' table, using type 1.
+ The only difference you will note from normal # variables is
+ when you have multiple char-servers connected to the same
+ login-server. The # variables are unique to each char-server,
+ while the ## variables are shared by all these char-servers.
Postfix: integer or string
-nothing - integer variable, can store positive and negative numbers, but only
- whole numbers (so don't expect to do any fractional math)
-'$' - string variable, can store text
+nothing - integer variable, can store positive and negative numbers, but
+ only whole numbers (so don't expect to do any fractional math).
+'$' - string variable, can store text.
Examples:
name - permanent character integer variable
@@ -490,14 +495,15 @@ $@name$ - temporary global string variable
If a variable was never set, it is considered to equal zero for integer
variables or an empty string ("", nothing between the quotes) for string
variables. Once you set it to that, the variable is as good as forgotten
-forever, and no trace remains of it even if it was stored with character or
-account data.
+forever, and no trace remains of it even if it was stored with character
+or account data.
-Some variables are special, that is, they are already defined for you by the
-scripting engine. You can see the full list somewhere in 'db/const.txt', which
-is a file you should read, since it also allows you to replace lots of numbered
-arguments for many commands with easier to read text. The special variables most
-commonly used are all permanent character-based variables:
+Some variables are special, that is, they are already defined for you by
+the scripting engine. You can see the full list somewhere in
+'db/const.txt', which is a file you should read, since it also allows you
+to replace lots of numbered arguments for many commands with easier to
+read text. The special variables most commonly used are all permanent
+character-based variables:
Zeny - Amount of Zeny.
Hp - Current amount of hit points.
@@ -510,48 +516,51 @@ BaseLevel - Character's base level.
JobLevel - Character's job level.
BaseExp - Amount of base experience points.
JobExp - Amount of job experience points.
-NextBaseExp - Amount of base experience points needed to reach the next level.
-NextJobExp - Amount of job experience points needed to reach the next level.
+NextBaseExp - Amount of base experience points needed to reach next level.
+NextJobExp - Amount of job experience points needed to reach next level.
Weight - Amount of weight the character currently carries.
MaxWeight - Maximum weight the character can carry.
Sex - 0 if female, 1 if male.
Class - Character's job.
-Upper - 0 if the character is a normal class, 1 if advanced, 2 if baby.
+Upper - 0 if the character is normal class, 1 if advanced, 2 if baby.
BaseClass - The character's 1-1 'normal' job, regardless of Upper value.
- For example, this will return Job_Acolyte for Acolyte, Priest/Monk,
- High Priest/Champion, and Arch Bishop/Sura. If the character has not
- reached a 1-1 class, it will return Job_Novice.
+ For example, this will return Job_Acolyte for Acolyte,
+ Priest/Monk, High Priest/Champion, and Arch Bishop/Sura.
+ If the character has not reached a 1-1 class, it will return
+ Job_Novice.
BaseJob - The character's 'normal' job, regardless of Upper value.
For example, this will return Job_Acolyte for Acolyte,
Baby Acolyte, and High Acolyte.
-Karma - The character's karma. Karma system is not fully functional, but
- this doesn't mean this doesn't work at all. Not tested.
-Manner - The character's manner rating. Becomes negative if the player
- utters words forbidden through the use of 'manner.txt' client-side
- file.
-
-While these behave as variables, do not always expect to just set them - it is
-not certain whether this will work for all of them. Whenever there is a command
-or a function to set something, it's usually preferable to use that instead. The
-notable exception is Zeny, which you can and often will address directly -
-setting it will make the character own this number of Zeny.
-If you try to set Zeny to a negative number, the script will be terminated with an error.
+Karma - The character's karma. Karma system is not fully functional,
+ but this doesn't mean this doesn't work at all. Not tested.
+Manner - The character's manner rating. Becomes negative if the
+ player utters words forbidden through the use of
+ 'manner.txt' client-side file.
+
+While these behave as variables, do not always expect to just set them -
+it is not certain whether this will work for all of them. Whenever there
+is a command or a function to set something, it's usually preferable to
+use that instead. The notable exception is Zeny, which you can and often
+will address directly - setting it will make the character own this number
+of Zeny. If you try to set Zeny to a negative number, the script will be
+terminated with an error.
Assigning variables
--------- ---------
-Variables can be accessed and assigned values directly without the use of the built-in
-'set' function. This means that variables can be accessed and modified much like other
-programming languages.
+Variables can be accessed and assigned values directly without the use of
+the built-in 'set' function. This means that variables can be accessed and
+modified much like other programming languages.
@x = 100;
@x = @y = 100;
-Support for modifying variable values using 'set' is still supported (and required
-to exist for this new method to work) so previous scripts will continue to work.
+Support for modifying variable values using 'set' is still supported (and
+required to exist for this method to work) so previous scripts will
+continue working.
-When assigning values, all operator methods are supported which exist in the below
-'Operators' section. For instance:
+When assigning values, all operator methods are supported which exist in
+the below 'Operators' section. For instance:
@x += 100;
@x -= 100;
@@ -561,58 +570,59 @@ When assigning values, all operator methods are supported which exist in the bel
@x >>= 2;
@x <<= 2;
-Will all work. For more information on available operators, see the Operators section
-described below. All operators listed there may be placed in-front of the '=' sign
-when modifying variables to perform the action as required.
+Will all work. For more information on available operators, see the
+Operators section described below. All operators listed there may be
+placed in-front of the '=' sign when modifying variables to perform the
+action as required.
Note:
- !! Currently the scripting engine does not support directly copying array variables.
- !! In order to copy arrays between variables the use of 'copyarray' function is still
- !! required.
+ !! Currently the scripting engine does not support directly copying array
+ !! variables. In order to copy arrays between variables the use of
+ !! 'copyarray' function is still required.
Strings
-------
-To include symbol '"' in a string you should use prefix '\"'
+To include symbol '"' in a string you should use prefix '\"'.
Arrays
------
-Arrays (in Hercules at least) are essentially a set of variables going under the
-same name. You can tell between the specific variables of an array with an
-'array index', a number of a variable in that array:
+Arrays (in Hercules at least) are essentially a set of variables going
+under the same name. You can tell between the specific variables of an
+array with an 'array index', a number of a variable in that array:
<variable name>[<array index>]
-Variables stored in this way, inside an array, are also called 'array elements'.
-Arrays are specifically useful for storing a set of similar data (like several
-item IDs for example) and then looping through it. You can address any array
-variable as if it was a normal variable:
+Variables stored in this way, inside an array, are also called 'array
+elements'. Arrays are specifically useful for storing a set of similar
+data (like several item IDs for example) and then looping through it. You
+can address any array variable as if it was a normal variable:
set @arrayofnumbers[0],1;
-You can also do sneaky things like using a variable (or an expression, or even a
-value from an another array) to get at an array value:
+You can also do sneaky things like using a variable (or an expression, or
+even a value from an another array) to get at an array value:
set @x,100;
set @arrayofnumbers[@x],10;
This will make @arrayofnumbers[100] equal to 10.
-Notice that index numbering always starts with 0. Arrays cannot hold more than
-128 variables. (So the last one can't have a number higher than 127)
+Notice that index numbering always starts with 0. Arrays cannot hold more
+than 128 variables (so the last one can't have a number higher than 127).
-And array indexes probably can't be negative. Nobody tested what happens when
-you try to get a negatively numbered variable from an array, but it's not going
-to be pretty. :)
+And array indexes probably can't be negative. Nobody tested what happens
+when you try to get a negatively numbered variable from an array, but it's
+not going to be pretty. :)
Arrays can naturally store strings:
-@menulines$[0] is the 0th element of the @menulines$ array of strings. Notice
-the '$', normally denoting a string variable, before the square brackets that
-denotes an array index.
+@menulines$[0] is the 0th element of the @menulines$ array of strings.
+Notice the '$', normally denoting a string variable, before the square
+brackets that denotes an array index.
Resume of the allowed variable and array scopes
------ -- --- ------- -------- --- ----- ------
@@ -659,12 +669,13 @@ Variable References
Operators
---------
-Operators are things you can do to variables and numbers. They are either the
-common mathematical operations or conditional operators
+Operators are things you can do to variables and numbers. They are either
+the common mathematical operations or conditional operators:
-+ - will add two numbers. If you try to add two strings, the result will be a
- string glued together at the +. You can add a number to a string, and the
- result will be a string. No other math operators work with strings.
++ - will add two numbers. If you try to add two strings, the result will
+ be a string glued together at the +. You can add a number to a string,
+ and the result will be a string. No other math operators work with
+ strings.
- - will subtract two numbers.
* - will multiply two numbers.
/ - will divide two numbers. Note that this is an integer division, i.e.
@@ -672,20 +683,22 @@ common mathematical operations or conditional operators
% - will give you the remainder of the division. 7%2 is equal to 1.
There are also conditional operators. This has to do with the conditional
-command 'if' and they are meant to return either 1 if the condition is satisfied
-and 0 if it isn't. (That's what they call 'boolean' variables. 0 means 'False'.
-Anything except the zero is 'True' Odd as it is, -1 and -5 and anything below
-zero will also be True.)
-
-You can compare numbers to each other and you compare strings to each other, but
-you can not compare numbers to strings.
-
- == - Is true if both sides are equal. For strings, it means they are the same.
- >= - True if the first value is equal to, or greater than, the second value.
- <= - True if the first value is equal to, or less than, the second value
- > - True if the first value greater than the second value
- < - True if the first value is less than the second value
- != - True if the first value IS NOT equal to the second one
+command 'if' and they are meant to return either 1 if the condition is
+satisfied and 0 if it isn't. That's what they call 'boolean' variables. 0
+means 'False'. Anything except the zero is 'True'. Odd as it is, -1 and -5
+and anything below zero will also be True.)
+
+You can compare numbers to each other and you compare strings to each
+other, but you can not compare numbers to strings.
+
+ == - Is true if both sides are equal. For strings, it means they contain
+ the same value.
+ >= - True if the first value is equal to, or greater than, the second
+ value.
+ <= - True if the first value is equal to, or less than, the second value.
+ > - True if the first value greater than the second value.
+ < - True if the first value is less than the second value.
+ != - True if the first value IS NOT equal to the second one.
Examples:
@@ -693,9 +706,9 @@ Examples:
1<2 is True while 1>2 is False.
@x>2 is True if @x is equal to 3. But it isn't true if @x is 2.
-Only '==' and '!=' have been tested for comparing strings. Since there's no way
-to code a seriously complex data structure in this language, trying to sort
-strings by alphabet would be pointless anyway.
+Only '==' and '!=' have been tested for comparing strings. Since there's
+no way to code a seriously complex data structure in this language, trying
+to sort strings by alphabet would be pointless anyway.
Comparisons can be stacked in the same condition:
@@ -711,34 +724,38 @@ Logical bitwise operators work only on numbers, and they are the following:
<< - Left shift.
>> - Right shift.
- Left shift moves the binary 1(s) of a number n positions to the left,
- which is the same as multiplying by 2, n times.
- In the other hand, Right shift moves the binary 1(s) of a number n positions
- to the right, which is the same as dividing by 2, n times.
+ Left shift moves the binary 1(s) of a number n positions to the left,
+ which is the same as multiplying by 2, n times.
+ In the other hand, Right shift moves the binary 1(s) of a number n
+ positions to the right, which is the same as dividing by 2, n times.
Example:
set b,2;
set a, b << 3;
mes a;
set a, a >> 2;
mes a;
- The first mes command would display 16, which is the same as 2 x (2 x 2 x 2) = 16.
- The second mes command would display 4, which is the same as 16 / 2 = 8. 8 / 2 = 4.
+ The first mes command would display 16, which is the same as:
+ 2 x (2 x 2 x 2) = 16.
+ The second mes command would display 4, which is the same as:
+ 16 / 2 = 8; 8 / 2 = 4.
& - And.
| - Or.
- The bitwise operator AND (&) is used to test two values against each other,
- and results in setting bits which are active in both arguments. This can
- be used for a few things, but in Hercules this operator is usually used to
- create bit-masks in scripts.
+ The bitwise operator AND (&) is used to test two values against each
+ other, and results in setting bits which are active in both arguments.
+ This can be used for a few things, but in Hercules this operator is
+ usually used to create bit-masks in scripts.
- The bitwise operator OR (|)sets to 1 a binary position if the binary position
- of one of the numbers is 1. This way a variable can hold several values we can check,
- known as bit-mask. A variable currently can hold up to 32 bit-masks (from position 0
- to position 1). This is a cheap(skate) and easy way to avoid using arrays to store several checks
- that a player can have.
+ The bitwise operator OR (|) sets to 1 a binary position if the binary
+ position of one of the numbers is 1. This way a variable can hold
+ several values we can check, known as bit-mask. A variable currently
+ can hold up to 32 bit-masks (from position 0 to position 1). This is a
+ cheap(skate) and easy way to avoid using arrays to store several
+ checks that a player can have.
- A bit-mask basically is (ab)using the variables bits to set various options in
- one variable. With the current limit if variables it is possible to store 32
- different options in one variable (by using the bits on position 0 to 31).
+ A bit-mask basically is (ab)using the variables bits to set various
+ options in one variable. With the current limit in variables it is
+ possible to store 32 different options in one variable (by using the
+ bits on position 0 to 31).
Example(s):
- Basic example of the & operator, bit example:
@@ -746,56 +763,60 @@ Logical bitwise operators work only on numbers, and they are the following:
Why? :
10 = 2^1 + 2^3 (2 + 8), so in bits, it would be 1010
2 = 2^1 (2), so in bits (same size) it would be 0010
- The & (AND) operator sets bits which are active (1) in both arguments, so in the
- example 1010 & 0010, only the 2^1 bit is active (1) in both. Resulting in the bit
- 0010, which is 2.
+ The & (AND) operator sets bits which are active (1) in both
+ arguments, so in the example 1010 & 0010, only the 2^1 bit is
+ active (1) in both. Resulting in the bit 0010, which is 2.
- Basic example of creating and using a bit-mask:
- set @options,2|4|16; //(note: this is the same as 2+4+16, or 22)
- if (@options & 1) mes "Option 1 is activated";
+ set @options,2|4|16; // (note: this is the same as 2+4+16, or 22)
+ if (@options & 1) mes "Option 1 is activated";
if (@options & 2) mes "Option 2 is activated";
if (@options & 4) mes "Option 3 is activated";
if (@options & 8) mes "Option 4 is activated";
if (@options & 16) mes "Options 5 is activated";
- This would return the messages about option 2, 3 and 5 being shown (since we've set
- the 2,4 and 16 bit to 1).
+ This would return the messages about option 2, 3 and 5 being shown
+ (since we've set the 2,4 and 16 bit to 1).
^ - Xor.
- The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if both
- numbers have the same value in the said position. On the other hand, it
- sets to 1 if they have different values in the said binary position.
- This is another way of setting and unsetting bits in bit-masks.
+ The bitwise operator XOR (eXclusive OR) sets a binary position to 0 if
+ both numbers have the same value in the said position. On the other
+ hand, it sets to 1 if they have different values in the said binary
+ position. This is another way of setting and unsetting bits in
+ bit-masks.
Example:
- First let's set the quests that are currently in progress:
set inProgress,1|8|16; // quest 1,8 and 16 are in progress
- After playing for a bit, the player starts another quest:
if( inProgress&2 == 0 ){
- // this will set the bit for quest 2 (inProgress has that bit set to 0)
+ // this will set the bit for quest 2 (inProgress has that bit
+ // set to 0)
set inProgress,inProgress^2;
mes "Quest 2: find a newbie and be helpful to him for an hour.";
close;
}
- - After spending some time reading info on Xor's, the player finally completes quest 1:
+ - After spending some time reading info on Xor's, the player finally
+ completes quest 1:
if( inProgress&1 && isComplete ){
- // this will unset the bit for quest 1 (inProgress has that bit set to 1)
+ // this will unset the bit for quest 1 (inProgress has that
+ // bit set to 1)
set inProgress,inProgress^1;
mes "Quest 1 complete!! You unlocked the secrets of the Xor dynasty, use them wisely.";
close;
}
-Unary operators with only with a single number, which follows the operator, and
-are following:
+Unary operators with only with a single number, which follows the
+operator, and are the following:
- - Negation.
- The sign of the number will be reversed. If the number was positive, it will
- become negative and vice versa.
+ The sign of the number will be reversed. If the number was positive,
+ it will become negative and vice versa.
Example:
set .@myvar,10;
mes "Negative 10 is "+(-.@myvar);
! - Logical Not.
- Reverses the boolean result of an expression. True will become false and
- false will become true.
+ Reverses the boolean result of an expression. True will become false
+ and false will become true.
Example:
if(!callfunc("F_dosomething"))
@@ -805,15 +826,17 @@ are following:
}
~ - Bitwise Not.
- Reverses each bit in a number, also known as one's complement. Cleared bits
- are set, and set bits are cleared.
+ Reverses each bit in a number, also known as one's complement. Cleared
+ bits are set, and set bits are cleared.
Example:
- - Ensure, that quest 2 is disabled, while keeping all other active, if they are.
- set inProgress,inProgress&(~2); // same as set inProgress,inProgress&0xfffffffd
+ - Ensure, that quest 2 is disabled, while keeping all other active, if
+ they are.
+ set inProgress,inProgress&(~2);
+ // same as set inProgress,inProgress&0xfffffffd
-Ternary operators take three expressions (numbers, strings or boolean), and are
-following:
+Ternary operators take three expressions (numbers, strings or boolean),
+and are the following:
?: - Conditional operator
Very useful e.g. to replace
@@ -836,14 +859,14 @@ Within executable script code, some lines can be labels:
<label name>:
Labels are points of reference in your script, which can be used to route
-execution with 'goto', 'menu' and 'jump_zero' commands, invoked with 'doevent'
-and 'donpcevent' commands and are otherwise essential. A label's name may not be
-longer than 22 characters. (23rd is the ':'.) There is some confusion in the
-source about whether it's 22, 23 or 24 all over the place, so keeping labels
-under 22 characters could be wise. It may only contain alphanumeric characters
-and underscore. In addition to labels you name yourself, there are also some
-special labels which the script engine will start execution from if a special
-event happens:
+execution with 'goto', 'menu' and 'jump_zero' commands, invoked with
+'doevent' and 'donpcevent' commands and are otherwise essential. A label's
+name may not be longer than 22 characters. (23rd is the ':'.) There is
+some confusion in the source about whether it's 22, 23 or 24 all over the
+place, so keeping labels under 22 characters could be wise. It may only
+contain alphanumeric characters and underscore. In addition to labels you
+name yourself, there are also some special labels which the script engine
+will start execution from if a special event happens:
OnClock<hour><minute>:
OnMinute<minute>:
@@ -851,19 +874,20 @@ OnHour<hour>:
On<weekday><hour><minute>:
OnDay<month><day>:
-This will execute when the server clock hits the specified date or time. Hours
-and minutes are given in military time. ('0105' will mean 01:05 AM). Weekdays
-are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01 to 31.
-Remember the zero. :)
+This will execute when the server clock hits the specified date or time.
+Hours and minutes are given in military time. ('0105' will mean 01:05 AM).
+Weekdays are Sun,Mon,Tue,Wed,Thu,Fri,Sat. Months are 01 to 12, days are 01
+to 31. Remember the zero. :)
OnInit:
OnInterIfInit:
OnInterIfInitOnce:
-OnInit will execute every time the scripts loading is complete, including when
-they are reloaded with @reloadscript command. OnInterIfInit will execute when
-the map server connects to a char server, OnInterIfInitOnce will only execute
-once and will not execute if the map server reconnects to the char server later.
+OnInit will execute every time the scripts loading is complete, including
+when they are reloaded with @reloadscript command. OnInterIfInit will
+execute when the map server connects to a char server, OnInterIfInitOnce
+will only execute once and will not execute if the map server reconnects
+to the char server later.
OnAgitStart:
OnAgitEnd:
@@ -872,25 +896,28 @@ OnAgitStart2:
OnAgitEnd2:
OnAgitInit2:
-OnAgitStart will run whenever the server shifts into WoE mode, whether it is
-done with @agitstart GM command or with 'AgitStart' script command. OnAgitEnd
-will do likewise for the end of WoE.
+OnAgitStart will run whenever the server shifts into WoE mode, whether it
+is done with @agitstart GM command or with 'AgitStart' script command.
+OnAgitEnd will do likewise for the end of WoE.
-OnAgitInit will run when data for all castles and all guilds that hold a castle
-is received by map-server from the char-server after initial connect.
+OnAgitInit will run when data for all castles and all guilds that hold a
+castle is received by map-server from the char-server after initial
+connect.
-No RID will be attached while any of the above mentioned labels are triggered, so
-no character or account-based variables will be accessible, until you attach a
-RID with 'attachrid' (see below).
+No RID will be attached while any of the above mentioned labels are
+triggered, so no character or account-based variables will be accessible,
+until you attach a RID with 'attachrid' (see below).
-The above also applies to, the last three labels, the only difference is that
-these labels are used exclusively for WoE SE, and are called independently.
+The above also applies to, the last three labels, the only difference is
+that these labels are used exclusively for WoE SE, and are called
+independently.
OnTouch:
-This label will be executed if a trigger area is defined for the NPC object it's
-in. If it isn't present, the execution will start from the beginning of the NPC
-code. The RID of the triggering character object will be attached.
+This label will be executed if a trigger area is defined for the NPC
+object it's in. If it isn't present, the execution will start from the
+beginning of the NPC code. The RID of the triggering character object will
+be attached.
OnTouch_:
@@ -906,36 +933,37 @@ It's pretty obvious when these four special labels will be invoked.
OnPCDieEvent:
-This special label triggers when a player dies. The variable 'killerrid' is
-set to the ID of the killer.
+This special label triggers when a player dies. The variable 'killerrid'
+is set to the ID of the killer.
OnPCKillEvent:
-This special label triggers when a player kills another player. The variable
-'killedrid' is set to the ID of the player killed.
+This special label triggers when a player kills another player. The
+variable 'killedrid' is set to the ID of the player killed.
OnNPCKillEvent:
-This special label triggers when a player kills a monster. The variable
+This special label triggers when a player kills a monster. The variable
'killedrid' is set to the Class of the monster killed.
OnPCLoadMapEvent:
-This special label will trigger once a player steps in a map marked with the
-'loadevent' mapflag and attach its RID. The fact that this label requires a
-mapflag for it to work is because, otherwise, it'd be server-wide and trigger
-every time a player would change maps. Imagine the server load with 1,000 players
-(oh the pain...)
+This special label will trigger once a player steps in a map marked with
+the 'loadevent' mapflag and attach its RID. The fact that this label
+requires a mapflag for it to work is because, otherwise, it'd be
+server-wide and trigger every time a player would change maps. Imagine the
+server load with 1,000 players (oh the pain...)
-Only the special labels which are not associated with any script command are
-listed here. There are other kinds of labels which may be triggered in a similar
-manner, but they are described with their associated commands.
+Only the special labels which are not associated with any script command
+are listed here. There are other kinds of labels which may be triggered in
+a similar manner, but they are described with their associated commands.
On<label name>:
-These special labels are used with Mob scripts mostly, and script commands
-that requires you to point/link a command to a mob or another NPC, giving a label
-name to start from. The label name can be any of your liking, but must be
+These special labels are used with Mob scripts mostly, and script commands
+that requires you to point/link a command to a mob or another NPC, giving
+a label name to start from. The label name can be any of your liking, but
+must be started with "On".
Example:
@@ -954,28 +982,29 @@ Each time you kill one, that announce will appear in blue to everyone.
"Global" labels
-There's a catch with labels and doevent. If you call a label (using doevent)
-and called label is in NPC that has trigger area, that label must end with
-"Global" to work globally (i.e. if RID is outside of the trigger area, which
-usually happens since otherwise there would be no point calling the label with
-doevent, because OnTouch would do the job). For further reference look for
-npc_event in npc.c.
+There's a catch with labels and doevent. If you call a label (using
+doevent) and called label is in NPC that has trigger area, that label must
+end with "Global" to work globally (i.e. if RID is outside of the trigger
+area, which usually happens since otherwise there would be no point
+calling the label with doevent, because OnTouch would do the job). For
+further reference look for npc_event in npc.c.
Scripting commands and functions
--------------------------------
-The commands and functions are listed here in no particular order. There's a
-difference between commands and functions - commands leave no 'return value'
-which might be used in a conditional statement, as a command argument, or stored
-in a variable. Calling commands as if they were functions will sometimes work,
-but is not advised, as this can lead to some hard to track errors. Calling
-functions as if they were commands will mess up the stack, so 'return' command
-will not return correctly after this happens in a particular script.
+The commands and functions are listed here in no particular order. There's
+a difference between commands and functions - commands leave no 'return
+value' which might be used in a conditional statement, as a command
+argument, or stored in a variable. Calling commands as if they were
+functions will sometimes work, but is not advised, as this can lead to
+some hard to track errors. Calling functions as if they were commands will
+mess up the stack, so 'return' command will not return correctly after
+this happens in a particular script.
-All commands must end with a ';'. Actually, you may expect to have multiple
-commands on one line if you properly terminate them with a ';', but it's better
-if you don't, since it is not certain just whether the scripting engine will
-behave nicely if you do.
+All commands must end with a ';'. Actually, you may expect to have
+multiple commands on one line if you properly terminate them with a ';',
+but it's better if you don't, since it is not certain just whether the
+scripting engine will behave nicely if you do.
-------------------------
@@ -992,42 +1021,44 @@ From here on, we will have the commands sorted as follow:
8.- Quest Log commands.
9.- Battleground commands.
10.- Mercenary commands.
+11.- Queue commands.
+
=====================
|1.- Basic commands.|
=====================
---------------------------------------
-*mes "<string>";
+*mes "<string>"{,"<string>"..."<string>"};
-This command will displays a box on the screen for the invoking character, if no
-such box is displayed already, and will print the string specified into that
-box. There is normally no 'close' or 'next' button on this box, unless you
-create one with 'close' or 'next', and while it's open the player can't do much
-else, so it's important to create a button later. If the string is empty, it
-will show up as an empty line.
+This command will displays a box on the screen for the invoking character,
+if no such box is displayed already, and will print the string specified
+into that box. There is normally no 'close' or 'next' button on this box,
+unless you create one with 'close' or 'next', and while it's open the
+player can't do much else, so it's important to create a button later. If
+the string is empty, it will show up as an empty line.
mes "Text that will appear in the box";
-Inside the string you may put color codes, which will alter the color of the
-text printed after them. The color codes are all '^<R><G><B>' and contain three
-hexadecimal numbers representing colors as if they were HTML colors - ^FF0000 is
-bright red, ^00FF00 is bright green, ^0000FF is bright blue, ^000000 is black.
-^FF00FF is a pure magenta, but it's also a color that is considered transparent
-whenever the client is drawing windows on screen, so printing text in that color
-will have kind of a weird effect. Once you've set a text's color to something,
-you have to set it back to black unless you want all the rest of the text be in
-that color:
+Inside the string you may put color codes, which will alter the color of
+the text printed after them. The color codes are all '^<R><G><B>' and
+contain three hexadecimal numbers representing colors as if they were HTML
+colors - ^FF0000 is bright red, ^00FF00 is bright green, ^0000FF is bright
+blue, ^000000 is black. ^FF00FF is a pure magenta, but it's also a color
+that is considered transparent whenever the client is drawing windows on
+screen, so printing text in that color will have kind of a weird effect.
+Once you've set a text's color to something, you have to set it back to
+black unless you want all the rest of the text be in that color:
mes "This is ^FF0000 red ^000000 and this is ^00FF00 green, ^000000 so.";
-Notice that the text coloring is handled purely by the client. If you use non-
-English characters, the color codes might get screwed if they stick to letters
-with no intervening space. Separating them with spaces from the letters on
-either side solves the problem.
+Notice that the text coloring is handled purely by the client. If you use
+non-English characters, the color codes might get screwed if they stick to
+letters with no intervening space. Separating them with spaces from the
+letters on either side solves the problem.
-To display multiple lines of message while only using a single mes; command,
-use the script command in the following format:
+To display multiple lines of message while only using a single mes;
+command, use the script command in the following format:
mes "Line 1", "Line 2", "Line 3";
@@ -1038,19 +1069,19 @@ the relevant script file.
*next;
-This command will display a 'next' button in the message window for the
-invoking character. Clicking on it will cause the window to clear and display
-a new one. Used to segment NPC-talking, next is often used in combination with
-'mes' and 'close'.
+This command will display a 'next' button in the message window for the
+invoking character. Clicking on it will cause the window to clear and
+display a new one. Used to segment NPC-talking, next is often used in
+combination with 'mes' and 'close'.
-If no window is currently on screen, one will be created, but once the invoking
-character clicks on it, a warning is thrown on the server console and the script
-will terminate.
+If no window is currently on screen, one will be created, but once the
+invoking character clicks on it, a warning is thrown on the server console
+and the script will terminate.
mes "[Woman]";
mes "This would appear on the page";
next;
- // This is needed cause it is a new page and the top will now be blank
+ // This is needed since it is a new page and the top will now be blank
mes "[Woman]";
mes "This would appear on the 2nd page";
@@ -1058,29 +1089,31 @@ will terminate.
*close;
-This command will create a 'close' button in the message window for the invoking
-character. If no window is currently on screen, the script execution will end. This is one
-of the ways to end a speech from an NPC. Once the button is clicked, the NPC
-script execution will end, and the message box will disappear.
+This command will create a 'close' button in the message window for the
+invoking character. If no window is currently on screen, the script
+command 'end;' must be used. This is one of the ways to end a speech from
+an NPC. Once the button is clicked, the NPC script execution will end, and
+the message box will disappear.
mes "[Woman]";
- mes "I am finished talking to you, click the close button";
+ mes "I am finished talking to you, click the close button.";
close;
- mes "This command will not run at all, cause the script has ended.";
+ mes "This command will not run at all, since the script has ended.";
---------------------------------------
*close2;
-This command will create a 'close' button in the message window for the invoking
-character. WARNING: If no window is currently on screen, the script execution will halt
-indefinitely! See 'close'. There is one important difference, though - even though
-the message box will have closed, the script execution will not stop, and commands after
-'close2' will still run, meaning an 'end' has to be used to stop the script, unless you
-make it stop in some other manner.
+This command will create a 'close' button in the message window for the
+invoking character. WARNING: If no window is currently on screen, the
+script execution will halt indefinitely! See 'close'. There is one
+important difference, though - even though the message box will have
+closed, the script execution will not stop, and commands after 'close2'
+will still run, meaning an 'end' has to be used to stop the script, unless
+you make it stop in some other manner.
mes "[Woman]";
- mes "I will warp you now";
+ mes "I will warp you now.";
close2;
warp "place",50,50;
end;
@@ -1091,9 +1124,8 @@ Don't expect things to run smoothly if you don't make your scripts 'end'.
*end;
-This command will stop the execution for this particular script. The two
-versions are perfectly equivalent. It is the normal way to end a script which
-does not use 'mes'.
+This command will stop the execution for this particular script.
+It is required for any script not using 'mes'.
if (BaseLevel<=10) goto L_Lvl10;
if (BaseLevel<=20) goto L_Lvl20;
@@ -1115,20 +1147,22 @@ does not use 'mes'.
npctalk "Look at that you are almost 2nd profession";
end;
-Without the use if 'end' it would travel through the labels until the end of the
-script. If you were lvl 10 or less, you would see all the speech lines, the use
-of 'end' stops this, and ends the script.
+Without the use if 'end' it would travel through the labels until the end
+of the script. If you were lvl 10 or less, you would see all the speech
+lines, the use of 'end' stops this, and ends the script.
---------------------------------------
*set <variable>,<expression>;
*set(<variable>,<expression>)
-This command will set a variable to the value that the expression results in.
-This is the only way to set a variable directly.
+This command will set a variable to the value that the expression results
+in. This isn't the only way to set a variable directly: you can set them
+much like any other programming language as stated before (refer to the
+'Assigning variables' section).
-This is the most basic script command and is used a lot whenever you try to do
-anything more advanced than just printing text into a message box.
+This is the most basic script command and is used a lot whenever you try
+to do anything more advanced than just printing text into a message box.
set @x,100;
@@ -1136,8 +1170,8 @@ will make @x equal 100.
set @x,1+5/8+9;
-will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers are
-integer in this language) and make @x equal it.
+will compute 1+5/8+9 (which is, surprisingly, 10 - remember, all numbers
+are integer in this language) and make @x equal to it.
Returns the variable reference.
@@ -1145,8 +1179,8 @@ Returns the variable reference.
*setd "<variable name>",<value>;
-Works almost identically as set, except the variable name is identified as a string
-and can thus be constructed dynamically.
+Works almost identically as set, except the variable name is identified as
+a string and can thus be constructed dynamically.
This command is equivalent to:
set getd("variable name"),<value>;
@@ -1183,24 +1217,26 @@ This can only be used to get . variables.
Examples:
-//This will return the value of .var, note that this can't be used, since the value isn't caught.
+//This will return the value of .var, note that this can't be used, since
+//the value isn't caught.
getvariableofnpc(.var,"TargetNPC");
-//This will set the .v variable to the value of the TargetNPC's .var variable.
+//This will set the .v variable to the value of the TargetNPC's .var
+//variable.
set .v,getvariableofnpc(.var,"TargetNPC");
//This will set the .var variable of TargetNPC to 1.
set getvariableofnpc(.var,"TargetNPC"),1;
-Note: even though function objects can have .variables,
-getvariableofnpc will not work on them.
+Note: even though function objects can have .variables, getvariableofnpc
+will not work on them.
---------------------------------------
*goto <label>;
-This command will make the script jump to a label, usually used in conjunction
-with other command, such as "if", but often used on it's own.
+This command will make the script jump to a label, usually used in
+conjunction with other command, such as "if", but often used on it's own.
...
goto Label;
@@ -1208,25 +1244,25 @@ with other command, such as "if", but often used on it's own.
Label:
mes "This will be seen";
-Note by FlavioJS: goto's are "evil" and should be avoided if possible (ò_ó)
+Gotos are considered to be harmful and should be avoided whenever possible.
---------------------------------------
*menu "<option_text>",<target_label>{,"<option_text>",<target_label>,...};
-This command will create a selectable menu for the invoking character. Only one
-menu can be on screen at the same time.
+This command will create a selectable menu for the invoking character.
+Only one menu can be on screen at the same time.
-Depending on what the player picks from the menu, the script execution will
-continue from the corresponding label. (it's string-label pairs, not label-
-string)
+Depending on what the player picks from the menu, the script execution
+will continue from the corresponding label. It's string-label pairs, not
+label-string.
Options can be grouped together, separated by the character ':'.
menu "A:B",L_Wrong,"C",L_Right;
-It also sets a special temporary character variable @menu, which contains the
-number of option the player picked. (Numbering of options starts at 1.)
+It also sets a special temporary character variable @menu, which contains
+the number of option the player picked. Numbering of options starts at 1.
This number is consistent with empty options and grouped options.
menu "A::B",L_Wrong,"",L_Impossible,"C",L_Right;
@@ -1256,18 +1292,18 @@ optimize big scripts.
Both these examples will perform the exact same task.
-If you give an empty string as a menu item, the item will not display. This
-can effectively be used to script dynamic menus by using empty string for
-entries that should be unavailable at that time.
+If you give an empty string as a menu item, the item will not display.
+This can effectively be used to script dynamic menus by using empty string
+for entries that should be unavailable at that time.
You can do it by using arrays, but watch carefully - this trick isn't high
-wizardry, but minor magic at least. You can't expect to easily duplicate it
-until you understand how it works.
+wizardry, but minor magic at least. You can't expect to easily duplicate
+it until you understand how it works.
-Create a temporary array of strings to contain your menu items, and populate it
-with the strings that should go into the menu at this execution, making sure not
-to leave any gaps. Normally, you do it with a loop and an extra counter, like
-this:
+Create a temporary array of strings to contain your menu items, and
+populate it with the strings that should go into the menu at this
+execution, making sure not to leave any gaps. Normally, you do it with a
+loop and an extra counter, like this:
setarray @possiblemenuitems$[0],<list of potential menu items>;
set @j,0; // That's the menu lines counter.
@@ -1281,7 +1317,8 @@ this:
if (<condition>)
{
- // We record the option into the list of options actually available.
+ // We record the option into the list of options actually
+ // available.
set @menulist$[@j],@possiblemenuitems$[@i];
@@ -1290,8 +1327,8 @@ this:
set @menureference[@j],@i;
- // Since we've just added a menu item into the list, we increment
- // the menu lines counter.
+ // Since we've just added a menu item into the list, we
+ // increment the menu lines counter.
set @j,@j+1;
}
@@ -1299,52 +1336,55 @@ this:
// We go on to the next possible menu item.
}
-This will create you an array @menulist$ which contains the text of all items
-that should actually go into the menu based on your condition, and an array
-@menureference, which contains their numbers in the list of possible menu items.
-(Remember, arrays start with 0.) There's less of them than the possible menu
-items you've defined, but the menu command can handle the empty lines - only if
-they are last in the list, and if it's made this way, they are. Now comes a
-dirty trick:
+This will create you an array @menulist$ which contains the text of all
+items that should actually go into the menu based on your condition, and
+an array @menureference, which contains their numbers in the list of
+possible menu items. Remember, arrays start with 0. There's less of them
+than the possible menu items you've defined, but the menu command can
+handle the empty lines - only if they are last in the list, and if it's
+made this way, they are. Now comes a dirty trick:
// X is whatever the most menu items you expect to handle.
menu @menulist$[0],-,@menulist$[1],-,....@menulist$[<X>],-;
This calls up a menu of all your items. Since you didn't copy some of the
-possible menu items into the list, it's end is empty and so no menu items will
-show up past the end. But this menu call doesn't jump anywhere, it just
-continues execution right after the menu command. (And it's a good thing it
-doesn't, cause you can only explicitly define labels to jump to, and how do you
-know which ones to define if you don't know beforehand which options will end up
-where in your menu?)
+possible menu items into the list, it's end is empty and so no menu items
+will show up past the end. But this menu call doesn't jump anywhere, it
+just continues execution right after the menu command. (And it's a good
+thing it doesn't, cause you can only explicitly define labels to jump to,
+and how do you know which ones to define if you don't know beforehand
+which options will end up where in your menu?)
But how do you figure out which option the user picked? Enter the @menu.
@menu contains the number of option that the user selected from the list,
-starting with 1 for the first option. You know now which option the user picked
-and which number in your real list of possible menu items it translated to:
+starting with 1 for the first option. You know now which option the user
+picked and which number in your real list of possible menu items it
+translated to:
mes "You selected "+@possiblemenuitems$[@menureference[@menu-1]]+"!";
@menu is the number of option the user picked.
-@menu-1 is the array index for the list of actually used menu items that we
-made.
-@menureference[@menu-1] is the number of the item in the array of possible menu
-items that we've saved just for this purpose.
+@menu-1 is the array index for the list of actually used menu items that
+we made.
+@menureference[@menu-1] is the number of the item in the array of possible
+menu items that we've saved just for this purpose.
-And @possiblemenuitems$[@menureference[@menu-1]] is the string that we used to
-display the menu line the user picked. (Yes, it's a handful, but it works.)
+And @possiblemenuitems$[@menureference[@menu-1]] is the string that we
+used to display the menu line the user picked. (Yes, it's a handful, but
+it works.)
-You can set up a bunch of 'if (@menureference[@menu-1]==X) goto Y' statements to
-route your execution based on the line selected and still generate a different
-menu every time, which is handy when you want to, for example, make users select
-items in any specific order before proceeding, or make a randomly shuffled menu.
+You can set up a bunch of 'if (@menureference[@menu-1]==X) goto Y'
+statements to route your execution based on the line selected and still
+generate a different menu every time, which is handy when you want to, for
+example, make users select items in any specific order before proceeding,
+or make a randomly shuffled menu.
-Kafra code bundled with the standard distribution uses a similar array-based
-menu technique for teleport lists, but it's much simpler and doesn't use @menu,
-probably since that wasn't documented anywhere.
+Kafra code bundled with the standard distribution uses a similar
+array-based menu technique for teleport lists, but it's much simpler and
+doesn't use @menu, probably since that wasn't documented anywhere.
-See also 'select', which is probably better in this particular case. Instead of
-menu, you could use 'select' like this:
+See also 'select', which is probably better in this particular case.
+Instead of menu, you could use 'select' like this:
set @dummy,select(@menulist$[0],@menulist$[1],....@menulist$[<X>]);
@@ -1356,28 +1396,28 @@ perfectly equivalent.
*select("<option>"{,"<option>",...})
*prompt("<option>"{,"<option>",...})
-This function is a handy replacement for 'menu' for some specific cases where
-you don't want a complex label structure - like, for example, asking simple yes-
-no questions. It will return the number of menu option picked, starting with 1.
-Like 'menu', it will also set the variable @menu to contain the option the user
-picked.
+This function is a handy replacement for 'menu' for some specific cases
+where you don't want a complex label structure - like, for example, asking
+simple yes-no questions. It will return the number of menu option picked,
+starting with 1. Like 'menu', it will also set the variable @menu to
+contain the option the user picked.
if (select("Yes:No")==1) mes "You said yes, I know.";
And like 'menu', the selected option is consistent with grouped options
and empty options.
-prompt works almost the same as select, except that when a character clicks
-the Cancel button, this function will return 255 instead.
+'prompt' works almost the same as select, except that when a character
+clicks the Cancel button, this function will return 255 instead.
---------------------------------------
*input(<variable>{,<min>{,<max>}})
This command will make an input box pop up on the client connected to the
-invoking character, to allow entering of a number or a string. This has many
-uses, one example would be a guessing game, also making use of the 'rand'
-function:
+invoking character, to allow entering of a number or a string. This has
+many uses, one example would be a guessing game, also making use of the
+'rand' function:
mes "[Woman]";
mes "Try and guess the number I am thinking of.";
@@ -1398,8 +1438,9 @@ function:
close;
}
-If you give the input command a string variable to put the input in, it will
-allow the player to enter text. Otherwise, only numbers will be allowed.
+If you give the input command a string variable to put the input in, it
+will allow the player to enter text. Otherwise, only numbers will be
+allowed.
mes "[Woman]";
mes "Please say HELLO";
@@ -1419,15 +1460,15 @@ allow the player to enter text. Otherwise, only numbers will be allowed.
}
Normally you may not input a negative number with this command.
-This is done to prevent exploits in badly written scripts, which would
-let people, for example, put negative amounts of Zeny into a bank script and
+This is done to prevent exploits in badly written scripts, which would let
+people, for example, put negative amounts of Zeny into a bank script and
receive free Zeny as a result.
The command has two optional arguments and a return value.
The default value of 'min' and 'max' can be set with 'input_min_value' and
'input_max_value' in script.conf.
-For numeric inputs the value is capped to the range [min,max]. Returns 1 if
-the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
+For numeric inputs the value is capped to the range [min,max]. Returns 1
+if the value was higher than 'max', -1 if lower than 'min' and 0 otherwise.
For string inputs it returns 1 if the string was longer than 'max', -1 is
shorter than 'min' and 0 otherwise.
@@ -1436,9 +1477,9 @@ shorter than 'min' and 0 otherwise.
*callfunc "<function>"{,<argument>,...<argument>};
*callfunc("<function>"{,<argument>,...<argument>})
-This command lets you call up a function NPC. A function NPC can be called from
-any script on any map server. Using the 'return' command it will come back to
-the place that called it.
+This command lets you call up a function NPC. A function NPC can be called
+from any script on any map server. Using the 'return' command it will come
+back to the place that called it.
place,50,50,6%TAB%script%TAB%Woman%TAB%115,{
mes "[Woman]"
@@ -1454,13 +1495,13 @@ the place that called it.
end;
}
-You can pass arguments to your function - values telling it what exactly to do -
-which will be available there with getarg() (see 'getarg')
+You can pass arguments to your function - values telling it what exactly
+to do - which will be available there with getarg() (see 'getarg').
Notice that returning is not mandatory, you can end execution right there.
-If you want to return a real value from inside your function NPC, it is better
-to write it in the function form, which will also work and will make the script
-generally cleaner:
+If you want to return a real value from inside your function NPC, it is
+better to write it in the function form, which will also work and will
+make the script generally cleaner:
place,50,50,6%TAB%script%TAB%Man%TAB%115,{
mes "[Man]"
@@ -1475,8 +1516,8 @@ generally cleaner:
return 1;// it's odd
}
-Alternately, user-defined functions may be called directly without the use of
-the 'callfunc' script command.
+Alternately, user-defined functions may be called directly without the use
+of the 'callfunc' script command.
function<TAB>script<TAB>SayHello<TAB>{
mes "Hello " + getarg(0);
@@ -1492,23 +1533,24 @@ the 'callfunc' script command.
Note:
!! A user-defined function must be declared /before/ a script attempts to
- !! call it. That is to say, any functions should be placed above scripts or NPCs
- !! (or loaded in a separate file first) before attempting to call them directly.
+ !! call it. That is to say, any functions should be placed above scripts
+ !! or NPCs (or loaded in a separate file first) before attempting to call
+ !! them directly.
---------------------------------------
*callsub <label>{,<argument>,...<argument>};
*callsub(<label>{,<argument>,...<argument>})
-This command will go to a specified label within the current script (do NOT use
-quotes around it) coming in as if it were a 'callfunc' call, and pass it
-arguments given, if any, which can be recovered there with 'getarg'. When done
-there, you should use the 'return' command to go back to the point from where
-this label was called. This is used when there is a specific thing the script
-will do over and over, this lets you use the same bit of code as many times as
-you like, to save space and time, without creating extra NPC objects which are
-needed with 'callfunc'. A label is not callable in this manner from another
-script.
+This command will go to a specified label within the current script (do
+NOT use quotes around it) coming in as if it were a 'callfunc' call, and
+pass it arguments given, if any, which can be recovered there with
+'getarg'. When done there, you should use the 'return' command to go back
+to the point from where this label was called. This is used when there is
+a specific thing the script will do over and over, this lets you use the
+same bit of code as many times as you like, to save space and time,
+without creating extra NPC objects which are needed with 'callfunc'. A
+label is not callable in this manner from another script.
Example 1: callsub for checking (if checks pass, return to script)
callsub S_CheckFull, "guild_vs2",50;
@@ -1529,7 +1571,8 @@ S_CheckFull:
return;
Example 2: callsub used repeatedly, with different arguments
-// notice how the Zeny check/delete is reused, instead of copy-pasting for every warp
+// notice how the Zeny check/delete is reused, instead of copy-pasting for
+// every warp.
switch(select("Abyss Lake:Amatsu Dungeon:Anthell:Ayothaya Dungeon:Beacon Island, Pharos") {
case 1: callsub S_DunWarp,"hu_fild05",192,207;
case 2: callsub S_DunWarp,"ama_in02",119,181;
@@ -1557,14 +1600,14 @@ S_DunWarp:
*getarg(<index>{,<default_value>})
-This function is used when you use the 'callsub' or 'callfunc' commands. In the
-call you can specify variables that will make that call different from another
-one. This function will return an argument the function or subroutine was
-called with, and is the normal way to get them.
+This function is used when you use the 'callsub' or 'callfunc' commands.
+In the call you can specify variables that will make that call different
+from another one. This function will return an argument the function or
+subroutine was called with, and is the normal way to get them.
This is another thing that can let you use the same code more than once.
-Argument numbering starts with 0, i.e. the first argument you gave is number 0.
-If no such argument was given, a zero is returned.
+Argument numbering starts with 0, i.e. the first argument you gave is
+number 0. If no such argument was given, a zero is returned.
place,50,50,6%TAB%script%TAB%Woman1%TAB%115,{
mes "[Woman]";
@@ -1587,11 +1630,11 @@ If no such argument was given, a zero is returned.
if(@win==0) return;
mes "Sorry you lost";
-"woman1" NPC object calls the funcNPC. The argument it gives in this call is
-stated as 2, so when the random number is generated by the 'rand' function, it
-can only be 0 or 1. Whereas "woman2" gives 5 as the argument number 0 when
-calling the function, so the random number could be 0, 1, 2, 3 or 4, this makes
-"woman2" less likely to say the player won.
+"woman1" NPC object calls the funcNPC. The argument it gives in this call
+is stated as 2, so when the random number is generated by the 'rand'
+function, it can only be 0 or 1. Whereas "woman2" gives 5 as the argument
+number 0 when calling the function, so the random number could be 0, 1, 2,
+3 or 4, this makes "woman2" less likely to say the player won.
You can pass multiple arguments in a function call:
@@ -1599,20 +1642,20 @@ You can pass multiple arguments in a function call:
getarg(0) would be 5, getarg(1) would be 4 and getarg(2) would be 3.
-Getarg has an optional argument:
+Getarg also has an optional argument:
If the target argument exists, it is returned.
-Otherwise, if <default_value> is present it is returned instead,
-if not the script terminates immediately.
+Otherwise, if <default_value> is present it is returned instead, if not
+the script terminates immediately.
-in the previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1
+In previous example getarg(2,-1) would be 3 and getarg(3,-1) would be -1.
---------------------------------------
*getargcount()
-This function is used when you use the 'callsub' or 'callfunc' commands. In the
-call you can specify arguments. This function will return the number of arguments
-provided.
+This function is used when you use the 'callsub' or 'callfunc' commands.
+In the call you can specify arguments. This function will return the
+number of arguments provided.
Example:
callfunc "funcNPC",5,4,3;
@@ -1626,16 +1669,17 @@ Example:
*return {<value>};
-This command causes the script execution to leave previously called function
-with callfunc or script with callsub and return to the location, where the call
-originated from. Optionally a return value can be supplied, when the call was
-done using the function form.
+This command causes the script execution to leave previously called
+function with callfunc or script with callsub and return to the location,
+where the call originated from. Optionally a return value can be supplied,
+when the call was done using the function form.
-Using this command outside of functions or scripts referenced by callsub will
-result in error and termination of the script.
+Using this command outside of functions or scripts referenced by callsub
+will result in error and termination of the script.
callfunc "<your function>";// when nothing is returned
- set <variable>,callfunc("<your function>");// when a value is being returned
+ set <variable>,callfunc("<your function>");
+ // when a value is being returned
---------------------------------------
@@ -1645,8 +1689,9 @@ result in error and termination of the script.
<code>
}
-This works like callfunc, and is used for cleaner and faster scripting. The function
-must be defined and used within a script, and works like a label with arguments.
+This works like callfunc, and is used for cleaner and faster scripting.
+The function must be defined and used within a script, and works like a
+label with arguments.
Note that the name may only contain alphanumeric characters and underscore.
Usage:
@@ -1729,24 +1774,25 @@ Example:
*if (<condition>) <statement>;
-This is the basic conditional statement command, and just about the only one
-available in this scripting language.
+This is the basic conditional statement command, and just about the only
+one available in this scripting language.
-The condition can be any expression. All expressions resulting in a non-zero
-value will be considered True, including negative values. All expressions
-resulting in a zero are false.
+The condition can be any expression. All expressions resulting in a
+non-zero value will be considered True, including negative values. All
+expressions resulting in a zero are false.
-If the expression results in True, the statement will be executed. If it isn't
-true, nothing happens and we move on to the next line of the script.
+If the expression results in True, the statement will be executed. If it
+isn't true, nothing happens and we move on to the next line of the script.
if (1) mes "This will always print.";
if (0) mes "And this will never print.";
if (5) mes "This will also always print.";
if (-1) mes "Funny as it is, this will also print just fine.";
-For more information on conditional operators see the operators section above.
-Anything that is returned by a function can be used in a condition check without
-bothering to store it in a specific variable:
+For more information on conditional operators see the operators section
+above.
+Anything that is returned by a function can be used in a condition check
+without bothering to store it in a specific variable:
if (strcharinfo(0)=="Daniel Jackson") mes "It is true, you are Daniel!";
@@ -1786,7 +1832,8 @@ Example 4:
mes "[Quest Person]";
if(countitem(512)>=1) goto L_GiveApple;
- // The number 512 was found from item_db, it is the item number for the Apple.
+ // The number 512 was found from item_db, it is the item number
+ // for the Apple.
mes "Can you please bring me an apple?";
close;
L_GiveApple:
@@ -1843,7 +1890,7 @@ else
dothat;
If the condition doesn't meet, it'll do the action following the else.
-We can also group several actions depending on a condition, the following way:
+We can also group several actions depending on a condition, this way:
if (<condition)
{
@@ -1857,13 +1904,14 @@ if (<condition)
dothat4;
}
-Remember that if you plan to do several actions upon the condition being false, and
-you forget to use the curly braces (the { } ), the second action will be executed regardless
-the output of the condition, unless of course, you stop the execution of the script if the
-condition is true (that is, in the first grouping using a return; , and end; or a close; )
+Remember that if you plan to do several actions upon the condition being
+false, and you forget to use the curly braces (the { } ), the second
+action will be executed regardless the output of the condition, unless of
+course, you stop the execution of the script if the condition is true
+(that is, in the first grouping using a return; , and end; or a close; ).
-Also, you can have multiple conditions nested or chained, and don't worry about limits as to
-how many nested if you can have, there is no spoon ;)
+Also, you can have multiple conditions nested or chained, and don't worry
+about limits as to how many nested if you can have, there is no spoon ;).
...
if (<condition 1>)
@@ -1881,28 +1929,30 @@ else if (<condition 2>)
*jump_zero (<condition>),<label>;
-This command works kinda like an 'if'+'goto' combination in one go. (See 'if').
-If the condition is false (equal to zero) this command will immediately jump to
-the specified label like in 'goto'. While 'if' is more generally useful, for
-some cases this could be an optimization.
+This command works like an 'if'+'goto' combination in one go. (See 'if').
+If the condition is false (equal to zero) this command will immediately
+jump to the specified label like in 'goto'. While 'if' is more generally
+useful, for some cases this could be an optimization.
-The main reason for this command is that other control statements, like
-'switch', 'for' or 'while', are disassembled into simple expressions together
-with this command when a script is parsed.
+The main reason for this command is that other control statements, like
+'switch', 'for' or 'while', are disassembled into simple expressions
+together with this command when a script is parsed.
---------------------------------------
*while (<condition>) <statement>;
-This is probably the simplest and most frequently used loop structure. The 'while'
-statement can be interpreted as "while <condition> is true, perform <statement>".
-It is a pretest loop, meaning the conditional expression is tested before any of the
-statements in the body of the loop are performed. If the condition evaluates to
-false, the statement(s) in the body of the loop is/are never executed. If the
-condition evaluates to true, the statement(s) are executed, then control transfers
-back to the conditional expression, which is reevaluated and the cycle continues.
+This is probably the simplest and most frequently used loop structure. The
+'while' statement can be interpreted as "while <condition> is true,
+perform <statement>". It is a pretest loop, meaning the conditional
+expression is tested before any of the statements in the body of the loop
+are performed. If the condition evaluates to false, the statement(s) in
+the body of the loop is/are never executed. If the condition evaluates to
+true, the statement(s) are executed, then control transfers back to the
+conditional expression, which is reevaluated and the cycle continues.
-Multiple statements can be grouped with { }, curly braces, just like with the 'if' statement.
+Multiple statements can be grouped with { }, curly braces, just like with
+the 'if' statement.
Example 1:
while (switch(select("Yes:No") == 2 ))
@@ -1934,14 +1984,15 @@ Example 4: sentinel-controlled loop
*for (<variable initialization>; <condition>; <variable update>) <statement>;
-Another pretest looping structure is the 'for' statement. It is considered a
-specialized form of the 'while' statement, and is usually associated with counter-
-controlled loops. Here are the steps of the 'for' statement: the initialize
-statement is executed first and only once. The condition test is performed.
-When the condition evaluates to false, the rest of the for statement is skipped.
-When the condition evaluates to true, the body of the loop is executed, then the
-update statement is executed (this usually involves incrementing a variable).
-Then the condition is reevaluated and the cycle continues.
+Another pretest looping structure is the 'for' statement. It is considered
+a specialized form of the 'while' statement, and is usually associated
+with counter-controlled loops. Here are the steps of the 'for' statement:
+the initialize statement is executed first and only once. The condition
+test is performed. When the condition evaluates to false, the rest of the
+for statement is skipped. When the condition evaluates to true, the body
+of the loop is executed, then the update statement is executed (this
+usually involves incrementing a variable). Then the condition is
+reevaluated and the cycle continues.
Example 1:
for( set .@i, 1; .@i <= 5; set .@i, .@i +1 )
@@ -1956,11 +2007,11 @@ Example 2:
*do { <statement>; } while (<condition>);
-The 'do...while' is the only post-test loop structure available in this script
-language. With a post-test, the statements are executed once before the condition
-is tested. When the condition is true, the statement(s) are repeated. When the
-condition is false, control is transferred to the statement following the
-'do...while' loop expression.
+The 'do...while' is the only post-test loop structure available in this
+script language. With a post-test, the statements are executed once before
+the condition is tested. When the condition is true, the statement(s) are
+repeated. When the condition is false, control is transferred to the
+statement following the 'do...while' loop expression.
Example 1: sentinel-controlled loop
mes "This menu will keep appearing until you pick Cancel";
@@ -1980,9 +2031,9 @@ Example 2: counter-controlled loop
*freeloop(<toggle>)
-Toggling this to enabled (1) allows the script instance to bypass the infinite loop
-protection, allowing your script to loop as much as it may need. Disabling (0) will
-warn you if an infinite loop is detected.
+Toggling this to enabled (1) allows the script instance to bypass the
+infinite loop protection, allowing your script to loop as much as it may
+need. Disabling (0) will warn you if an infinite loop is detected.
Example:
freeloop(1); // enable script to loop freely
@@ -1991,7 +2042,8 @@ Example:
for ( set .@i,0; .@i<.@bigloop; set .@i, .@i+1 ) {
dothis;
// will sleep the script for 1ms when detect an infinity loop to
- // let Hercules do what it need to do (socket, timer, process, etc.)
+ // let Hercules do what it need to do (socket, timer, process,
+ // etc.)
}
freeloop(0); // disable
@@ -2005,8 +2057,8 @@ Example:
*setarray <array name>[<first value>],<value>{,<value>...<value>};
-This command will allow you to quickly fill up an array in one go. Check the
-Kafra scripts in the distribution to see this used a lot.
+This command will allow you to quickly fill up an array in one go. Check
+the Kafra scripts in the distribution to see this used a lot.
setarray @array[0], 100, 200, 300, 400, 500, 600;
@@ -2026,7 +2078,8 @@ will produce:
*cleararray <array name>[<first value to alter>],<value>,<number of values to set>;
-This command will change many array values at the same time to the same value.
+This command will change many array values at the same time to the same
+value.
setarray @array[0], 100, 200, 300, 400, 500, 600;
// This will make all 6 values 0
@@ -2042,8 +2095,8 @@ See 'setarray'.
*copyarray <destination array>[<first value>],<source array>[<first value>],<amount of data to copy>;
-This command lets you quickly shuffle a lot of data between arrays, which is in
-some cases invaluable.
+This command lets you quickly shuffle a lot of data between arrays, which
+is in some cases invaluable.
setarray @array[0], 100, 200, 300, 400, 500, 600;
// So we have made @array[]
@@ -2066,22 +2119,22 @@ New Array:
@array2[2] = 0
@array2[3] = 0
-Notice that @array[4] and @array[5] won't be copied to the second array, and it will return a
-0.
+Notice that @array[4] and @array[5] won't be copied to the second array,
+and it will return a 0.
---------------------------------------
*deletearray <array name>[<first value>],<how much to delete>;
-This command will delete a specified number of array elements totally from an
-array, shifting all the elements beyond this towards the beginning.
+This command will delete a specified number of array elements totally from
+an array, shifting all the elements beyond this towards the beginning.
- // This will delete array element 0, and move all the other array elements
- // up one place.
+ // This will delete array element 0, and move all the other array
+ // elements up one place.
deletearray @array[0],1
-// This would delete array elements numbered 1, 2 and 3, leave element 0 in its
-// place, and move the other elements ups, so there are no gaps.
+// This would delete array elements numbered 1, 2 and 3, leave element 0
+// in its place, and move the other elements ups, so there are no gaps.
deletearray @array[1],3
@@ -2094,16 +2147,16 @@ array, shifting all the elements beyond this towards the beginning.
*strcharinfo(<type>)
-This function will return either the name, party name or guild name for the
-invoking character. Whatever it returns is determined by type.
+This function will return either the name, party name or guild name for
+the invoking character. Whatever it returns is determined by type.
0 - Character's name.
1 - The name of the party they're in if any.
2 - The name of the guild they're in if any.
3 - The name of the map the character is in.
-If a character is not a member of any party or guild, an empty string will be
-returned when requesting that information.
+If a character is not a member of any party or guild, an empty string will
+be returned when requesting that information.
---------------------------------------
@@ -2123,8 +2176,8 @@ Whatever it returns is determined by type.
*getarraysize(<array name>)
This function returns the number of values that are contained inside the
-specified array. Notice that zeros and empty strings at the end of this array
-are not counted towards this number.
+specified array. Notice that zeros and empty strings at the end of this
+array are not counted towards this number.
For example:
@@ -2142,15 +2195,16 @@ This will make @arraysize == 6. But if you try this:
*getelementofarray(<array name>,<index>)
-This command retrieves the value of the element of given array at given index.
-This is equivalent to using:
+This command retrieves the value of the element of given array at given
+index. This is equivalent to using:
<array name>[<index>]
-The reason for this is, that this short form is internally converted into a call
-to getelementofarray, when the script is loaded.
+The reason for this is, that this short form is internally converted into
+a call to getelementofarray, when the script is loaded.
-Also useful when passing arrays to functions or accessing another npc's arrays:
+Also useful when passing arrays to functions or accessing another npc's
+arrays:
getelementofarray(getarg(0),<index>)
getelementofarray(getvariableofnpc(.var, "testNPC"),<index>)
@@ -2158,26 +2212,26 @@ Also useful when passing arrays to functions or accessing another npc's arrays:
*readparam(<parameter number>)
-This function will return the basic stats of an invoking character, referred to
-by the parameter number. Instead of a number, you can use a parameter name if it
-is defined in 'db/const.txt'.
+This function will return the basic stats of an invoking character,
+referred to by the parameter number. Instead of a number, you can use a
+parameter name if it is defined in 'db/const.txt'.
Example parameters:
-StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight, MaxWeight,
-JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp, Sp, MaxSp,
-BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk
+StatusPoint, BaseLevel, SkillPoint, Class, Upper, Zeny, Sex, Weight,
+MaxWeight, JobLevel, BaseExp, JobExp, NextBaseExp, NextJobExp, Hp, MaxHp,
+Sp, MaxSp, BaseJob, Karma, Manner, bVit, bDex, bAgi, bStr, bInt, bLuk
-All of these also behave as variables, but don't expect to be able to just 'set'
-them - some will not work for various internal reasons.
+All of these also behave as variables, but don't expect to be able to just
+'set' them - some will not work for various internal reasons.
Example 1:
// Returns how many status points you haven't spent yet.
mes "Unused status points: "+readparam(9);
-Using this particular information as a function call is not required. Typing this
-will return the same result:
+Using this particular information as a function call is not required.
+Typing this will return the same result:
mes "Unused status points: "+StatusPoint;
@@ -2192,8 +2246,8 @@ You can also use this command to get stat values.
*getcharid(<type>{,"<character name>"})
-This function will return a unique ID number of the invoking character, or, if a
-character name is specified, of that player.
+This function will return a unique ID number of the invoking character,
+or, if a character name is specified, of that player.
Type is the kind of associated ID number required:
@@ -2203,16 +2257,16 @@ Type is the kind of associated ID number required:
3 - Account ID number.
4 - Battle ground ID
-For most purposes other than printing it, a number is better to have than a name
-(people do horrifying things to their character names).
+For most purposes other than printing it, a number is better to have than
+a name (people do horrifying things to their character names).
-If the character is not in a party or not in a guild, the function will return 0
-if guild or party number is requested. If a name is specified and the character
-is not found, 0 is returned.
+If the character is not in a party or not in a guild, the function will
+return 0 if guild or party number is requested. If a name is specified and
+the character is not found, 0 is returned.
-If getcharid(0) returns a zero, the script got called not by a character and
-doesn't have an attached RID. Note that this will cause the map server to
-print "player not attached!" error messages, so it is preferred to use
+If getcharid(0) returns a zero, the script got called not by a character
+and doesn't have an attached RID. Note that this will cause the map server
+to print "player not attached!" error messages, so it is preferred to use
"playerattached" to check for the character attached to the script.
if( getcharid(2) == 0 ) mes "Only members of a guild are allowed here!";
@@ -2221,9 +2275,9 @@ if( getcharid(2) == 0 ) mes "Only members of a guild are allowed here!";
*getnpcid(<type>{,"<npc name>"});
-Retrieves IDs of the currently invoked NPC. If a unique npc name is
-given, IDs of that NPC are retrieved instead. Type specifies what ID
-to retrieve and can be one of the following:
+Retrieves IDs of the currently invoked NPC. If a unique npc name is given,
+IDs of that NPC are retrieved instead. Type specifies what ID to retrieve
+and can be one of the following:
0 - Unit ID (GID)
@@ -2235,7 +2289,7 @@ If an invalid type is given or the NPC does not exist, 0 is returned.
*getmotherid()
*getfatherid()
-These functions return the character ID of the attached player's child,
+These functions return the character ID of the attached player's child,
mother, mother, or father, respectively. It returns 0 if no ID is found.
if (getmotherid()) mes "Your mother's ID is: "+getmotherid();
@@ -2251,39 +2305,40 @@ currently online and 0 if they are not or if the character has no partner.
*getpartnerid()
-This function returns the character ID of the invoking character's marriage
-partner, if any. If the invoking character is not married, it will return 0,
-which is a quick way to see if they are married:
+This function returns the character ID of the invoking character's
+marriage partner, if any. If the invoking character is not married, it
+will return 0, which is a quick way to see if they are married:
- if (getpartnerid()) mes "I'm not going to be your girlfriend!";
+ if (!getpartnerid()) mes "I'm not going to be your girlfriend!";
if (getpartnerid()) mes "You're married already!";
---------------------------------------
*getpartyname(<party id>)
-This function will return the name of a party that has the specified ID number.
-If there is no such party ID, "null" will be returned.
+This function will return the name of a party that has the specified ID
+number. If there is no such party ID, "null" will be returned.
Lets say the ID of a party was saved as a global variable:
- // This would return the name of the party from the ID stored in a variable
+ // This would return the name of the party from the ID stored in a
+ // variable
mes "You're in the '"+getpartyname($@var)+"' party, I know!";
---------------------------------------
*getpartymember <party id>{,<type>};
-This command will find all members of a specified party and returns their names
-(or character id or account id depending on the value of "type") into an array
-of temporary global variables. There's actually quite a few commands like this
-which will fill a special variable with data upon execution and not do anything
-else.
+This command will find all members of a specified party and returns their
+names (or character id or account id depending on the value of "type")
+into an array of temporary global variables. There's actually quite a few
+commands like this which will fill a special variable with data upon
+execution and not do anything else.
Upon executing this,
-$@partymembername$[] is a global temporary string array which contains all the
- names of these party members
+$@partymembername$[] is a global temporary string array which contains all
+ the names of these party members.
(only set when type is 0 or not specified)
$@partymembercid[] is a global temporary number array which contains the
@@ -2296,18 +2351,19 @@ $@partymemberaid[] is a global temporary number array which contains the
$@partymembercount is the number of party members that were found.
-The party members will (apparently) be found regardless of whether they are
-online or offline. Note that the names come in no particular order.
+The party members will (apparently) be found regardless of whether they
+are online or offline. Note that the names come in no particular order.
Be sure to use $@partymembercount to go through this array, and not
-'getarraysize', because it is not cleared between runs of 'getpartymember'. If
-someone with 7 party members invokes this script, the array would have 7
-elements. But if another person calls up the NPC, and he has a party of 5, the
-server will not clear the array for you, overwriting the values instead. So in
-addition to returning the 5 member names, the 6th and 7th elements from the last
-call remain, and you will get 5+2 members, of which the last 2 don't belong to
-the new guy's party. $@partymembercount will always contain the correct number,
-(5) unlike 'getarraysize()' which will return 7 in this case.
+'getarraysize', because it is not cleared between runs of 'getpartymember'.
+If someone with 7 party members invokes this script, the array would have
+7 elements. But if another person calls up the NPC, and he has a party of
+5, the server will not clear the array for you, overwriting the values
+instead. So in addition to returning the 5 member names, the 6th and 7th
+elements from the last call remain, and you will get 5+2 members, of which
+the last 2 don't belong to the new guy's party. $@partymembercount will
+always contain the correct number, (5) unlike 'getarraysize()' which will
+return 7 in this case.
Example 1: list party member names
@@ -2315,10 +2371,10 @@ Example 1: list party member names
getpartymember getcharid(1),0;
// It's a good idea to copy the global temporary $@partymember*****
- // variables to your own scope variables because if you have pauses in this
- // script (sleep, sleep2, next, close2, input, menu, select, or prompt),
- // another player could click this NPC, trigger 'getpartymember', and
- // overwrite the $@partymember***** variables.
+ // variables to your own scope variables because if you have pauses in
+ // this script (sleep, sleep2, next, close2, input, menu, select, or
+ // prompt), another player could click this NPC, trigger
+ // 'getpartymember', and overwrite the $@partymember***** variables.
set .@count, $@partymembercount;
copyarray .@name$[0], $@partymembername$[0], $@partymembercount;
@@ -2346,10 +2402,11 @@ Example 2: check party count (with a 'next' pause), before warping to event
for ( set .@i, 0; .@i < $@partymembercount; set .@i, .@i +1 )
if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
set .@count_online, .@count_online +1 ;
- // We search accountID & charID because a single party can have multiple
- // characters from the same account. Without searching through the charID,
- // if a player has 2 characters from the same account inside the party but
- // only 1 char online, it would count their online char twice.
+ // We search accountID & charID because a single party can have
+ // multiple characters from the same account. Without searching
+ // through the charID, if a player has 2 characters from the same
+ // account inside the party but only 1 char online, it would count
+ // their online char twice.
if ( .@count_online != .register_num ) {
mes "All your party members must be online to continue";
@@ -2363,9 +2420,10 @@ Example 2: check party count (with a 'next' pause), before warping to event
next; // careful here
select "Yes";
- // When a script hits a next, menu, sleep or input that pauses the script,
- // players can invite or /leave and make changes in their party. To prevent
- // this, we call getpartymember again and compare with the original values.
+ // When a script hits a next, menu, sleep or input that pauses the
+ // script, players can invite or /leave and make changes in their
+ // party. To prevent this, we call getpartymember again and compare
+ // with the original values.
getpartymember getcharid(1), 1;
if ( $@partymembercount != .register_num ) {
@@ -2387,8 +2445,8 @@ Example 2: check party count (with a 'next' pause), before warping to event
*getpartyleader(<party id>{,<type>})
This function returns some information about the given party-id's leader.
-When type is omitted, the default information retrieved is the leader's name.
-Possible types are:
+When type is omitted, the default information retrieved is the leader's
+name. Possible types are:
1: Leader account id
2: Leader character id
@@ -2397,8 +2455,9 @@ Possible types are:
5: Leader's current level as stored on the party structure (may not be
current level if leader leveled up recently).
-If retrieval fails (leader not found or party does not exist), this function
-returns "null" instead of the character name, and -1 for the other types.
+If retrieval fails (leader not found or party does not exist), this
+function returns "null" instead of the character name, and -1 for the
+other types.
---------------------------------------
@@ -2407,16 +2466,16 @@ returns "null" instead of the character name, and -1 for the other types.
This function will return the number for the current character look value
specified by type. See 'setlook' for valid look types.
-This can be used to make a certain script behave differently for characters
-dressed in black. :)
+This can be used to make a certain script behave differently for
+characters dressed in black. :)
---------------------------------------
*getsavepoint(<information type>)
-This function will return information about the invoking character's save point.
-You can use it to let a character swap between several recorded save points.
-Available information types are:
+This function will return information about the invoking character's save
+point. You can use it to let a character swap between several recorded
+save points. Available information types are:
0 - Map name (a string)
1 - X coordinate
@@ -2426,8 +2485,9 @@ Available information types are:
*getcharip({"<character name>"|<account id>|<char id>})
-This function will return the IP address of the invoking character, or, if a player
-is specified, of that character. A blank string is returned if no player is attached.
+This function will return the IP address of the invoking character, or, if
+a player is specified, of that character. A blank string is returned if no
+player is attached.
Examples:
@@ -2445,9 +2505,9 @@ Examples:
*getequipid(<equipment slot>)
-This function returns the item ID of the item equipped in the equipment slot
-specified on the invoking character. If nothing is equipped there, it returns -1.
-Valid equipment slots are:
+This function returns the item ID of the item equipped in the equipment
+slot specified on the invoking character. If nothing is equipped there, it
+returns -1. Valid equipment slots are:
EQI_HEAD_TOP (1) - Upper head gear
EQI_ARMOR (2) - Armor (Where you keep your Jackets and Robes)
@@ -2463,8 +2523,9 @@ EQI_COSTUME_HEAD_LOW (11) - Lower Costume Headgear
EQI_COSTUME_HEAD_MID (12) - Middle Costume Headgear
EQI_COSTUME_HEAD_TOP (13) - Upper Costume Headgear
-Notice that a few items occupy several equipment slots, and if the character is
-wearing such an item, 'getequipid' will return it's ID number for either slot.
+Notice that a few items occupy several equipment slots, and if the
+character is wearing such an item, 'getequipid' will return it's ID number
+for either slot.
Can be used to check if you have something equipped, or if you haven't got
something equipped:
@@ -2476,13 +2537,15 @@ something equipped:
mes "What a lovely Tiara you have on";
close;
-You can also use it to make sure people don't pass a point before removing an
-item totally from them. Let's say you don't want people to wear Legion Plate
-armor, but also don't want them to equip if after the check, you would do this:
+You can also use it to make sure people don't pass a point before removing
+an item totally from them. Let's say you don't want people to wear Legion
+Plate armor, but also don't want them to equip if after the check, you
+would do this:
if ((getequipid(EQI_ARMOR) == 2341) || (getequipid(EQI_ARMOR) == 2342) goto L_EquipedLegionPlate;
- // the || is used as an or argument, there is 2341 and 2342 cause there are
- // two different legion plate armors, one with a slot one without.
+ // the || is used as an or argument, there is 2341 and 2342 cause
+ // there are two different legion plate armors, one with a slot one
+ // without.
if ((countitem(2341) > 0) || (countitem(2432) > 0) goto L_InventoryLegionPlate;
mes "I will lets you pass";
close2;
@@ -2499,10 +2562,11 @@ armor, but also don't want them to equip if after the check, you would do this:
*getequipname(<equpment slot>)
-Returns the jname of the item equipped in the specified equipment slot on the
-invoking character, or an empty string if nothing is equipped in that position.
-Does the same thing as getitemname(getequipid()). Useful for an NPC to state
-what your are wearing, or maybe saving as a string variable.
+Returns the jname of the item equipped in the specified equipment slot on
+the invoking character, or an empty string if nothing is equipped in that
+position.
+Does the same thing as getitemname(getequipid()). Useful for an NPC to
+state what your are wearing, or maybe saving as a string variable.
See 'getequipid' for a full list of valid equipment slots.
if( getequipname(EQI_HEAD_TOP) != "" )
@@ -2514,18 +2578,19 @@ See 'getequipid' for a full list of valid equipment slots.
*getitemname(<item id>)
-Given the database ID number of an item, this function will return the text
-stored in the 'japanese name' field (which, in Hercules, stores an English name
-the players would normally see on screen.)
+Given the database ID number of an item, this function will return the
+text stored in the 'japanese name' field (which, in Hercules, stores an
+English name the players would normally see on screen).
---------------------------------------
*getbrokenid(<number>)
-This function will search the invoking character's inventory for any broken
-items, and will return their item ID numbers. Since the character may have
-several broken items, 1 given as an argument will return the first one found, 2
-will return the second one, etc. Will return 0 if no such item is found.
+This function will search the invoking character's inventory for any
+broken items, and will return their item ID numbers. Since the character
+may have several broken items, 1 given as an argument will return the
+first one found, 2 will return the second one, etc. Will return 0 if no
+such item is found.
// Let's see if they have anything broken:
if (getbrokenid(1)==0) goto Skip;
@@ -2538,8 +2603,8 @@ will return the second one, etc. Will return 0 if no such item is found.
*getequipisequiped(<equipment slot>)
-This functions will return 1 if there is an equipment placed on the specified
-equipment slot and 0 otherwise. For a list of equipment slots
+This functions will return 1 if there is an equipment placed on the
+specified equipment slot and 0 otherwise. For a list of equipment slots
see 'getequipid'. Function originally used by the refining NPCs:
if (getequipisequiped(EQI_HEAD_TOP)) goto L_equipped;
@@ -2555,9 +2620,9 @@ see 'getequipid'. Function originally used by the refining NPCs:
*getequipisenableref(<equipment slot>)
-Will return 1 if the item equipped on the invoking character in the specified
-equipment slot is refinable, and 0 if it isn't. For a list of equipment slots
-see 'getequipid'.
+Will return 1 if the item equipped on the invoking character in the
+specified equipment slot is refinable, and 0 if it isn't. For a list of
+equipment slots see 'getequipid'.
if (getequipisenableref(EQI_HEAD_TOP)) goto L_Refine;
mes "[Refiner]";
@@ -2572,11 +2637,11 @@ see 'getequipid'.
*getequiprefinerycnt(<equipment slot>)
-Returns the current number of pluses for the item in the specified equipment
-slot. For a list of equipment slots see 'getequipid'.
+Returns the current number of pluses for the item in the specified
+equipment slot. For a list of equipment slots see 'getequipid'.
-Can be used to check if you have reached a maximum refine value, default for
-this is +10:
+Can be used to check if you have reached a maximum refine value, default
+for this is +10:
if(getequiprefinerycnt(EQI_HEAD_TOP) < 10) goto L_Refine_HeadGear;
mes "Sorry, it's not possible to refine hats better than +10";
@@ -2588,13 +2653,13 @@ this is +10:
*getequipweaponlv(<equipment slot>)
-This function returns the weapon level for the weapon equipped in the specified
-equipment slot on the invoking character. For a list of equipment slots see
-'getequipid'.
+This function returns the weapon level for the weapon equipped in the
+specified equipment slot on the invoking character. For a list of
+equipment slots see 'getequipid'.
-Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons have
-a weapon level. You can, however, probably, use this field for other equippable
-custom items as a flag or something.
+Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons
+have a weapon level. You can, however, probably, use this field for other
+equippable custom items as a flag or something.
If no item is equipped in this slot, or if it doesn't have a weapon level
according to the database, 0 will be returned.
@@ -2629,48 +2694,49 @@ Examples:
*getequippercentrefinery(<equipment slot>)
-This function calculates and returns the percent value chance to successfully
-refine the item found in the specified equipment slot of the invoking character
-by +1. There is no actual formula, the success rate for a given weapon level of
-a certain refine level is found in the db/refine_db.txt file. For a list of
-equipment slots see 'getequipid'.
+This function calculates and returns the percent value chance to
+successfully refine the item found in the specified equipment slot of the
+invoking character by +1. There is no actual formula, the success rate for
+a given weapon level of a certain refine level is found in the
+db/refine_db.txt file. For a list of equipment slots see 'getequipid'.
-These values can be displayed for the player to see, or used to calculate the
-random change of a refine succeeding or failing and then going through with it
-(which is what the official NPC refinery scripts use it for)
+These values can be displayed for the player to see, or used to calculate
+the random change of a refine succeeding or failing and then going through
+with it (which is what the official NPC refinery scripts use it for).
-// This will find a random number from 0 - 99 and if that is equal to or more
-// than the value recovered by this command it will go to L_Fail
+// This will find a random number from 0 - 99 and if that is equal to or
+// more than the value recovered by this command it will go to L_Fail
if (getequippercentrefinery(EQI_HAND_L)<=rand(100)) goto L_Fail;
---------------------------------------
*getareadropitem("<map name>",<x1>,<y1>,<x2>,<y2>,<item>)
-This function will count all the items with the specified ID number lying on the
-ground on the specified map within the x1/y1-x2/y2 square on it and return that
-number.
+This function will count all the items with the specified ID number lying
+on the ground on the specified map within the x1/y1-x2/y2 square on it and
+return that number.
-This is the only function around where a parameter may be either a string or a
-number! If it's a number, it means that only the items with that item ID number
-will be counted. If it is a string, it is assumed to mean the 'english name'
-field from the item database. If you give it an empty string, or something that
-isn't found from the item database, it will count items number '512' (apples).
+This is the only function around where a parameter may be either a string
+or a number! If it's a number, it means that only the items with that item
+ID number will be counted. If it is a string, it is assumed to mean the
+'english name' field from the item database. If you give it an empty
+string, or something that isn't found from the item database, it will
+count items number '512' (apples).
---------------------------------------
*getequipcardcnt(<equipment slot>)
-This function will return the number of cards that have been compounded onto a
-specific equipped item for the invoking character. See 'getequipid' for a list
-of possible equipment slots.
+This function will return the number of cards that have been compounded
+onto a specific equipped item for the invoking character. See 'getequipid'
+for a list of possible equipment slots.
---------------------------------------
*getinventorylist;
This command sets a bunch of arrays with a complete list of whatever the
-invoking character has in their inventory, including all the data needed to
+invoking character has in its inventory, including all the data needed to
recreate these items perfectly if they are destroyed. Here's what you get:
@inventorylist_id[] - array of item ids.
@@ -2679,33 +2745,34 @@ recreate these items perfectly if they are destroyed. Here's what you get:
@inventorylist_refine[] - for how much it is refined.
@inventorylist_identify[] - whether it is identified.
@inventorylist_attribute[] - whether it is broken.
-@inventorylist_card1[] - These four arrays contain card data for the items.
-@inventorylist_card2[] These data slots are also used to store names
-@inventorylist_card3[] inscribed on the items, so you can explicitly check
-@inventorylist_card4[] if the character owns an item made by a specific
- craftsman.
-@inventorylist_expire[] - expire time (Unix time stamp). 0 means never expires.
+@inventorylist_card1[] - These four arrays contain card data for the
+@inventorylist_card2[] items. These data slots are also used to store
+@inventorylist_card3[] names inscribed on the items, so you can
+@inventorylist_card4[] explicitly check if the character owns an item
+ made by a specific craftsman.
+@inventorylist_expire[] - expire time (Unix time stamp). 0 means never
+ expires.
@inventorylist_count - the number of items in these lists.
-This could be handy to save/restore a character's inventory, since no other
-command returns such a complete set of data, and could also be the only way to
-correctly handle an NPC trader for carded and named items who could resell them
-- since NPC objects cannot own items, so they have to store item data in
-variables and recreate the items.
+This could be handy to save/restore a character's inventory, since no
+other command returns such a complete set of data, and could also be the
+only way to correctly handle an NPC trader for carded and named items who
+could resell them - since NPC objects cannot own items, so they have to
+store item data in variables and recreate the items.
-Notice that the variables this command generates are all temporary, attached to
-the character, and integer.
+Notice that the variables this command generates are all temporary,
+attached to the character, and integer.
Be sure to use @inventorylist_count to go through these arrays, and not
-'getarraysize', because the arrays are not automatically cleared between runs
-of 'getinventorylist'.
+'getarraysize', because the arrays are not automatically cleared between
+runs of 'getinventorylist'.
---------------------------------------
*cardscnt()
-This function will return the number of cards inserted into the weapon currently
-equipped on the invoking character.
+This function will return the number of cards inserted into the weapon
+currently equipped on the invoking character.
While this function was meant for item scripts, it will work outside them:
if (cardscnt()==4) mes "So you've stuck four cards into that weapon, think you're cool now?";
@@ -2714,9 +2781,8 @@ While this function was meant for item scripts, it will work outside them:
*getrefine()
-This function will return the number of pluses the weapon currently equipped on
-the invoking character has been refined for.
-While this function was meant for item scripts, it will work outside them:
+This function will return the refine count of the equipment from which
+the function is called. This function is intended for use in item scripts.
if (getrefine()==10) mes "Wow. That's a murder weapon.";
@@ -2725,27 +2791,29 @@ While this function was meant for item scripts, it will work outside them:
*getnameditem(<item id>,"<name to inscribe>");
*getnameditem("<item name>","<name to inscribe>");
-This function is equivalent to using 'getitem', however, it will not just give
-the character an item object, but will also inscribe it with a specified
-character's name. You may not inscribe items with arbitrary strings, only with
-names of characters that actually exist. While this isn't said anywhere
-specifically, apparently, named items may not have cards in them, slots or no -
-these data slots are taken by the character ID who's name is inscribed. Only one
-remains free and it's not quite clear if a card may be there.
+This function is equivalent to using 'getitem', however, it will not just
+give the character an item object, but will also inscribe it with a
+specified character's name. You may not inscribe items with arbitrary
+strings, only with names of characters that actually exist. While this
+isn't said anywhere specifically, apparently, named items may not have
+cards in them, slots or no - these data slots are taken by the character
+ID who's name is inscribed. Only one remains free and it's not quite clear
+if a card may be there.
-This function will return 1 if an item was successfully created and 0 if it
-wasn't for whatever reason. Like 'getitem', this function will also accept an
-'english name' from the item database as an item name and will return 0 if no
-such item exists.
+This function will return 1 if an item was successfully created and 0 if
+it wasn't for whatever reason. Like 'getitem', this function will also
+accept an 'english name' from the item database as an item name and will
+return 0 if no such item exists.
---------------------------------------
*getitemslots(<item ID>)
-This function will look up the item with the specified ID number in the database
-and return the number of slots this kind of items has - 0 if they are not
-slotted. It will also be 0 for all non-equippable items, naturally, unless
-someone messed up the item database. It will return -1 if there is no such item.
+This function will look up the item with the specified ID number in the
+database and return the number of slots this kind of items has - 0 if they
+are not slotted. It will also be 0 for all non-equippable items,
+naturally, unless someone messed up the item database. It will return -1
+if there is no such item.
Example:
@@ -2756,8 +2824,8 @@ Example:
*getiteminfo(<item ID>,<type>)
-This function will look up the item with the specified ID number in the database
-and return the info set by TYPE argument.
+This function will look up the item with the specified ID number in the
+database and return the info set by TYPE argument.
It will return -1 if there is no such item.
Valid types are:
@@ -2776,10 +2844,11 @@ Check sample in doc/sample/getiteminfo.txt
*getequipcardid(<equipment slot>,<card slot>)
-Returns value from equipped item slot in the indicated slot (0, 1, 2, or 3).
+Returns value for equipped item slot in the indicated slot (0, 1, 2, or 3).
-This function returns CARD ID, 255,254,-255 (for card 0, if the item is produced).
-It's useful for when you want to check whether an item contains cards or if it's signed.
+This function returns CARD ID, 255,254,-255 (for card 0, if the item is
+produced). It's useful for when you want to check whether an item contains
+cards or if it's signed.
---------------------------------------
//
@@ -2789,10 +2858,10 @@ It's useful for when you want to check whether an item contains cards or if it's
*getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})
-This function will locate a character object, NPC object or pet's coordinates
-and place their coordinates into the variables specified when calling it. It
-will return 0 if the search was successful, and -1 if the parameters given were
-not variables or the search was not successful.
+This function will locate a character object, NPC object or pet's
+coordinates and place their coordinates into the variables specified when
+calling it. It will return 0 if the search was successful, and -1 if the
+parameters given were not variables or the search was not successful.
Type is the type of object to search for:
@@ -2804,16 +2873,16 @@ Type is the type of object to search for:
5 - Mercenary object
6 - Elemental object
-While 3 is meant to look for a monster object, no searching will be done if you
-specify type 3, and the function will always return -1.
+While 3 is meant to look for a monster object, no searching will be done
+if you specify type 3, and the function will always return -1.
The search string is optional. If it is not specified, the location of the
-invoking character will always be returned for types 0 and 2, the location of
-the NPC running this function for type 1.
-If a search string is specified, for types 0 and 1, the character or NPC with
-the specified name will be located. If type is 3, the search will locate the
-current pet of the character who's name is given in the search string, it will
-NOT locate a pet by name.
+invoking character will always be returned for types 0 and 2, the location
+of the NPC running this function for type 1.
+If a search string is specified, for types 0 and 1, the character or NPC
+with the specified name will be located. If type is 3, the search will
+locate the current pet of the character who's name is given in the search
+string, it will NOT locate a pet by name.
What a mess. Example, a working and tested one now:
@@ -2839,12 +2908,13 @@ Notice that NPC objects disabled with 'disablenpc' will still be located.
*getgmlevel()
-This function will return the (GM) level of player group the account to which the
-invoking character belongs. If this is somehow executed from a console command,
-99 will be returned, and 0 will be returned if the account has no GM level.
+This function will return the (GM) level of player group the account to
+which the invoking character belongs. If this is somehow executed from a
+console command, 99 will be returned, and 0 will be returned if the
+account has no GM level.
-This allows you to make NPC's only accessible for certain GM levels, or behave
-specially when talked to by GMs.
+This allows you to make NPC's only accessible for certain GM levels, or
+behave specially when talked to by GMs.
if (getgmlevel()) mes "What is your command, your godhood?";
if (getgmlevel()) goto Wherever;
@@ -2860,22 +2930,24 @@ invoking player belongs.
*gettimetick(<tick type>)
-This function will return the system time in UNIX epoch time (if tick type is 2)
-or the time since the start of the current day in seconds if tick type is 1.
+This function will return the system time in UNIX epoch time (if tick type
+is 2) or the time since the start of the current day in seconds if tick
+type is 1.
Passing 0 will make it return the server's tick, which is a measurement in
milliseconds used by the server's timer system. The server's tick is an
unsigned int which loops every ~50 days.
-Just in case you don't know, UNIX epoch time is the number of seconds elapsed
-since 1st of January 1970, and is useful to see, for example, for how long the
-character has been online with OnPCLoginEvent and OnPCLogoutEvent, which could allow
-you to make an 'online time counted for conviction only' jail script.
+Just in case you don't know, UNIX epoch time is the number of seconds
+elapsed since 1st of January 1970, and is useful to see, for example,
+for how long the character has been online with OnPCLoginEvent and
+OnPCLogoutEvent, which could allow you to make an 'online time counted for
+conviction only' jail script.
---------------------------------------
*gettime(<type>)
-This function will return specified information about the current system time.
+This function returns specified information about the current system time.
1 - Seconds (of a minute)
2 - Minutes (of an hour)
@@ -2894,12 +2966,12 @@ It will only return numbers.
*gettimestr(<format string>,<max length>)
-This function will return a string containing time data as specified by the
-format string.
+This function will return a string containing time data as specified by
+the format string.
-This uses the C function 'strfmtime', which obeys special format characters. For
-a full description see, for example, the description of 'strfmtime' at
-http://www.delorie.com/gnu/docs/glibc/libc_437.html
+This uses the C function 'strfmtime', which obeys special format
+characters. For a full description see, for example, the description of
+'strfmtime' at http://www.delorie.com/gnu/docs/glibc/libc_437.html
All the format characters given in there should properly work.
Max length is the maximum length of a time string to generate.
@@ -2913,10 +2985,10 @@ This will print a full date and time like 'YYYY-MM/DD HH:MM:SS'.
*getusers(<type>)
-This function will return a number of users on a map or the whole server. What
-it returns is specified by Type.
+This function will return a number of users on a map or the whole server.
+What it returns is specified by Type.
-Type can be one of the following values, which control what will be returned:
+Type can be one of the following values, which control what is returned:
0 - Count of all characters on the map of the invoking character.
1 - Count of all characters in the entire server.
@@ -2927,30 +2999,31 @@ Type can be one of the following values, which control what will be returned:
*getmapusers("<map name>")
-This function will return the number of users currently located on the specified
-map.
+This function will return the number of users currently located on the
+specified map.
-Currently being used in the PVP scripts to check if a PVP room is full of not,
-if the number returned it equal to the maximum allowed it will not let you
-enter.
+Currently being used in the PVP scripts to check if a PVP room is full of
+not, if the number returned it equal to the maximum allowed it will not
+let you enter.
---------------------------------------
*getareausers("<map name>",<x1>,<y1>,<x2>,<y2>)
-This function will return the count of connected characters which are located
-within the specified area - an x1/y1-x2/y2 square on the specified map.
+This function will return the count of connected characters which are
+located within the specified area - an x1/y1-x2/y2 square - on the
+specified map.
-This is useful for maps that are split into many buildings, such as all the
-"*_in" maps, due to all the shops and houses.
+This is useful for maps that are split into many buildings, such as all
+the "*_in" maps, due to all the shops and houses.
---------------------------------------
*getusersname;
-This command will give the invoking character a list of names of the connected
-characters (including themselves) into an NPC script message window (see 'mes')
-paging it by 10 names as if with the 'next' command.
+This command will give the invoking character a list of names of the
+connected characters (including themselves) into an NPC script message
+window (see 'mes') paging it by 10 names as if with the 'next' command.
You need to put a 'close' after that yourself.
@@ -2961,31 +3034,31 @@ You need to put a 'close' after that yourself.
---------------------------------------
*getguildname(<guild id>)
-This function returns a guild's name given an ID number. If there is no such
-guild, "null" will be returned;
+This function returns a guild's name given an ID number. If there is no
+such guild, "null" will be returned;
- // Would print what ever guild 10007 is, in my case this would return "AlcoROhics"
+ // Would print whatever guild 10007 name is.
mes "The guild "+GetGuildName(10007)+" are all nice people.";
// This will do the same as above:
set @var,10007;
mes "We have some friends in "+GetGuildName(@var)+", you know.";
-This is used all over the WoE controlling scripts. You could also use it for a
-guild-based event.
+This is used all over the WoE controlling scripts. You could also use it
+for a guild-based event.
---------------------------------------
*getguildmaster(<guild id>)
-This function return the name of the master of the guild which has the specified
-ID number. If there is no such guild, "null" will be returned.
+This function return the name of the master of the guild which has the
+specified ID number. If there is no such guild, "null" will be returned.
// Would return the guild master of guild 10007, whatever that might be.
-// In this example it would return "MissDjax" cause she owns "AlcoROhics" (10007)
mes getguildmaster(10007)+" runs "+getguildname(10007);
-Can be used to check if the character is the guild master of the specified guild.
+Can be used to check if the character is the guild master of the specified
+guild.
Maybe you want to make a room only guild masters can enter:
@@ -3006,23 +3079,25 @@ Maybe you want to make a room only guild masters can enter:
*getguildmasterid(<guild id>)
-This function will return the character ID number of the guild master of the
-guild specified by the ID. 0 if the character is not a guild master of any guild.
+This function will return the character ID number of the guild master of
+the guild specified by the ID. 0 if the character is not a guild master of
+any guild.
---------------------------------------
*getcastlename("<map name>")
-This function returns the name of the castle when given the map name for that
-castle. The data is read from 'db/castle_db.txt'.
+This function returns the name of the castle when given the map name for
+that castle. The data is read from 'db/castle_db.txt'.
---------------------------------------
*getcastledata("<map name>",<type of data>)
*setcastledata "<map name>",<type of data>,<value>;
-This function returns the castle ownership information for the castle referred
-to by its map name. Castle information is stored in `guild_castle` SQL table.
+This function returns the castle ownership information for the castle
+referred to by its map name. Castle information is stored in
+`guild_castle` SQL table.
Types of data correspond to `guild_castle` table columns:
@@ -3044,15 +3119,15 @@ Types of data correspond to `guild_castle` table columns:
16 - `visibleG6` - Is 1 if the 7th guardian is present (Knight Guardian)
17 - `visibleG7` - Is 1 if the 8th guardian is present (Knight Guardian)
-All types of data have their meaning determined by War of Emperium scripts,
-with exception of:
- - `guild_id` that is always considered ID of the guild that owns the castle,
+All types of data have their meaning determined by War of Emperium
+scripts, with exception of:
+ - `guild_id` that is always the ID of the guild that owns the castle,
- `defense` that is used in Guardians & Emperium HP calculations,
- `visibleG` that is always considered to hold guardian presence bits.
-The 'setcastledata' command will behave identically, but instead of returning
-values for the specified types of accessible data, it will alter them and cause
-them to be sent to the char-server for storage.
+The 'setcastledata' command will behave identically, but instead of
+returning values for the specified types of accessible data, it will alter
+them and cause them to be sent to the char-server for storage.
Changing Guild ID or Castle Defense will trigger additional actions, like
recalculating guardians' HP.
@@ -3062,20 +3137,22 @@ recalculating guardians' HP.
*getgdskilllv(<guild id>,<skill id>)
*getgdskilllv(<guild id>,"<skill name>")
-This function returns the level of the skill <skill id> of the guild <guild id>.
+This function returns the level of the skill <skill id> of the guild
+<guild id>.
If the guild does not have that skill, 0 is returned.
If the guild does not exist, -1 is returned.
-Refer to 'db/(pre-)re/skill_db.txt' for the full list of skills. (GD_* are guild skills)
+Refer to 'db/(pre-)re/skill_db.txt' for the full list of skills.
+GD_* are guild skills
---------------------------------------
*requestguildinfo <guild id>{,"<event label>"};
-This command requests the guild data from the char server and merrily continues
-with the execution. Whenever the guild information becomes available (which
-happens instantly if the guild information is already in memory, or later, if it
-isn't and the map server has to wait for the char server to reply) it will run
-the specified event as in a 'doevent' call.
+This command requests the guild data from the char server and merrily
+continues with the execution. Whenever the guild information becomes
+available (which happens instantly if the guild information is already in
+memory, or later, if it isn't and the map server has to wait for the char
+server to reply) it will run the specified event as in a 'doevent' call.
---------------------------------------
@@ -3097,11 +3174,12 @@ mes "You have "+getMapGuildUsers("prontera",getcharid(2))+" guild members in Pro
*getskilllv("<skill name>")
This function returns the level of the specified skill that the invoking
-character has. If they don't have the skill, 0 will be returned. The full list
-of character skills is available in 'db/(pre-)re/skill_db.txt'.
+character has. If they don't have the skill, 0 will be returned. The full
+list of character skills is available in 'db/(pre-)re/skill_db.txt'.
-There are two main uses for this function, it can check whether the character
-has a skill or not, and it can tell you if the level is high enough.
+There are two main uses for this function, it can check whether the
+character has a skill or not, and it can tell you if the level is high
+enough.
Example 1:
@@ -3138,48 +3216,35 @@ invoking character has. Here's what you get:
@skilllist_count - number of skills in the above arrays.
While 'getskillv' is probably more useful for most situations, this is the
-easiest way to store all the skills and make the character something else for a
-while. Advanced job for a day? :) This could also be useful to see how many
-skills a character has.
+easiest way to store all the skills and make the character something else
+for a while. Advanced job for a day? :) This could also be useful to see
+how many skills a character has.
---------------------------------------
*getpetinfo(<type>)
-This function will return pet information for the pet the invoking character
-currently has active. Valid types are:
+This function will return pet information for the pet the invoking
+character currently has active. Valid types are:
- 0 - Unique pet ID number as stored by the char server and distinguishing it
- from all other pets the characters actually have. This value is currently
- useless, at most you can use it to tell pets apart reliably.
- 1 - Pet class number as per 'db/pet_db.txt' - will tell you what kind of a pet it
- is.
- 2 - Pet name. Will return "null" if there's no pet.
+ 0 - Unique pet ID number as stored by the char server and distinguishing
+ it from all other pets the characters actually have. This value is
+ currently useless, at most you can use it to tell pets apart reliably.
+ 1 - Pet class number as per 'db/pet_db.txt' - will tell you what kind of
+ a pet it is.
+ 2 - Pet name. Will return "null" if there's no pet.
3 - Pet friendly level (intimacy score). 1000 is full loyalty.
4 - Pet hungry level. 100 is completely full.
5 - Pet rename flag. 0 means this pet has not been named yet.
---------------------------------------
-*gethominfo(<type>)
-
-This function works as a direct counterpart of 'getpetinfo':
- 0 - Homunculus unique ID
- 1 - Homunculus Class
- 2 - Name
- 3 - Friendly level (intimacy score). 100000 is full loyalty.
- 4 - Hungry level. 100 is completely full.
- 5 - Rename flag. 0 means this homunculus has not been named yet.
- 6 - Homunculus level
-
----------------------------------------
-
*petstat(<flag>)
Returns current pet status, all are integers except name.
Returns 0 or "" if the player doesn't have pets.
-Flags usable >>
+Flags usable:
PET_CLASS
PET_NAME
PET_LEVEL
@@ -3195,8 +3260,8 @@ Example:
This function will look up the monster with the specified ID number in the
mob database and return the info set by TYPE argument.
-It will return -1 if there is no such monster (or the type value is invalid),
-or "null" if you requested the monster's name.
+It will return -1 if there is no such monster (or the type value is
+invalid), or "null" if you requested the monster's name.
Valid types are listed in const.txt:
MOB_NAME 0
@@ -3229,8 +3294,8 @@ Check sample in doc/sample/getmonsterinfo.txt
*getmobdrops(<mob id>)
-This command will find all drops of the specified mob and return the item IDs
-and drop percentages into arrays of temporary global variables.
+This command will find all drops of the specified mob and return the item
+IDs and drop percentages into arrays of temporary global variables.
'getmobdrops' returns 1 if successful and 0 if the mob ID doesn't exist.
Upon executing this,
@@ -3244,14 +3309,15 @@ $@MobDrop_rate[] is a global temporary number array which contains the
$@MobDrop_count is the number of item drops found.
Be sure to use $@MobDrop_count to go through the arrays, and not
-'getarraysize', because the temporary global arrays are not cleared between
-runs of 'getmobdrops'. If a mob with 7 item drops is looked up, the arrays would
-have 7 elements. But if another mob is looked up and it only has 5 item drops,
-the server will not clear the arrays for you, overwriting the values instead. So
-in addition to returning the 5 item drops, the 6th and 7th elements from the
-last call remain, and you will get 5+2 item drops, of which the last 2 don't
-belong to the new mob. $@MobDrop_count will always contain the correct number
-(5), unlike 'getarraysize()' which would return 7 in this case.
+'getarraysize', because the temporary global arrays are not cleared
+between runs of 'getmobdrops'. If a mob with 7 item drops is looked up,
+the arrays would have 7 elements. But if another mob is looked up and it
+only has 5 item drops, the server will not clear the arrays for you,
+overwriting the values instead. So in addition to returning the 5 item
+drops, the 6th and 7th elements from the last call remain, and you will
+get 5+2 item drops, of which the last 2 don't belong to the new mob.
+$@MobDrop_count will always contain the correct number (5), unlike
+'getarraysize()' which would return 7 in this case.
Example:
@@ -3259,9 +3325,10 @@ Example:
input .@mob_id;
if (getmobdrops(.@mob_id)) { // 'getmobdrops' returns 1 on success
- // immediately copy global temporary variables into scope variables,
- // since we don't know when 'getmobdrops' will get called again for
- // another mob, overwriting your global temporary variables
+ // immediately copy global temporary variables into scope
+ // variables, since we don't know when 'getmobdrops' will get
+ // called again for another mob, overwriting your global temporary
+ // variables.
set .@count, $@MobDrop_count;
copyarray .@item[0],$@MobDrop_item[0],.@count;
copyarray .@rate[0],$@MobDrop_rate[0],.@count;
@@ -3279,14 +3346,16 @@ Example:
*skillpointcount()
-Returns the total amount of skill points a character possesses (SkillPoint+SP's used in skills)
-This command can be used to check the currently attached characters total amount of skill points.
-This means the skill points used in skill are counted, and added to SkillPoints (number of skill points not used).
+Returns the total amount of skill points a character possesses
+(SkillPoint+SP's used in skills) This command can be used to check the
+currently attached characters total amount of skill points. This means the
+skill points used in skill are counted, and added to SkillPoints (number
+of skill points not used).
Example:
-//This will set the temp character variable @skillPoints to the amount of skill points,
-//and then tell the player the value.
+//This will set the temp character variable @skillPoints to the amount of
+//skill points, and then tell the player the value.
set @skillPoints, skillPointCount();
mes "You have "+@skillPoints+" skill points in total!";
@@ -3294,20 +3363,21 @@ Example:
if (skillPointCount() > 20)
mes "Wow, you have more then 20 Skill Points in total!";
-This command does not count skills which are set as flag 3 (permamently granted) (e.g. ALL_BUYING_STORE/ALL_INCCARRY)
+This command does not count skills which are set as flag 3 (permamently
+granted) (e.g. ALL_BUYING_STORE/ALL_INCCARRY).
---------------------------------------
*getscrate(<effect type>,<base rate>{,<GID>})
-This function will return the chance of a status effect affecting the invoking
-character, in percent, modified by the their current defense against said
-status. The 'base rate' is the base chance of the status effect being inflicted,
-in percent.
+This function will return the chance of a status effect affecting the
+invoking character, in percent, modified by the their current defense
+against said status. The 'base rate' is the base chance of the status
+effect being inflicted, in percent.
if (rand(100) > getscrate(Eff_Blind, 50)) goto BlindHimNow;
-You can see the full list of available effect types you can possibly inflict in
-'db/const.txt' under 'Eff_'.
+You can see the full list of available effect types you can possibly
+inflict in 'db/const.txt' under 'Eff_'.
---------------------------------------
@@ -3318,19 +3388,20 @@ You can see the full list of available effect types you can possibly inflict in
*playerattached()
-Returns the ID of the player currently attached to the script. It will return
-0 if no one is attached, or if the attached player no longer exists on the map
-server. It is wise to check for the attached player in script functions that
-deal with timers as there's no guarantee the player will still be logged on
-when the timer triggers. Note that the ID of a player is actually their
-account ID.
+Returns the ID of the player currently attached to the script. It will
+return 0 if no one is attached, or if the attached player no longer exists
+on the map server. It is wise to check for the attached player in script
+functions that deal with timers as there's no guarantee the player will
+still be logged on when the timer triggers. Note that the ID of a player
+is actually their account ID.
---------------------------------------
*isloggedin(<account id>{,<char id>})
-This function returns 1 if the specified account is logged in and 0 if they
-aren't. You can also pass the char_id to check for both account and char id.
+This function returns 1 if the specified account is logged in and 0 if
+they aren't. You can also pass the char_id to check for both account and
+char id.
---------------------------------------
@@ -3338,11 +3409,11 @@ aren't. You can also pass the char_id to check for both account and char id.
*checkweight("<item name>",<amount>{,"<item name>",<amount>,"<item name>",<amount>,...});
*checkweight2(<id_array>,<amount_array>);
-These functions will compute and return 1 if the total weight of the specified
-number of specific items does not exceed the invoking character's carrying
-capacity, and 0 otherwise. It is important to see if a player can carry the
-items you expect to give them, failing to do that may open your script up to
-abuse or create some very unfair errors.
+These functions will compute and return 1 if the total weight of the
+specified number of specific items does not exceed the invoking
+character's carrying capacity, and 0 otherwise. It is important to see if
+a player can carry the items you expect to give them, failing to do that
+may open your script up to abuse or create some very unfair errors.
The second function will check an array of items and amounts, and also
returns 1 on success and 0 on failure.
@@ -3375,12 +3446,12 @@ Example 2:
*basicskillcheck()
This function will return the state of the configuration option
-'basic_skill_check' in 'battle.conf'. It returns 1 if the option is
-enabled and 0 if it isn't. If the 'basic_skill_check' option is enabled, which
-it is by default, characters must have a certain number of basic skill levels to
-sit, request a trade, use emotions, etc. Making your script behave differently
-depending on whether the characters must actually have the skill to do all these
-things might in some cases be required.
+'basic_skill_check' in 'battle.conf'. Returns 1 if the option is enabled
+and 0 if it isn't. If the 'basic_skill_check' option is enabled, which it
+is by default, characters must have a certain number of basic skill levels
+to sit, request a trade, use emotions, etc. Making your script behave
+differently depending on whether the characters must actually have the
+skill to do all these things might in some cases be required.
---------------------------------------
@@ -3389,12 +3460,13 @@ things might in some cases be required.
*checkoption2(<option number>)
*setoption <option number>{,<flag>};
-The 'setoption' series of functions check for a so-called option that is set on
-the invoking character. 'Options' are used to store status conditions and a lot
-of other non-permanent character data of the yes-no kind. For most common cases,
-it is better to use 'checkcart','checkfalcon','checkpeco' and other similar
-functions, but there are some options which you cannot get at this way. They
-return 1 if the option is set and 0 if the option is not set.
+The 'setoption' series of functions check for a so-called option that is
+set on the invoking character. 'Options' are used to store status
+conditions and a lot of other non-permanent character data of the yes-no
+kind. For most common cases, it is better to use 'checkcart',
+'checkfalcon', 'checkpeco' and other similar functions, but there are some
+options which you cannot get at this way. They return 1 if the option is
+set and 0 if the option is not set.
Option numbers valid for the first (option) version of this command are:
@@ -3431,21 +3503,24 @@ Option numbers valid for the third version (opt2) of this command are:
0x1 - Poisoned.
0x2 - Cursed.
0x4 - Silenced.
-0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no visible effects are displayed)
+0x8 - Signum Crucis (plays a howl-like sound effect, but otherwise no
+ visible effects are displayed)
0x10 - Blinded.
0x80 - Deadly poisoned.
-Option numbers (except for opt1) are bit-masks - you can add them up to check
- for several states, but the functions will return true if at least one of them
- is in effect.
+Option numbers (except for opt1) are bit-masks - you can add them up to
+check for several states, but the functions will return true if at least
+one of them is in effect.
-'setoption' will set options on the invoking character. There are no second and
-third versions of this command, so you can only change the values in the first
-list (cloak, cart, ruwach, etc). if flag is 1 (default when omitted),
-the option will be added to what the character currently has; if 0, the option is removed.
+'setoption' will set options on the invoking character. There are no
+second and third versions of this command, so you can only change the
+values in the first list (cloak, cart, ruwach, etc). If flag is 1 (default
+when omitted), the option will be added to what the character currently
+has; if 0, the option is removed.
-This is definitely not a complete list of available option flag numbers. Ask a
-core developer (or read the source: src/map/status.h) for the full list.
+This is definitely not a complete list of available option flag numbers.
+Ask a core developer (or read the source: src/map/status.h) for the full
+list.
---------------------------------------
@@ -3456,10 +3531,10 @@ If <type> is 0 this command will remove the cart from the character.
Otherwise it gives the invoking character a cart. The cart given will be
cart number <type> and will work regardless of whether the character is a
merchant class or not.
-Note: the character needs to have the skill MC_PUSHCART to gain a cart
+Note: the character needs to have the skill MC_PUSHCART to gain a cart.
-The accompanying function will return 1 if the invoking character has a cart
-(any kind of cart) and 0 if they don't.
+The accompanying function will return 1 if the invoking character has a
+cart (any kind of cart) and 0 if they don't.
if (checkcart()) mes "But you already have a cart!";
@@ -3469,13 +3544,13 @@ The accompanying function will return 1 if the invoking character has a cart
*checkfalcon()
If <flag> is 0 this command will remove the falcon from the character.
-Otherwise it gives the invoking character a falcon. The falcon will be there
-regardless of whether the character is a hunter or not. It will (probably) not
-have any useful effects for non-hunters though.
-Note: the character needs to have the skill HT_FALCON to gain a falcon
+Otherwise it gives the invoking character a falcon. The falcon will be
+there regardless of whether the character is a hunter or not. It will
+(probably) not have any useful effects for non-hunters though.
+Note: the character needs to have the skill HT_FALCON to gain a falcon.
-The accompanying function will return 1 if the invoking character has a falcon
-and 0 if they don't.
+The accompanying function will return 1 if the invoking character has a
+falcon and 0 if they don't.
if (checkfalcon()) mes "But you already have a falcon!";
@@ -3486,13 +3561,13 @@ and 0 if they don't.
If <flag> is 0 this command will remove the mount from the character.
Otherwise it gives the invoking character a PecoPeco (if they are a Knight
-series class), a GrandPeco (if they are a Crusader series class), or
-a Gryphon (if they are a Royal Guard). Unlike 'setfalcon' and 'setcart'
+series class), a GrandPeco (if they are a Crusader series class), or
+a Gryphon (if they are a Royal Guard). Unlike 'setfalcon' and 'setcart'
this will not work at all if they aren't of a class which can ride.
-Note: the character needs to have the skill KN_RIDING to gain a mount
+Note: the character needs to have the skill KN_RIDING to gain a mount.
-The accompanying function will return 1 if the invoking character is riding a
-bird and 0 if they aren't.
+The accompanying function will return 1 if the invoking character is
+riding a bird and 0 if they aren't.
if (checkriding()) mes "PLEASE leave your bird outside! No riding birds on the floor here!";
@@ -3501,8 +3576,8 @@ bird and 0 if they aren't.
*setdragon {<color>};
*checkdragon()
-The 'setdragon' function toggles mounting a dragon for the invoking character.
-It will return 1 if successful, 0 otherwise.
+The 'setdragon' function toggles mounting a dragon for the invoking
+character. It will return 1 if successful, 0 otherwise.
If the character can mount a dragon, the <color> options are:
1 - Green Dragon (default when omitted)
@@ -3511,10 +3586,11 @@ If the character can mount a dragon, the <color> options are:
4 - Blue Dragon
5 - Red Dragon
-Note: the character must be a Rune Knight and have the skill RK_DRAGONTRAINING to gain a mount
+Note: the character must be a Rune Knight and have the skill
+ RK_DRAGONTRAINING to gain a mount.
-The accompanying function will return 1 if the invoking character is riding a
-dragon and 0 if they aren't.
+The accompanying function will return 1 if the invoking character is
+riding a dragon and 0 if they aren't.
---------------------------------------
@@ -3524,7 +3600,7 @@ dragon and 0 if they aren't.
If <flag> is 0 this command will remove the mount from the character.
Otherwise it gives the invoking character a Mado (if they are a Mechanic).
-The accompanying function will return 1 if the invoking character has a
+The accompanying function will return 1 if the invoking character has a
Mado and 0 if they don't.
---------------------------------------
@@ -3535,17 +3611,18 @@ Mado and 0 if they don't.
The 'setmounting' function toggles cash mount for the invoking character.
It will return 1 if successful, 0 otherwise.
-Note: Character must not be mounting a non-cash mount (eg. dragon, peco, wug, etc.)
+Note: Character must not be mounting a non-cash mount (eg. dragon, peco,
+ wug, etc.)
-The accompanying function will return 1 if the invoking character has a
+The accompanying function will return 1 if the invoking character has a
cash mount and 0 if they don't.
---------------------------------------
*checkwug()
-This function will return 1 if the invoking character has a
-warg and 0 if they don't.
+This function will return 1 if the invoking character has a warg and 0 if
+they don't.
---------------------------------------
@@ -3563,8 +3640,8 @@ Return values for 'checkvending' are
'checkchatting' returns 1 if they are in a chat room, 0 if they are not.
Examples:
- //This will check if Aaron is vending, and if so, put a message in front
- //of the attached player saying Aaron is vending.
+ //This will check if Aaron is vending, and if so, put a message in
+ //front of the attached player saying Aaron is vending.
if (checkvending("Aaron"))
mes "Aaron is currently vending!";
@@ -3576,27 +3653,27 @@ Examples:
*checkidle({"<Player Name>"})
- Returns the time, in seconds, that the specified player has been idle.
- Name is optional, and defaults to the attached player if omitted.
+Returns the time, in seconds, that the specified player has been idle.
+Name is optional, and defaults to the attached player if omitted.
---------------------------------------
*agitcheck()
*agitcheck2()
-These function will let you check whether the server is currently in WoE mode
-(or WoE SE mode if the second function is called) and will return 1 if War of
-Emperium is on and 0 if it isn't.
+These function will let you check whether the server is currently in WoE
+mode (or WoE SE mode if the second function is called) and will return 1
+if War of Emperium is on and 0 if it isn't.
---------------------------------------
*isnight()
*isday()
-These functions will return 1 or 0 depending on whether the server is in night
-mode or day mode. 'isnight' returns 1 if it's night and 0 if it isn't, 'isday'
-the other way around. They can be used interchangeably, pick the one you like
-more:
+These functions will return 1 or 0 depending on whether the server is in
+night mode or day mode. 'isnight' returns 1 if it's night and 0 if it
+isn't, 'isday' the other way around. They can be used interchangeably,
+pick the one you like more:
// These two are equivalent:
if (isday()) mes "I only prowl in the night.";
@@ -3606,8 +3683,9 @@ more:
*checkre(<type>)
-Checks if a renewal feature is enabled or not in renewal.h, and returns 1 if enabled and 0 for disabled.
-The renewal feature to check is determined by type.
+Checks if a renewal feature is enabled or not in renewal.h, and returns 1
+if enabled and 0 for disabled. The renewal feature to check is determined
+by the type parameter.
0 - RENEWAL (game renewal server mode)
1 - RENEWAL_CAST (renewal cast time)
@@ -3625,9 +3703,10 @@ The renewal feature to check is determined by type.
*isequipped(<id>{,<id>{,<id>{,<id>}}})
This function will return 1 if the invoking character has all of the item
-IDs given equipped (if card IDs are passed, then it checks if the cards are
-inserted into slots in the equipment they are currently wearing). Theoretically
-there is no limit to the number of items that may be tested for at the same time.
+IDs given equipped (if card IDs are passed, then it checks if the cards
+are inserted into slots in the equipment they are currently wearing).
+Theoretically there is no limit to the number of items that may be tested
+for at the same time.
If even one of the items given is not equipped, 0 will be returned.
// (Poring,Santa Poring,Poporing,Marin)
@@ -3635,15 +3714,16 @@ If even one of the items given is not equipped, 0 will be returned.
// (Poring)
if (isequipped(4001)) mes "A poring card is useful, don't you think?";
-The function was meant for item scripts to support the cards released by Gravity
-in February 2005, but it will work just fine in normal NPC scripts.
+The function was meant for item scripts to support the cards released by
+Gravity in February 2005, but it will work just fine in normal NPC scripts.
---------------------------------------
*isequippedcnt(<card id>{,<card id>{,<card id>{,<card id>}}})
-This function is similar to 'isequipped', but instead of 1 or 0, it will return
-the number of cards in the list given that were found on the invoking character.
+This function is similar to 'isequipped', but instead of 1 or 0, it will
+return the number of cards in the list given that were found on the
+invoking character.
if (isequippedcnt(4001,4005,4033,4196) == 4) mes "Finally got all four poring cards?";
@@ -3651,19 +3731,19 @@ the number of cards in the list given that were found on the invoking character.
*checkequipedcard(<card id>)
-This function will return 1 if the card specified by it's item ID number is
-inserted into any equipment they have in their inventory, currently equipped or
-not.
+This function will return 1 if the card specified by it's item ID number
+is inserted into any equipment they have in their inventory, currently
+equipped or not.
---------------------------------------
*getequipisidentify(<equipment slot>)
This function will return 1 if an item in the specified equipment slot is
-identified and 0 if it isn't. Since you can't even equip unidentified equipment,
-there's a question of whether it can actually end up there, and it will normally
-return 1 all the time if there is an item in this equipment slot.
-Which is kinda pointless.
+identified and 0 if it isn't. Since you can't even equip unidentified
+equipment, there's a question of whether it can actually end up there, and
+it will normally return 1 all the time if there is an item in this
+equipment slot, which makes this script command kinda pointless.
For a list of equipment slots see 'getequipid'.
---------------------------------------
@@ -3680,12 +3760,12 @@ For a list of equipment slots see 'getequipid'.
*attachrid(<account ID>)
*detachrid;
-These commands allow the manipulation of the script's currently attached player.
-While attachrid allows attaching of a different player by using it's account id
-for the parameter rid, detachrid makes the following commands run, as if the
-script was never invoked by a player.
+These commands allow the manipulation of the script's currently attached
+player. While attachrid allows attaching of a different player by using
+its account id for the parameter rid, detachrid makes the following
+commands run as if the script was never invoked by a player.
-In case, that the player cannot be attached, such as, when the player went
+In case, that the player cannot be attached, such as, when the player went
offline in the mean time, attachrid returns 0, otherwise 1.
---------------------------------------
@@ -3693,25 +3773,27 @@ offline in the mean time, attachrid returns 0, otherwise 1.
*rid2name(<rid>)
Converts rid to name. Note: The player/monster/NPC must be online/enabled.
-Good for PCKillEvent where you can convert 'killedrid' to the name of the player.
+Good for PCKillEvent where you can convert 'killedrid' to the name of the
+player.
-Note: rid2name may not produce correct character names since rid = account id.
+Note: rid2name may not produce correct character names since rid means
+ account id.
It will return the current online character of the account only.
---------------------------------------
*message "<character name>","<message>";
-That command will send a message to the chat window of the character specified
-by name. The text will also appear above the head of that character. It will not
-be seen by anyone else.
+That command will send a message to the chat window of the character
+specified by name. The text will also appear above the head of that
+character. It will not be seen by anyone else.
---------------------------------------
*dispbottom "<message>";
-This command will send the given message into the invoking character's chat
-window.
+This command will send the given message into the invoking character's
+chat window.
---------------------------------------
@@ -3722,18 +3804,18 @@ wanted, specified coordinates too, but these can be random.
warp "place",50,55;
-This would take them to X 50 Y 55 on the map called "place". If your X and Y
-coordinates land on an unwalkable map square, it will send the warped character
-to a random place. Same will happen if they are both zero:
+This would take them to X 50 Y 55 on the map called "place". If your X and
+Y coordinates land on an unwalkable map square, it will send the warped
+character to a random place. Same will happen if they are both zero:
warp "place",0,0;
-Notice that while warping people to coordinates 0,0 will normally get them into
-a random place, it's not certain to always be so. Darned if I know where this is
-actually coded, it might be that this happens because square 0,0 is unwalkable
-on all official maps. If you're using custom maps, beware.
+Notice that while warping people to coordinates 0,0 will normally get them
+into a random place, it's not certain to always be so. Darned if I know
+where this is actually coded, it might be that this happens because square
+0,0 is unwalkable on all official maps. Beware if you're using custom maps.
-There are also three special 'map names' you can use.
+There are also three special 'map names' you can use:
"Random" will warp the player randomly on the current map.
"Save" and "SavePoint" will warp the player back to their save point.
@@ -3742,29 +3824,31 @@ There are also three special 'map names' you can use.
*areawarp "<from map name>",<x1>,<y1>,<x2>,<y2>,"<to map name>",<x3>,<y3>{,<x4>,<y4>};
-This command is similar to 'warp', however, it will not refer to the invoking
-character, but instead, all characters within a specified area, defined by the
-x1/y1-x2/y2 square, will be warped. Nobody outside the area will be affected,
-including the activating character, if they are outside the area.
+This command is similar to 'warp', however, it will not refer to the
+invoking character, but instead, all characters within a specified area,
+defined by the x1/y1-x2/y2 square, will be warped. Nobody outside the area
+will be affected, including the activating character, if they are outside
+the area.
areawarp "place",10,10,120,120,"place2",150,150;
-Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a square
-shape, on the map called "place", will be affected, and warped to "place2" X 150
-Y 150
+Everyone that is in the area between X 10 Y 10 and X 120 Y 120, in a
+square shape, on the map called "place", will be affected, and warped to
+"place2" X 150 Y 150.
areawarp "place",10,10,120,120,"place2",0,0;
-By using ,0,0; as the destination coordinates it will take all the characters in
-the affected area to a random set of co-ordinates on "place2".
+By using ,0,0; as the destination coordinates it will take all the
+characters in the affected area to a random set of co-ordinates on the
+"place2" map.
areawarp "place",10,10,120,120,"place2",150,150,200,200;
-By using the optional x4 and y4 parameters, the destination coordinates will be a
-random place within the defined x3/y3-x4/y4 square.
+By using the optional x4 and y4 parameters, the destination coordinates
+will be a random place within the defined x3/y3-x4/y4 square.
-Like 'warp', areawarp will also explicitly warp characters randomly into the
-current map if you give the 'to map name' as "Random".
+Like 'warp', areawarp will also explicitly warp characters randomly into
+the current map if you give the 'to map name' as "Random".
See also 'warp'.
@@ -3772,19 +3856,23 @@ See also 'warp'.
*warpparty "<to_mapname>",<x>,<y>,<party_id>,{"<from_mapname>"};
-Warps a party to specified map and coordinate given the party ID, which you can get with
-getcharid(1). You can also request another party id given a member's name with getcharid(1,<player_name>).
+Warps a party to specified map and coordinate given the party ID, which
+you can get with getcharid(1). You can also request another party id given
+a member's name with getcharid(1,<player_name>).
You can use the following "map names" for special warping behavior:
-Random: All party members are randomly warped in their current map (as if they
- all used a fly wing)
+Random: All party members are randomly warped in their current map
+ (as if they all used a fly wing).
SavePointAll: All party members are warped to their respective save point.
-SavePoint: All party members are warped to the save point of the currently
- attached player (will fail if there's no player attached).
-Leader: All party members are warped to the leader's position. The leader must
- be online and in the current map-server for this to work.
-
-If you specify a from_mapname, warpparty will only affect those on that map.
+SavePoint: All party members are warped to the save point of the
+ currently attached player (will fail if there's no player
+ attached).
+Leader: All party members are warped to the leader's position. The
+ leader must be online and in the current map-server for this
+ to work.
+
+If you specify a from_mapname, warpparty will only affect those on that
+map.
Example:
@@ -3799,9 +3887,10 @@ close;
*warpchar "<mapname>",<x>,<y>,<char_id>;
-Warps another player to specified map and coordinate given the char id, which you can get with
-getcharid(0,<player_name>). Obviously this is useless if you want to warp the same player that
-is executing this script, unless it's some kind of "chosen" script.
+Warps another player to specified map and coordinate given the char id,
+which you can get with getcharid(0,<player_name>). Obviously this is
+useless if you want to warp the same player that is executing this script,
+unless it's some kind of "chosen" script.
Example:
@@ -3811,15 +3900,17 @@ warpchar "prontera",150,100,150001;
*warpguild "<mapname>",<x>,<y>,<guild_id>;
-Warps a guild to specified map and coordinate given the guild id, which you can get with
-getcharid(2). You can also request another guild id given the member's name with getcharid(2,<player_name>).
+Warps a guild to specified map and coordinate given the guild id, which
+you can get with getcharid(2). You can also request another guild id given
+the member's name with getcharid(2,<player_name>).
You can use the following "map names" for special warping behavior:
-Random: All guild members are randomly warped in their current map (as if they
- all used a fly wing)
+Random: All guild members are randomly warped in their current map
+ (as if they all used a fly wing)
SavePointAll: All guild members are warped to their respective save point.
-SavePoint: All guild members are warped to the save point of the currently
- attached player (will fail if there's no player attached).
+SavePoint: All guild members are warped to the save point of the
+ currently attached player (will fail if there's no player
+ attached).
Example:
@@ -3829,11 +3920,11 @@ warpguild "prontera",x,y,Guild_ID;
*warppartner("<map name>",<x>,<y>);
-This function will find the invoking character's marriage partner, if any, and
-warp them to the map and coordinates given. Go kidnap that spouse. :) It will
-return 1 upon success and 0 if the partner is not online, the character is not
-married, or if there's no invoking character (no RID). 0,0 will, as usual,
-normally translate to random coordinates.
+This function will find the invoking character's marriage partner, if any,
+and warp them to the map and coordinates given. Go kidnap that spouse. :)
+It will return 1 upon success and 0 if the partner is not online, the
+character is not married, or if there's no invoking character (no RID).
+0,0 will, as usual, normally translate to random coordinates.
---------------------------------------
@@ -3841,10 +3932,10 @@ normally translate to random coordinates.
*save "<map name>",<x>,<y>;
This command saves where the invoking character will return to upon
-'return to save point', if dead or in some other cases. The two versions are
-equivalent. Map name, X coordinate and Y coordinate should be perfectly obvious.
-This ignores any and all map flags, and can make a character respawn where no
-teleportation is otherwise possible.
+'return to save point', if dead or in some other cases. The two versions
+are equivalent. Map name, X coordinate and Y coordinate should be
+perfectly obvious. This ignores any and all map flags, and can make a
+character respawn where no teleportation is otherwise possible.
savepoint "place",350,75;
@@ -3852,7 +3943,8 @@ teleportation is otherwise possible.
*heal <hp>,<sp>;
-This command will heal a set amount of HP and/or SP on the invoking character.
+This command will heal a set amount of HP and/or SP on the invoking
+character.
heal 30000,0; // This will heal 30,000 HP
heal 0,30000; // This will heal 30,000 SP
@@ -3865,13 +3957,14 @@ character and produces no other output whatsoever.
*itemheal <hp>,<sp>;
-This command heals given absolute amounts of HP and/or SP on the invoking
-character. Unlike heal, this command is intended for use in item scripts. It
-applies potion-related bonuses, such as alchemist ranking, cards and status
-changes. When used inside an NPC script, certain bonuses are omitted.
+This command heals given absolute amounts of HP and/or SP on the invoking
+character. Unlike heal, this command is intended for use in item scripts.
+It applies potion-related bonuses, such as alchemist ranking, cards and
+status changes. When used inside an NPC script, certain bonuses are
+omitted.
-There is also a nice example on using this with the 'rand' function, to give you
-a random amount of healing.
+There is also a nice example on using this with the 'rand' function, to
+give you a random amount of healing.
// This will heal anything thing from 100 to 150 HP and no SP
itemheal rand(100,150),0;
@@ -3880,22 +3973,23 @@ a random amount of healing.
*percentheal <hp>,<sp>;
-This command will heal the invoking character. It heals the character, but not
-by a set value - it adds percent of their maximum HP/SP.
+This command will heal the invoking character. It heals the character, but
+not by a set value - it adds percent of their maximum HP/SP.
percentheal 100,0; // This will heal 100% HP
percentheal 0,100; // This will heal 100% SP
percentheal 50,50; // This will heal 50% HP and 50% SP
-So the amount that this will heal will depend on the total amount of HP or SP
-you have maximum. Like 'heal', this will not call up any animations or effects.
+So the amount that this will heal will depend on the total amount of HP or
+SP you have maximum. Like 'heal', this will not call up any animations or
+effects.
---------------------------------------
*recovery;
-This command will revive and restore full HP and SP to all characters currently
-connected to the server.
+This command will revive and restore full HP and SP to all characters
+currently connected to the server.
---------------------------------------
@@ -3906,8 +4000,8 @@ This command will change the job class of the invoking character.
jobchange 1; // This would change your player into a Swordman
jobchange 4002; // This would change your player into a Swordman High
-This command does work with numbers, but you can also use job names. The full
-list of job names and the numbers they correspond to can be found in
+This command does work with numbers, but you can also use job names. The
+full list of job names and the numbers they correspond to can be found in
'db/const.txt'.
// This would change your player into a Swordman
@@ -3915,23 +4009,24 @@ list of job names and the numbers they correspond to can be found in
// This would change your player into a Swordman High
jobchange Job_Swordman_High;
-'upper flag' can alternatively be used to specify the type of job one changes
-to. For example, jobchange Job_Swordman,1; will change the character to a high
-swordsman. The upper values are:
+'upper flag' can alternatively be used to specify the type of job one
+changes to. For example, jobchange Job_Swordman,1; will change the
+character to a high swordsman. The upper values are:
-1 (or when omitted): preserves the current job type.
0: Normal/standard classes
1: High/Advanced classes
2: Baby classes
This command will also set a permanent character-based variable
-'jobchange_level' which will contain the job level at the time right before
-changing jobs, which can be checked for later in scripts.
+'jobchange_level' which will contain the job level at the time right
+before changing jobs, which can be checked for later in scripts.
---------------------------------------
*jobname (<job number>)
-This command retrieves the name of the given job using the messages.conf entries 550->650.
+This command retrieves the name of the given job using the messages.conf
+entries 550 to 650.
mes "[Kid]";
mes "I never thought I'd met a "+jobname(Class)+" here of all places.";
@@ -3941,11 +4036,12 @@ This command retrieves the name of the given job using the messages.conf entries
*eaclass ({<job number>})
-This commands returns the "eA job-number" corresponding to the given class, and
-uses the invoking player's class if none is given. The eA job-number is also a
-class number system, but it's one that comes with constants which make it easy
-to convert among classes. The command will return -1 if you pass it a job number
-which doesn't have an eA job-number equivalent.
+This commands returns the "eA job-number" corresponding to the given
+class, and uses the invoking player's class if none is given. The eA
+job-number is also a class number system, but it's one that comes with
+constants which make it easy to convert among classes. The command will
+return -1 if you pass it a job number which doesn't have an eA job-number
+equivalent.
set @eac, eaclass();
if ((@eac&EAJ_BASEMASK) == EAJ_SWORDMAN)
@@ -3955,17 +4051,19 @@ which doesn't have an eA job-number equivalent.
if ((@eac&EAJ_UPPERMASK) == EAJ_SWORDMAN)
mes "You must be a Swordman, Baby Swordman or High Swordman.";
-For more information on the eA Job System, see the docs/ea_job_system.txt file.
+For more information on the eA Job System, see the docs/ea_job_system.txt
+file.
---------------------------------------
*roclass <job number> {,<gender>}
-Does the opposite of eaclass. That is, given an eA job-number, it returns the
-corresponding RO class number. A gender is required because both Bard and Dancers
-share the same eA job-number (EAJ_BARDDANCER), and uses the invoking player's
-gender if none is given (if no player is attached, male will be used by default).
-The command will return -1 if there is no valid class to represent the specified
-job (for example, if you try to get the baby version of a Taekwon class).
+Does the opposite of eaclass. That is, given an eA job-number, it returns
+the corresponding RO class number. A gender is required because both Bard
+and Dancers share the same eA job-number (EAJ_BARDDANCER), and uses the
+invoking player's gender if none is given (if no player is attached,
+male will be used by default). The command will return -1 if there is no
+valid class to represent the specified job (for example, if you try to get
+the baby version of a Taekwon class).
set @eac, eaclass();
//Check if class is already rebirth
@@ -3984,8 +4082,8 @@ job (for example, if you try to get the baby version of a Taekwon class).
*changebase <job ID number>;
-This command will change the appearance of the invoking character to that of a
-specified job class. Nothing but appearance will change.
+This command will change the appearance of the invoking character to that
+of a specified job class. Nothing but appearance will change.
Examples:
@@ -4000,33 +4098,34 @@ changebase Class; // Changes player back to default sprite.
*classchange <view id>,<type>;
This command is very ancient, it's origins are clouded in mystery.
-It will send a 'display id change' packet to everyone in the immediate area of
-the NPC object, which will supposedly make the NPC look like a different sprite,
-an NPC sprite ID, or a monster ID. This effect is not stored anywhere and will
-not persist (Which is odd, cause it would be relatively easy to make it do so)
-and most importantly, will not work at all since this command was broken with
-the introduction of advanced classes. The code is written with the assumption
-that the lowest sprite IDs are the job sprites and the anything beyond them is
-monster and NPC sprites, but since the advanced classes rolled in, they got the
-ID numbers on the other end of the number pool where monster sprites float.
+It will send a 'display id change' packet to everyone in the immediate
+area of the NPC object, which will supposedly make the NPC look like a
+different sprite, an NPC sprite ID, or a monster ID. This effect is not
+stored anywhere and will not persist (Which is odd, cause it would be
+relatively easy to make it do so) and most importantly, will not work at
+all since this command was broken with the introduction of advanced
+classes. The code is written with the assumption that the lowest sprite
+IDs are the job sprites and the anything beyond them is monster and NPC
+sprites, but since the advanced classes rolled in, they got the ID numbers
+on the other end of the number pool where monster sprites float.
-As a result it is currently impossible to call this command with a valid view
-id. It will do nothing whatsoever if the view ID is below 4047. Getting it to
-run will actually just crash the client.
+As a result it is currently impossible to call this command with a valid
+view id. It will do nothing whatsoever if the view ID is below 4047.
+Getting it to run will actually just crash the client.
-It could be a real gem if it can be gotten to actually do what it's supposed to
-do, but this will only happen in a later SVN revision.
+It could be a real gem if it can be gotten to actually do what it's
+supposed to do, but this will only happen in a later Git revision.
---------------------------------------
*changesex;
-This command will change the gender for the attached character's account. If it
-was male, it will become female, if it was female, it will become male. The
-change will be written to the character server, the player will receive the
-message: "Need disconnection to perform change-sex request..." and the player
-will be immediately kicked to the login screen. When they log back in, they will
-be the opposite sex.
+This command will change the gender for the attached character's account.
+If it was male, it will become female, if it was female, it will become
+male. The change will be written to the character server, the player will
+receive the message: "Need disconnection to perform change-sex request..."
+and the player will be immediately kicked to the login screen. When they
+log back in, they will be the opposite sex.
If there are any Dancer/Gypsy or Bard/Clown characters on the account,
they will also have their skills reset upon 'changesex'.
@@ -4035,12 +4134,14 @@ they will also have their skills reset upon 'changesex'.
*getexp <base xp>,<job xp>;
-This command will give the invoking character a specified number of base and job
-experience points. Can be used as a quest reward. Negative values won't work.
+This command will give the invoking character a specified number of base
+and job experience points. Can be used as a quest reward. Negative values
+won't work.
getexp 10000,5000;
-You can also use the "set" command with the constants defined in 'db/const.txt':
+You can also use the "set" command with the constants defined in
+'db/const.txt':
// These 2 combined has the same effect as the above command
set BaseExp,BaseExp+10000;
@@ -4050,8 +4151,9 @@ You can also reduce the amount of experience points:
set BaseExp,BaseExp-10000;
-Note that 'getexp' is now subject to the 'quest_exp_rate' config option, which
-adjusts the gained value. If you want to bypass this, use the 'set' method.
+Note that 'getexp' is now subject to the 'quest_exp_rate' config option,
+which adjusts the gained value. If you want to bypass this, use the 'set'
+method.
---------------------------------------
@@ -4059,18 +4161,20 @@ adjusts the gained value. If you want to bypass this, use the 'set' method.
*changelook <look type>,<look value>;
'setlook' will alter the look data for the invoking character. It is used
-mainly for changing the palette used on hair and clothes: you specify which look
-type you want to change, then the palette you want to use. Make sure you specify
-a palette number that exists/is usable by the client you use.
-'changelook' works the same, but is only client side (it doesn't save the look value).
+mainly for changing the palette used on hair and clothes: you specify
+which look type you want to change, then the palette you want to use. Make
+sure you specify a palette number that exists/is usable by the client you
+use. 'changelook' works the same, but is only client side (it doesn't save
+the look value).
- // This will change your hair(6), so that it uses palette 8, what ever your
- // palette 8 is, your hair will use that color
+ // This will change your hair(6), so that it uses palette 8, what ever
+ // your palette 8 is, your hair will use that color.
setlook 6,8;
- // This will change your clothes(7), so they are using palette 1, whatever
- // your palette 1 is, your clothes will then use that set of colors.
+ // This will change your clothes(7), so they are using palette 1,
+ // whatever your palette 1 is, your clothes will then use that set of
+ // colors.
setlook 7,1;
@@ -4087,37 +4191,39 @@ Here are the possible look types:
8 - Shield
9 - Shoes
-Whatever 'shoes' means is anyone's guess, ask Gravity - the client does nothing
-with this value. It still wants it from the server though, so it is kept, but
-normally doesn't do a thing.
+Whatever 'shoes' means is anyone's guess, ask Gravity - the client does
+nothing with this value. It still wants it from the server though, so it
+is kept, but normally doesn't do a thing.
-Only the look data for hairstyle, hair color and clothes color are saved to the
-char server's database and will persist. The rest freely change as the character
-puts on and removes equipment, changes maps, logs in and out and otherwise you
-should not expect to set them. In fact, messing with them is generally
-hazardous, do it at your own risk, it is not tested what will this actually do -
-it won't cause database corruption and probably won't cause a server crash, but
-it's easy to crash the client with just about anything unusual.
+Only the look data for hairstyle, hair color and clothes color are saved
+to the char server's database and will persist. The rest freely change as
+the character puts on and removes equipment, changes maps, logs in and out
+and otherwise you should not expect to set them. In fact, messing with
+them is generally hazardous, do it at your own risk, it is not tested
+what will this actually do - it won't cause database corruption and
+probably won't cause a server crash, but it's easy to crash the client
+with just about anything unusual.
However, it might be an easy way to quickly check for empty view IDs for
sprites, which is essential for making custom headgear.
Since a lot of people have different palettes for hair and clothes, it's
-impossible to tell you what all the color numbers are. If you want a serious
-example, there is a Stylist script inside the default Hercules installation that
-you can look at: 'npc/custom/stylist.txt'
+impossible to tell you what all the color numbers are. If you want a
+serious example, there is a Stylist script inside the default Hercules
+installation that you can look at: 'npc/custom/stylist.txt'
---------------------------------------
*pushpc <direction>,<cells>;
-This command will push the currently attached player to given direction by given
-amount of square cells. Direction is the same as used when declaring NPCs, and
-can be specified by using one of the DIR_* constants (db/const.txt).
+This command will push the currently attached player to given direction by
+given amount of square cells. Direction is the same as used when declaring
+NPCs, and can be specified by using one of the DIR_* constants
+(db/const.txt).
-The knock-back is not restricted by items or map flags, only obstacles are taken
-into account. If there is not enough space to perform the push (e.g. due to a
-wall), the character is pushed only up to the obstacle.
+The knock-back is not restricted by items or map flags, only obstacles are
+taken into account. If there is not enough space to perform the push (e.g.
+due to a wall), the character is pushed only up to the obstacle.
// pushes the character 5 cells in 3 o'clock direction from it's
// current position.
@@ -4127,9 +4233,9 @@ wall), the character is pushed only up to the obstacle.
*get_version()
-This command will return the SVN revision number or Git SHA-1 hash that the server
-is currently running on (depends on whether you used a SVN or Git client for
-getting Hercules.
+This command will return the SVN revision number or Git SHA-1 hash the
+server is currently running on (depends on whether you used a SVN or Git
+client for getting Hercules).
if ( get_version() >= 15000 )
mes "Welcome Hercules!";
@@ -4149,78 +4255,84 @@ If <account ID> is not specified, items will be created in the invoking
character inventory instead.
In the first and most commonly used version of this command, items are
-referred to by their database ID number found inside 'db/(pre-)re/item_db.txt'.
+referred to by their database ID number found in 'db/(pre-)re/item_db.txt'.
getitem 502,10 // The person will receive 10 apples
getitem 617,1 // The person will receive 1 Old Violet Box
-Giving an item ID of -1 will give a specified number of random items from the
-list of those that fall out of Old Blue Box. Unlike in all other cases, these
-will be unidentified, if they turn out to be equipment. This is exactly what's
-written in the Old Blue Box's item script.
+Giving an item ID of -1 will give a specified number of random items from
+the list of those that fall out of Old Blue Box. Unlike in all other
+cases, these will be unidentified, if they turn out to be equipment. This
+is exactly what's written in the Old Blue Box's item script.
-Other negative IDs also correspond to other random item generating item tables:
+Other negative IDs also correspond to other random item generating item
+tables:
Giving an item ID of -2 will produce the effects of Old Violet Box.
Giving an item ID of -3 will produce the effects of Old Card Album.
Giving an item ID of -4 will produce the effects of Gift Box.
-Giving an item ID of -5 will produce the effects of Worn Out Scroll, which, in
-current SVN, drops only Jellopies anyway.
+Giving an item ID of -5 will produce the effects of Worn Out Scroll,
+which, in current Git, drops only Jellopies anyway.
-This transaction is logged if the log script generated transactions option is
-enabled.
+This transaction is logged if the log script generated transactions option
+is enabled.
-You may also create an item by it's name in the 'english name' field in the
-item database:
+You may also create an item by it's name in the 'english name' field in
+the item database:
getitem "RED_POTION",10;
-Which will do what you'd expect. If it can't find that name in the database,
-apples will be created anyway. It is often a VERY GOOD IDEA to use it like this.
+Which will do what you'd expect. If it can't find that name in the
+database, apples will be created anyway. It is often a VERY GOOD IDEA to
+use it like this.
This is used in pretty much all NPC scripts that have to do with items and
-quite a few item scripts. For more examples check just about any official script.
+quite a few item scripts. For more examples check just about any official
+script.
---------------------------------------
*getitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
*getitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
-This command will give an amount of specified items to the invoking character.
-If an optional account ID is specified, and the target character is currently
-online, items will be created in their inventory instead. If they are not
-online, nothing will happen. It works essentially the same as 'getitem' (it even
-works for negative ID numbers the same way) but is a lot more flexible.
+This command will give an amount of specified items to the invoking
+character. If an optional account ID is specified, and the target
+character is currently online, items will be created in their inventory
+instead. If they are not online, nothing will happen. It works essentially
+the same as 'getitem' (it even works for negative ID numbers the same way)
+but is a lot more flexible.
Those parameters that are different from 'getitem' are:
identify - Whether you want the item to be identified (1) or not (0).
-refine - For how many pluses will it be refined.
- It will not let you refine an item higher than the max refine.
+refine - For how many pluses will it be refined. It will not let you
+ refine an item higher than the max refine.
attribute - Whether the item is broken (1) or not (0).
-card1,2,3,4 - If you want a card compound to it, place the card ID number into
- the specific card slot.
+card1,2,3,4 - If you want a card compound to it, place the card ID number
+ into the specific card slot.
-Card1-card4 values are also used to store name information for named items, as
-well as the elemental property of weapons and armor. You can create a named item
-in this manner, however, if you just need a named piece of standard equipment,
-it is much easier to the 'getnameditem' function instead.
+Card1-card4 values are also used to store name information for named
+items, as well as the elemental property of weapons and armor. You can
+create a named item in this manner, however, if you just need a named
+piece of standard equipment, it is much easier to the 'getnameditem'
+function instead.
-You will need to keep these values if you want to destroy and then perfectly
-recreate a named item, for this see 'getinventorylist'.
+You will need to keep these values if you want to destroy and then
+perfectly recreate a named item, for this see 'getinventorylist'.
If you still want to try creating a named item with this command because
-'getnameditem' won't do it for you cause it's too limited, you can do it like
-this. Careful, minor magic ahead.
+'getnameditem' won't do it for you cause it's too limited, you can do it
+like this. Careful, minor magic ahead.
- // First, let's get an ID of a character who's name will be on the item.
- // Only an existing character's name may be there.
+ // First, let's get an ID of a character who's name will be on the
+ // item. Only an existing character's name may be there.
// Let's assume our character is 'Adam' and find his ID.
set @charid,getcharid(0,"Adam");
- // Now we split the character ID number into two portions with a binary
- // shift operation. If you don't understand what this does, just copy it.
+ // Now we split the character ID number into two portions with a
+ // binary shift operation. If you don't understand what this does,
+ // just copy it.
set @card3, @charid & 65535;
set @card4, @charid >> 16;
@@ -4265,15 +4377,15 @@ To create equipment, continue this example it like this:
getitem2 1216,1,1,2,0,@card1,@card2,@card3,@card4;
-Experiment with the number of star crumbs - I'm not certain just how much will
-work most and what it depends on. The valid element numbers are:
+Experiment with the number of star crumbs - I'm not certain just how much
+will work most and what it depends on. The valid element numbers are:
1 - Ice, 2 - Earth 3 - Fire 4 - Wind.
You can, apparently, even create duplicates of the same pet egg with this
-command, creating a pet which is the same, but simultaneously exists in two
-eggs, and may hatch from either, although, I'm not sure what kind of a mess will
-this really cause.
+command, creating a pet which is the same, but simultaneously exists in
+two eggs, and may hatch from either, although, I'm not sure what kind of a
+mess will this really cause.
---------------------------------------
@@ -4282,15 +4394,16 @@ this really cause.
Create an item signed with the given character's name.
-The command returns 1 when the item is created successfully, or 0 if it fails.
-Failure occurs when:
+The command returns 1 when the item is created successfully, or 0 if it
+fails. Failure occurs when:
- There is no player attached.
- Item name or ID is not valid.
- The given character ID/name is offline.
Example:
-//This will give the currently attached player a Aaron's Apple (if Aaron is online).
+//This will give the currently attached player a Aaron's Apple (if Aaron
+//is online).
getnameditem "Apple","Aaron";
//Self-explanatory (I hope).
@@ -4303,13 +4416,15 @@ Example:
*rentitem <item id>,<time>;
*rentitem "<item name>",<time>;
-Creates a rental item in the attached character's inventory. The item will expire
-in <time> seconds and be automatically deleted. When receiving a rental item,
-the character will receive a message in their chat window. The character will
-also receive warning messages in their chat window before the item disappears.
+Creates a rental item in the attached character's inventory. The item will
+expire in <time> seconds and be automatically deleted. When receiving a
+rental item, the character will receive a message in their chat window.
+The character will also receive warning messages in their chat window
+before the item disappears.
-This command can not be used to rent stackable items. Rental items cannot be
-dropped, traded, sold to NPCs, or placed in guild storage. (i.e. trade mask 75)
+This command can not be used to rent stackable items. Rental items cannot
+be dropped, traded, sold to NPCs, or placed in guild storage (i.e. trade
+mask 75).
Note: 'delitem' in an NPC script can still remove rental items.
---------------------------------------
@@ -4326,26 +4441,27 @@ specified location.
X - The X coordinate
Y - The Y coordinate.
-This item will still disappear just like any other dropped item. Like 'getitem',
-it also accepts an 'english name' field from the database and creates apples if
-the name isn't found.
-If the map name is given as "this", the map the invoking character is on will be used.
+This item will still disappear just like any other dropped item. Like
+'getitem', it also accepts an 'english name' field from the database and
+creates apples if the name isn't found.
+If the map name is given as "this", the map the invoking character is on
+will be used.
---------------------------------------
*cleanarea "<map name>",<x1>,<y1>,<x2>,<y2>;
*cleanmap "<map name>";
-These commands will clear all items lying on the ground on the specified map, either
-within the x1/y1-x2/y2 rectangle or across the entire map.
+These commands will clear all items lying on the ground on the specified
+map, either within the x1/y1-x2/y2 rectangle or across the entire map.
---------------------------------------
*searchitem <array name>,"<item name>";
-This command will fill the given array with the ID of items whose name matches
-the given one. It returns the number of items found. For performance reasons,
-the results array is limited to 10 items.
+This command will fill the given array with the ID of items whose name
+matches the given one. It returns the number of items found. For
+performance reasons, the results array is limited to 10 items.
mes "What item are you looking for?";
input @name$;
@@ -4360,25 +4476,28 @@ the results array is limited to 10 items.
*delitem <item id>,<amount>{,<account ID>};
*delitem "<item name>",<amount>{,<account ID>};
-This command will remove a specified amount of items from the invoking/target character.
-Like all the item commands, it uses the item ID found inside 'db/(pre-)re/item_db.txt'.
+This command will remove a specified amount of items from the invoking or
+target character. Like all the item commands, it uses the item ID found
+inside 'db/(pre-)re/item_db.txt'.
delitem 502,10; // The person will lose 10 apples
delitem 617,1; // The person will lose 1 Old Violet Box
-It is always a good idea to check if the player actually has the items before you delete them.
-If you try to delete more items that the player has, the player will lose the ones he/she has
-and the script will be terminated with an error.
+It is always a good idea to check if the player actually has the items
+before you delete them. If you try to delete more items that the player
+has, the player will lose the ones he/she has and the script will be
+terminated with an error.
-Like 'getitem' this command will also accept an 'english name' field from the
-database. If the name is not found, nothing will be deleted.
+Like 'getitem' this command will also accept an 'english name' field from
+the database. If the name is not found, nothing will be deleted.
---------------------------------------
*delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
*delitem2 "<item name>",<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>};
-This command will remove a specified amount of items from the invoking/target character.
+This command will remove a specified amount of items from the invoking or
+target character.
Check 'getitem2' to understand its expanded parameters.
---------------------------------------
@@ -4386,8 +4505,8 @@ Check 'getitem2' to understand its expanded parameters.
*countitem(<item id>)
*countitem("<item name>")
-This function will return the number of items for the specified item ID that the
-invoking character has in the inventory.
+This function will return the number of items for the specified item ID
+that the invoking character has in the inventory.
mes "[Item Checker]";
mes "Hmmm, it seems you have "+countitem(502)+" apples";
@@ -4408,21 +4527,23 @@ adding up strings:
*countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
*countitem2("<item name>",<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>)
-Expanded version of 'countitem' function, used for created/carded/forged items.
+Expanded version of 'countitem' function, used for created/carded/forged
+items.
-This function will return the number of items for the specified item ID and
-other parameters that the invoking character has in the inventory.
+This function will return the number of items for the specified item ID
+and other parameters that the invoking character has in the inventory.
Check 'getitem2' to understand the arguments of the function.
---------------------------------------
*groupranditem <group id>;
-Returns the item_id of a random item picked from the group specified. The
-different groups and their group number are specified in 'db/(pre-)re/item_group_db.txt'.
+Returns the item_id of a random item picked from the group specified. The
+different groups and their group number are specified in
+'db/(pre-)re/item_group_db.txt'.
-When used in conjunction with other functions, you can get a random item. For
-example, for a random pet lure:
+When used in conjunction with other functions, you can get a random item.
+For example, for a random pet lure:
getitem groupranditem(15),1;
@@ -4430,9 +4551,10 @@ getitem groupranditem(15),1;
*getrandgroupitem <group id>,<quantity>;
-Similar to the above example, this command allows players to obtain the specified
-quantity of a random item from the group "<group id>". The different groups and
-their group number are specified in db/(pre-)re/item_group_db.txt
+Similar to the above example, this command allows players to obtain the
+specified quantity of a random item from the group "<group id>". The
+different groups and their group number are specified in
+db/(pre-)re/item_group_db.txt
For example, obtaining three of the same random item from Old Blue Box:
@@ -4443,29 +4565,33 @@ getrandgroupitem(1,3);
*enable_items;
*disable_items;
-These commands enable/disable changing of equipments while an NPC is running. When disable_items is
-run, equipments cannot be changed during scripts until enable_items is called or the script has terminated.
-To avoid possible exploits, when disable_items is invoked, it will only disable
-changing equips while running that script in particular. Note that if a different
-script also calls disable_items, it will override the last call (so you may
-want to call this command at the start of your script without assuming the
-effect is still in effect).
-If 'item_enabled_npc' option is set to Yes in 'items.conf' all NPC are allowing changing of equipment by default
-except for those have been set with 'disable_items'.
+These commands enable/disable changing of equipments while an NPC is
+running. When disable_items is run, equipments cannot be changed during
+scripts until enable_items is called or the script has terminated. To
+avoid possible exploits, when disable_items is invoked, it will only
+disable changing equips while running that script in particular. Note that
+if a different script also calls disable_items, it will override the last
+call (so you may want to call this command at the start of your script
+without assuming the effect is still in effect).
+If 'item_enabled_npc' option is set to Yes in 'items.conf' all NPC are
+allowing changing of equipment by default except for those have been set
+with 'disable_items'.
---------------------------------------
*itemskill <skill id>,<skill level>,{flag};
*itemskill "<skill name>",<skill level>,{flag};
-This command meant for item scripts to replicate single-use skills in usable
-items. It will not work properly if there is a visible dialog window or menu.
-If the skill is self or auto-targeting it will be used immediately otherwise a
-target cursor is shown.
-Flag is a optional param and when present the command will not check for skill requirements
+This command meant for item scripts to replicate single-use skills in
+usable items. It will not work properly if there is a visible dialog
+window or menu.
+If the skill is self or auto-targeting, it will be used immediately.
+Otherwise, a target cursor is shown.
+Flag is a optional param and, when present, the command will not check for
+skill requirements.
-// When Anodyne is used, it will cast Endure (8), Level 1, as if the actual
-// skill has been used from skill tree.
+// When Anodyne is used, it will cast Endure (8), Level 1, as if the
+// actual skill has been used from skill tree.
605,Anodyne,Anodyne,11,2000,0,100,,,,,10477567,2,,,,,{ itemskill 8,1; },{}
---------------------------------------
@@ -4473,26 +4599,27 @@ Flag is a optional param and when present the command will not check for skill r
itemeffect <item id>;
itemeffect "<item name>";
-This command will run the item script of the specified item on the invoking
-character. The character does not need to posess the item, and the item will
-not be deleted. While this command is intended for usable items, it will run
-for any item type.
+This command will run the item script of the specified item on the
+invoking character. The character does not need to posess the item, and
+the item will not be deleted. While this command is intended for usable
+items, it will run for any item type.
---------------------------------------
*produce <item level>;
-This command will open a crafting window on the client connected to the invoking
-character. The 'item level' is a number which determines what kind of a crafting
-window will pop-up.
+This command will open a crafting window on the client connected to the
+invoking character. The 'item level' is a number which determines what
+kind of a crafting window will pop-up.
-You can see the full list of such item levels in 'db/produce_db.txt' which determines
-what can actually be produced. The window will not be empty only if the invoking
-character can actually produce the items of that type and has the appropriate raw
-materials in their inventory.
+You can see the full list of such item levels in 'db/produce_db.txt' which
+determines what can actually be produced. The window will not be empty
+only if the invoking character can actually produce the items of that type
+and has the appropriate raw materials in their inventory.
-The success rate to produce the item is the same as the success rate of the skill
-associated with the item level. If there is no skill id, the success rate will be 50%.
+The success rate to produce the item is the same as the success rate of
+the skill associated with the item level. If there is no skill id, the
+success rate will be 50%.
Valid item levels are:
@@ -4507,13 +4634,13 @@ Valid item levels are:
*cooking <dish level>;
-This command will open a produce window on the client connected to the invoking
-character. The 'dish level' is the number which determines what kind of dish
-level you can produce. You can see the full list of dishes that can be produced in
-'db/produce_db.txt'.
+This command will open a produce window on the client connected to the
+invoking character. The 'dish level' is the number which determines what
+kind of dish level you can produce. You can see the full list of dishes
+that can be produced in 'db/produce_db.txt'.
-The window will be shown empty if the invoking character does not have enough of
-the required incredients to cook a dish.
+The window will be shown empty if the invoking character does not have
+enough of the required incredients to cook a dish.
Valid dish levels are:
@@ -4528,38 +4655,40 @@ Valid dish levels are:
19 - Level 9 Dish
20 - Level 10 Dish
-Although it's required to set a dish level, it doesn't matter if you set it to 1
-and you want to cook a level 10 dish, as long as you got the required incredients
-to cook the dish the command works.
+Although it's required to set a dish level, it doesn't matter if you set
+it to 1 and you want to cook a level 10 dish, as long as you got the
+required ingredients to cook the dish the command works.
---------------------------------------
*makerune <% success bonus>;
-This command will open a rune crafting window on the client connected to the
-invoking character. Since this command is officially used in rune ores, a bonus
-success rate must be specified (which adds to the base formula).
+This command will open a rune crafting window on the client connected to
+the invoking character. Since this command is officially used in rune
+ores, a bonus success rate must be specified (which adds to the base
+formula).
-You can see the full list of runes that can be produced in 'db/produce_db.txt'.
-The window will not be empty only if the invoking character can actually produce
-a rune and has the appropriate raw materials in their inventory.
+You can see the full list of runes that can be produced in
+'db/produce_db.txt'. The window will not be empty only if the invoking
+character can actually produce a rune and has the appropriate raw
+materials in their inventory.
---------------------------------------
*successremovecards <equipment slot>;
This command will remove all cards from the item found in the specified
-equipment slot of the invoking character, create new card items and give them to
-the character. If any cards were removed in this manner, it will also show a
-success effect.
+equipment slot of the invoking character, create new card items and give
+them to the character. If any cards were removed in this manner, it will
+also show a success effect.
---------------------------------------
*failedremovecards <equipment slot>,<type>;
This command will remove all cards from the item found in the specified
-equipment slot of the invoking character. 'type' determines what happens to the
-item and the cards:
+equipment slot of the invoking character. 'type' determines what happens
+to the item and the cards:
0 - will destroy both the item and the cards.
1 - will keep the item, but destroy the cards.
@@ -4571,80 +4700,84 @@ Whatever the type is, it will also show a failure effect on screen.
*repair <broken item number>;
-This command repairs a broken piece of equipment, using the same list of broken
-items as available through 'getbrokenid'.
+This command repairs a broken piece of equipment, using the same list of
+broken items as available through 'getbrokenid'.
The official scripts seem to use the repair command as a function instead:
-'repair(<number>)' but it returns nothing on the stack. Probably only Valaris,
-who made it, can answer why is it so.
+'repair(<number>)' but it returns nothing on the stack. Probably only
+Valaris, who made it, can answer why is it so.
---------------------------------------
*repairall;
-This command repairs all broken equipment in the attached player's inventory.
-A repair effect will be shown if any items are repaired, else the command will
-end silently.
+This command repairs all broken equipment in the attached player's
+inventory. A repair effect will be shown if any items are repaired, else
+the command will end silently.
---------------------------------------
*successrefitem <equipment slot>;
-This command will refine an item in the specified equipment slot of the invoking
-character by +1. For a list of equipment slots see 'getequipid'. This command
-will not only add the +1, but also display a 'refine success' effect on the
-character and put appropriate messages into their chat window. It will also give
-the character fame points if a weapon reached +10 this way, even though these
-will only take effect for blacksmith who will later forge a weapon.
+This command will refine an item in the specified equipment slot of the
+invoking character by +1. For a list of equipment slots see 'getequipid'.
+This command will not only add the +1, but also display a 'refine success'
+effect on the character and put appropriate messages into their chat
+window. It will also give the character fame points if a weapon reached
++10 this way, even though these will only take effect for blacksmith who
+will later forge a weapon.
-The official scripts seems to use the 'successrefitem' command as a function
-instead: 'successrefitem(<number>)' but it returns nothing on the stack.
-This is since jAthena, so probably nobody knows for sure why is it so.
+The official scripts seems to use the 'successrefitem' command as a
+function instead: 'successrefitem(<number>)' but it returns nothing on the
+stack. This is since jAthena, so probably nobody knows for sure why is it
+so.
---------------------------------------
*failedrefitem <equipment slot>;
-This command will fail to refine an item in the specified equipment slot of the
-invoking character. The item will be destroyed. This will also display a 'refine
-failure' effect on the character and put appropriate messages into their chat
-window.
+This command will fail to refine an item in the specified equipment slot
+of the invoking character. The item will be destroyed. This will also
+display a 'refine failure' effect on the character and put appropriate
+messages into their chat window.
-The official scripts seems to use the 'failedrefitem' command as a function
-instead: 'failedrefitem(<number>)' but it returns nothing on the stack. This is
-since jAthena, so probably nobody knows for sure why is it so.
+The official scripts seems to use the 'failedrefitem' command as a
+function instead: 'failedrefitem(<number>)' but it returns nothing on the
+stack. This is since jAthena, so probably nobody knows for sure why is it
+so.
---------------------------------------
*downrefitem <equipment slot>;
-This command will downgrade an item by - 1 in the specified equipment slot of the
-invoking character. So the item will not be destroyed unlike in the failedrefitem script command.
-This will also display a 'refine failure' effect on the character and put appropriate
-messages into their chat window.
+This command will downgrade an item by - 1 in the specified equipment slot
+of the invoking character. So the item will not be destroyed unlike in the
+failedrefitem script command. This will also display a 'refine failure'
+effect on the character and put appropriate messages into their chat
+window.
The official scripts seems to use the 'downrefitem' command as a function
-instead: 'downrefitem(<number>)' but it returns nothing on the stack. This is
-since jAthena, so probably nobody knows for sure why is it so.
+instead: 'downrefitem(<number>)' but it returns nothing on the stack.
+This is since jAthena, so probably nobody knows for sure why is it so.
---------------------------------------
*unequip <equipment slot>;
This command will unequip whatever is currently equipped in the invoking
-character's specified equipment slot. For a full list of possible equipment
-slots see 'getequipid'.
+character's specified equipment slot. For a full list of possible
+equipment slots see 'getequipid'.
-If an item occupies several equipment slots, it will get unequipped from all of
-them.
+If an item occupies several equipment slots, it will get unequipped from
+all of them.
---------------------------------------
*clearitem;
This command will destroy all items the invoking character has in their
-inventory (including equipped items). It will not affect anything else, like
-storage or cart.
+inventory (including equipped items). It will not affect anything else,
+like storage or cart.
---------------------------------------
@@ -4652,17 +4785,19 @@ storage or cart.
*autoEquip <item id>,<option>;
These commands are to equip a equipment on the attached character.
-The equip function will equip the item ID given when the player has
-this item in his/her inventory, while the autoequip function will
-equip the given item ID when this is looted. The option parameter of
-the autoequip is 1 or 0, 1 to turn it on, and 0 to turn it off.
+The equip function will equip the item ID given when the player has this
+item in his/her inventory, while the autoequip function will equip the
+given item ID when this is looted. The option parameter of the autoequip
+is 1 or 0, 1 to turn it on, and 0 to turn it off.
Examples:
-//This will equip a 1104 (falchion) on the character if this is in the inventory.
+//This will equip a 1104 (falchion) on the character if this is in the
+//inventory.
equip 1104;
-//The invoked character will now automatically equip a falchion when it's looted.
+//The invoked character will now automatically equip a falchion when it's
+//looted.
autoequip 1104,1;
//The invoked character will no longer automatically equip a falchion.
@@ -4672,9 +4807,9 @@ Examples:
*buyingstore <slots>;
-Invokes buying store preparation window like the skill 'Open Buying Store',
-without the item requirement. Amount of slots is limited by the server to
-a maximum of 5 slots by default.
+Invokes buying store preparation window like the skill 'Open Buying
+Store', without the item requirement. Amount of slots is limited by the
+server to a maximum of 5 slots by default.
Example:
@@ -4685,15 +4820,15 @@ Example:
*searchstores <uses>,<effect>;
-Invokes the store search window, which allows to search for both vending
-and buying stores. Parameter uses indicates, how many searches can be
-started, before the window has to be reopened. Effect value affects,
-what happens, when a result item is double-clicked and can be one of the
+Invokes the store search window, which allows to search for both vending
+and buying stores. Parameter uses indicates, how many searches can be
+started, before the window has to be reopened. Effect value affects what
+happens when a result item is double-clicked and can be one of the
following:
- 0 = Shows the store's position on the mini-map and highlights the
- shop sign with yellow color, when the store is on same map
- as the invoking player.
+ 0 = Shows the store's position on the mini-map and highlights the shop
+ sign with yellow color, when the store is on same map as the
+ invoking player.
1 = Directly opens the shop, regardless of distance.
Example:
@@ -4709,13 +4844,13 @@ Example:
*openstorage;
-This will open character's Kafra storage window on the client connected to the
-invoking character. It can be used from any kind of NPC or item script, not just
-limited to Kafra Staff.
+This will open character's Kafra storage window on the client connected to
+the invoking character. It can be used from any kind of NPC or item
+script, not just limited to Kafra Staff.
-The storage window opens regardless of whether there are open NPC dialogs or
-not, but it is preferred to close the dialog before displaying the storage
-window, to avoid any disruption when both windows overlap.
+The storage window opens regardless of whether there are open NPC dialogs
+or not, but it is preferred to close the dialog before displaying the
+storage window, to avoid any disruption when both windows overlap.
mes "I will now open your stash for you";
close2;
@@ -4738,7 +4873,8 @@ invoking character.
*openauction;
-This will open the Auction window on the client connected to the invoking character.
+This will open the Auction window on the client connected to the invoking
+character.
mes "Close this window to open the Auction window.";
close2;
@@ -4753,21 +4889,24 @@ This will open the Auction window on the client connected to the invoking charac
*guildopenstorage()
-This function works the same as 'openstorage' but will open a guild storage
-window instead for the guild storage of the guild the invoking character belongs
-to. This is a function because it returns a value - 0 if the guild storage was
-opened successfully and 1 if it wasn't. (Notice, it's a ZERO upon success.)
-Since guild storage is only accessible to one character at one time, it may fail
-if another character is accessing the guild storage at the same time.
+This function works the same as 'openstorage' but will open a guild
+storage window instead for the guild storage of the guild the invoking
+character belongs to. This is a function because it returns a value - 0 if
+the guild storage was opened successfully and 1 if it wasn't. (Notice,
+it's a ZERO upon success.)
+Since guild storage is only accessible to one character at one time, it
+may fail if another character is accessing the guild storage at the same
+time.
-This will also fail and return 2 if the character does not belong to any guild.
+This will also fail and return 2 if the attached character does not belong
+to any guild.
---------------------------------------
*guildchangegm(<guild id>,<new master's name>)
-This function will change the Guild Master of a guild. The ID is the guild's
-id, and the new guild master's name must be passed.
+This function will change the Guild Master of a guild. The ID is the
+guild's id, and the new guild master's name must be passed.
Returns 1 on success, 0 otherwise.
@@ -4775,37 +4914,34 @@ Returns 1 on success, 0 otherwise.
*guildgetexp <amount>;
-This will give the specified amount of guild experience points to the guild the
-invoking character belongs to. It will silently fail if they do not belong to
-any guild.
+This will give the specified amount of guild experience points to the
+guild the invoking character belongs to. It will silently fail if they do
+not belong to any guild.
---------------------------------------
*guildskill <skill id>,<level>
*guildskill "<skill name>",<level>
-This command will bump up the specified guild skill by the specified number of
-levels. This refers to the invoking character and will only work if the invoking
-character is a member of a guild AND it's guild master, otherwise no failure
-message will be given and no error will occur, but nothing will happen - same
-about the guild skill trying to exceed the possible maximum. The full list of
-guild skills is available in 'db/(pre-)re/skill_db.txt', these are all the GD_ skills at
-the end.
+This command will bump up the specified guild skill by the specified
+number of levels. This refers to the invoking character and will only work
+if the invoking character is a member of a guild AND it's guild master,
+otherwise no failure message will be given and no error will occur, but
+nothing will happen - same about the guild skill trying to exceed the
+possible maximum. The full list of guild skills is available in
+'db/(pre-)re/skill_db.txt', these are all the GD_ skills at the end.
-The flag parameter is currently not functional and it's a mystery of what it
-would actually do. (Though probably, like for character skills, it would allow
-temporary bumping.) Using this command will bump the guild skill up permanently.
+// This would give your character's guild one level of Approval
+// (GD_APPROVAL ID 10000). Notice that if you try to add two levels of
+// Approval, or add Approval when the guild already has it, it will only
+// have one level of Approval afterwards.
+ guildskill 10000,1;
-// This would give your character's guild one level of Approval (GD_APPROVAL ID
-// 10000). Notice that if you try to add two levels of Approval, or add
-// Approval when the guild already has it, it will only have one level of
-// Approval afterwards.
- guildskill 10000,1,0;
-
-You might want to make a quest for getting a certain guild skill, make it hard
-enough that all the guild needs to help or something. Doing this for the Glory
-of the Guild skill, which allows your guild to use an emblem, is a good idea for
-a fun quest. (Wasting a level point on that is really annoying :D)
+You might want to make a quest for getting a certain guild skill, make it
+hard enough that all the guild needs to help or something. Doing this for
+the Glory of the Guild skill, which allows your guild to use an emblem, is
+a good idea for a fun quest. (Wasting a level point on that is really
+annoying :D)
---------------------------------------
//
@@ -4815,14 +4951,14 @@ a fun quest. (Wasting a level point on that is really annoying :D)
*resetlvl <action type>;
-This is a character reset command, meant mostly for rebirth script supporting
-Advanced jobs, which will reset the invoking character's stats and level
-depending on the action type given. Valid action types are:
+This is a character reset command, meant mostly for rebirth script
+supporting Advanced jobs, which will reset the invoking character's stats
+and level depending on the action type given. Valid action types are:
- 1 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp, wipes the
- status effects (only the ones settable by 'setoption'), sets all stats to 1.
- If the new job is 'Novice High', give 100 status points, give First Aid and
- Play Dead skills.
+ 1 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp,
+ wipes the status effects (only the ones settable by 'setoption'),
+ sets all stats to 1. If the new job is 'Novice High', give 100 status
+ points, give First Aid and Play Dead skills.
2 - Base level 1, Job level 1, 0 skill points, 0 base exp, 0 job exp.
Skills and attribute values are not altered.
3 - Base level 1, base exp 0. Nothing else is changed.
@@ -4830,31 +4966,31 @@ depending on the action type given. Valid action types are:
In all cases everything the character has on will be unequipped.
-Even though it doesn't return a value, it is used as a function in the official
-rebirth scripts. Ask AppleGirl why.
+Even though it doesn't return a value, it is used as a function in the
+official rebirth scripts.
---------------------------------------
*resetstatus;
-This is a character reset command, which will reset the stats on the invoking
-character and give back all the stat points used to raise them previously.
-Nothing will happen to any other numbers about the character.
+This is a character reset command, which will reset the stats on the
+invoking character and give back all the stat points used to raise them
+previously. Nothing will happen to any other numbers about the character.
-Used in reset NPC's (duh!)
+Used in reset NPC's (duh!).
---------------------------------------
*resetskill;
-This command takes off all the skill points on the invoking character, so they
-only have Basic Skill blanked out (lvl 0) left, and returns the points for them
-to spend again. Nothing else will change but the skills. Quest skills will also
-reset if 'quest_skill_reset' option is set to Yes in 'battle.conf'. If
-the 'quest_skill_learn' option is set in there, the points in the quest skills
-will also count towards the total.
+This command takes off all the skill points on the invoking character, so
+they only have Basic Skill blanked out (lvl 0) left, and returns the
+points for them to spend again. Nothing else will change but the skills.
+Quest skills will also reset if 'quest_skill_reset' option is set to Yes
+in 'battle.conf'. If the 'quest_skill_learn' option is set in there, the
+points in the quest skills will also count towards the total.
-Used in reset NPC's (duh!)
+Used in reset NPC's (duh!).
---------------------------------------
@@ -4863,54 +4999,55 @@ Used in reset NPC's (duh!)
*sc_start4 <effect type>,<ticks>,<value 1>,<value 2>,<value 3>,<value 4>{,<GID>};
*sc_end <effect type>{,<GID>};
-These command bestow a status effect on the invoking character. This command is
-used a lot in the item scripts.
+These command bestow a status effect on the invoking character. This
+command is used a lot in the item scripts.
// This would poison them for 10 min
sc_start SC_Poison,600000,0;
Effect type is a number of effect, 'db/const.txt' lists the common (mostly
-negative) status effect types as constants, starting with 'SC_'. You can also
-use this to give someone an effect of a player-cast spell:
+negative) status effect types as constants, starting with 'SC_'. You can
+also use this to give someone an effect of a player-cast spell:
// This will bless someone as if with Bless 10:
sc_start 10,240000,10;
-Extra argument's meaning differs depending on the effect type, for most effects
-caused by a player skill the extra argument means the level of the skill that
-would have been used to create that effect, for others it might have no meaning
-whatsoever. You can actually bless someone with a 0 bless spell level this way,
-which is fun, but weird.
-
-The GID, if given, will cause the status effect to appear on a
-specified character, instead of the one attached to the running script. This has
-not been properly tested.
-
-'sc_start2' is perfectly equivalent, but unlike 'sc_start', a status change
-effect will only occur with a specified percentage chance. 10000 given as the
-chance is equivalent to a 100% chance, 0 is a zero.
-
-'sc_start4' is just like sc_start, however it takes four parameters for the
-status change instead of one. What these values are depends on the status
-change in question. For example, elemental armor defense takes the following
-four values:
+Extra argument's meaning differs depending on the effect type, for most
+effects caused by a player skill the extra argument means the level of the
+skill that would have been used to create that effect, for others it might
+have no meaning whatsoever. You can actually bless someone with a 0 bless
+spell level this way, which is fun, but weird.
+
+The GID, if given, will cause the status effect to appear on a specified
+character, instead of the one attached to the running script. This has not
+been properly tested.
+
+'sc_start2' is perfectly equivalent, but unlike 'sc_start', a status
+change effect will only occur with a specified percentage chance. 10000
+given as the chance is equivalent to a 100% chance, 0 is a zero.
+
+'sc_start4' is just like sc_start, however it takes four parameters for
+the status change instead of one. What these values are depends on the
+status change in question. For example, elemental armor defense takes the
+following four values:
- val1 is the first element, val2 is the resistance to the element val1.
- val3 is the second element, val4 is the resistance to said element.
eg: sc_start4 SC_DefEle,60000,Ele_Fire,20,Ele_Water,-15;
-'sc_end' will remove a specified status effect. If SC_All is used (-1), it will
-do a complete removal of all statuses (although permanent ones will re-apply).
+'sc_end' will remove a specified status effect. If SC_All is used (-1), it
+will do a complete removal of all statuses (although permanent ones will
+re-apply).
You can see the full list of status effects caused by skills in
-'src/map/status.h' - they are currently not fully documented, but most of that
-should be rather obvious.
+'src/map/status.h' - they are currently not fully documented, but most of
+that should be rather obvious.
---------------------------------------
*getstatus <effect type>{,<type>};
-Retrieve information about a specific status effect when called. Depending on <type>
-specified the function will return different information.
+Retrieve information about a specific status effect when called. Depending
+on <type> specified the function will return different information.
Possible <type> values:
- 0 or undefined: whether the status is active
@@ -4920,22 +5057,22 @@ Possible <type> values:
- 4: the val4 of the status
- 5: the amount of time in milliseconds that the status has remaining
-If <type> is not defined or is set to 0, then the script function will either
-return 1 if the status is active, or 0 if the status is not active. If the status
-is not active when any of the <type> fields are provided, this script function
-will always return 0.
+If <type> is not defined or is set to 0, then the script function will
+either return 1 if the status is active, or 0 if the status is not active.
+If the status is not active when any of the <type> fields are provided,
+this script function will always return 0.
---------------------------------------
*skilleffect <skill id>,<number>;
*skilleffect "<skill name>",<number>;
-This command displays visual and aural effects of given skill on currently
-attached character. The number parameter is for skill whose visual effect
-involves displaying of a number (healing or damaging). Note, that this command
-will not actually use the skill, it is intended for scripts, which simulate
-skill usage by the NPC, such as buffs, by setting appropriate status and
-displaying the skill's effect.
+This command displays visual and aural effects of given skill on currently
+attached character. The number parameter is for skill whose visual effect
+involves displaying of a number (healing or damaging). Note that this
+command will not actually use the skill: it is intended for scripts which
+simulate skill usage by the NPC, such as buffs, by setting appropriate
+status and displaying the skill's effect.
mes "Be blessed!";
// Heal of 2000 HP
@@ -4948,7 +5085,7 @@ displaying the skill's effect.
sc_start 12,140000,5;
skilleffect 29,0;
-This will heal the character with 2000 HP, buff it with Blessing Lv 10 and
+This will heal the character with 2000 HP, buff it with Blessing Lv 10 and
Increase AGI Lv 5, and display appropriate effects.
---------------------------------------
@@ -4956,25 +5093,25 @@ Increase AGI Lv 5, and display appropriate effects.
*npcskilleffect <skill id>,<number>,<x>,<y>;
*npcskilleffect "<skill name>",<number>,<x>,<y>;
-This command behaves identically to 'skilleffect', however, the effect will not
-be centered on the invoking character's sprite, nor on the NPC sprite, if any,
-but will be centered at map coordinates given on the same map as the invoking
-character.
+This command behaves identically to 'skilleffect', however, the effect
+will not be centered on the invoking character's sprite, nor on the NPC
+sprite, if any, but will be centered at map coordinates given on the same
+map as the invoking character.
---------------------------------------
*specialeffect <effect number>{,<send_target>{,"<NPC Name>"}};
-This command will display special effect with the given number, centered on the
-specified NPCs coordinates, if any. For a full list of special effect numbers
-known see 'doc/effect_list.txt'. Some effect numbers are known not to work in
-some client releases. (Notably, rain is absent from any client executables
-released after April 2005.)
+This command will display special effect with the given number, centered
+on the specified NPCs coordinates, if any. For a full list of special
+effect numbers known see 'doc/effect_list.txt'. Some effect numbers are
+known not to work in some client releases. (Notably, rain is absent from
+any client executables released after April 2005.)
-<NPC name> parameter will display <effect number> on another NPC. If the NPC
-specified does not exist, the command will do nothing. When specifying an NPC,
-<send_target> must be specified when specifying an <NPC Name>, specifying AREA
-will retain the default behavior of the command.
+<NPC name> parameter will display <effect number> on another NPC. If the
+NPC specified does not exist, the command will do nothing. When specifying
+an NPC, <send_target> must be specified when specifying an <NPC Name>,
+specifying AREA will retain the default behavior of the command.
// this will make the NPC "John Doe#1"
// show the effect "EF_HIT1" specified by
@@ -4988,21 +5125,21 @@ will retain the default behavior of the command.
*specialeffect2 <effect number>{,<send_target>{,"<Player Name>"}};
-This command behaves identically to the 'specialeffect', but the effect will be
-centered on the invoking character's sprite.
+This command behaves identically to the 'specialeffect', but the effect
+will be centered on the invoking character's sprite.
-<Player name> parameter will display <effect number> on another Player than the
-one currently attached to the script. Like with specialeffect, when specifying
-a player, <send_target> must be supplied, specifying AREA will retain the default
-behavior of the command.
+<Player name> parameter will display <effect number> on another Player
+than the one currently attached to the script. Like with specialeffect,
+when specifying a player, <send_target> must be supplied, specifying AREA
+will retain the default behavior of the command.
---------------------------------------
*statusup <stat>;
-This command will bump a specified stat of the invoking character up by one
-permanently. Stats are to be given as number, but you can use these constants to
-replace them:
+This command will bump a specified stat of the invoking character up by
+one permanently. Stats are to be given as number, but you can use these
+constants to replace them:
bStr - Strength
bVit - Vitality
@@ -5015,8 +5152,8 @@ bLuk - Luck
*statusup2 <stat>,<amount>;
-This command will bump a specified stat of the invoking character up by the
-specified amount permanently. The amount can be negative. See 'statusup'.
+This command will bump a specified stat of the invoking character up by
+the specified amount permanently. Amount can be negative. See 'statusup'.
// This will decrease a character's Vit forever.
statusup bVit,-1;
@@ -5029,12 +5166,12 @@ specified amount permanently. The amount can be negative. See 'statusup'.
*bonus4 <bonus type>,<val1>,<val2>,<val3>,<val4>;
*bonus5 <bonus type>,<val1>,<val2>,<val3>,<val4>,<val5>;
-These commands are meant to be used in item scripts. They will probably work
-outside item scripts, but the bonus will not persist for long. They, as
-expected, refer only to an invoking character.
+These commands are meant to be used in item scripts. They will probably
+work outside item scripts, but the bonus will not persist for long. They,
+as expected, refer only to an invoking character.
-You can find the full list of possible bonuses and which command to use for each
-kind in 'doc/item_bonus.txt'.
+You can find the full list of possible bonuses and which command to use
+for each kind in 'doc/item_bonus.txt'.
---------------------------------------
@@ -5043,21 +5180,24 @@ kind in 'doc/item_bonus.txt'.
*autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
*autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};
-These commands are meant to be used in item scripts. They will probably work
-outside item scripts, but the bonus will not persist for long. They, as
-expected, refer only to an invoking character.
+These commands are meant to be used in item scripts. They will probably
+work outside item scripts, but the bonus will not persist for long. They,
+as expected, refer only to an invoking character.
What these commands do is 'attach' a script to the player which will get
executed on attack (or when attacked in the case of autobonus2).
-Rate is the trigger rate of the script (1000 = 100%).
+Rate is the trigger rate of the script (10000 = 100%).
-Duration is the time that the bonus will last for since the script has triggered.
+Duration is the time that the bonus will last for since the script has
+triggered.
-Skill ID/skill name the skill which will be used as trigger to start the bonus. (autobonus3)
+Skill ID/skill name the skill which will be used as trigger to start the
+bonus (for autobonus3).
-The optional argument 'flag' is used to classify the type of attack where the script
-can trigger (it shares the same flags as the bAutoSpell bonus script):
+The optional argument 'flag' is used to classify the type of attack where
+the script can trigger (it shares the same flags as the bAutoSpell bonus
+script):
Range criteria:
BF_SHORT: Trigger on melee attack
@@ -5072,22 +5212,23 @@ Skill criteria:
BF_NORMAL: Trigger on normal attacks
BF_SKILL: Trigger on skills
default: If the attack type is BF_WEAPON (only) BF_NORMAL is used,
- otherwise BF_SKILL+BF_NORMAL is used.
-
-The difference between the optional argument 'other script' and the 'bonus script' is that,
-the former one triggers only when attacking(or attacked) and the latter one runs on
-status calculation as well, which makes sure, within the duration, the "bonus" that get
-lost on status calculation is restored. So, 'bonus script' is technically supposed to accept
-"bonus" command only. And we usually use 'other script' to show visual effects.
-
-In all cases, when the script triggers, the attached player will be the one
-who holds the bonus. There is currently no way of knowing within this script
-who was the other character (the attacker in autobonus2, or the target in
-autobonus and autobonus3).
-
-//Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
-//using weapon or misc attacks (both melee and ranged skills) and shows a special
-//effect when the bonus is active.
+ otherwise BF_SKILL+BF_NORMAL is used.
+
+The difference between the optional argument 'other script' and the 'bonus
+script' is that, the former one triggers only when attacking (or attacked)
+and the latter one runs on status calculation as well, which makes sure,
+within the duration, the "bonus" that get lost on status calculation is
+restored. So, 'bonus script' is technically supposed to accept "bonus"
+command only. And we usually use 'other script' to show visual effects.
+
+In all cases, when the script triggers, the attached player will be the
+one who holds the bonus. There is currently no way of knowing within this
+script who was the other character (the attacker in autobonus2, or the
+target in autobonus and autobonus3).
+
+//Grants a 1% chance of starting the state "all stats +10" for 10 seconds
+//when using weapon or misc attacks (both melee and ranged skills) and
+//shows a special effect when the bonus is active.
autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";
---------------------------------------
@@ -5097,37 +5238,43 @@ autobonus and autobonus3).
*addtoskill <skill id>,<level>{,<flag>};
*addtoskill "<skill name>",<level>{,<flag>};
-These commands will give the invoking character a specified skill. This is also
-used for item scripts.
+These commands will give the invoking character a specified skill. This is
+also used for item scripts.
-Level is obvious. Skill id is the ID number of the skill in question as per
-'db/(pre-)re/skill_db.txt'. It is not known for certain whether this can be used to give
-a character a monster's skill, but you're welcome to try with the numbers given
-in 'db/(pre-)re/mob_skill_db.txt'.
+Level is obvious. Skill id is the ID number of the skill in question as
+per 'db/(pre-)re/skill_db.txt'. It is not known for certain whether this
+can be used to give a character a monster's skill, but you're welcome to
+try with the numbers given in 'db/(pre-)re/mob_skill_db.txt'.
-Flag is 0 if the skill is given permanently (will get written with the character
-data) or 1 if it is temporary (will be lost eventually, this is meant for card
-item scripts usage.). The flag parameter is optional, and defaults to 1 in
-'skill' and to 2 in 'addtoskill'.
+Flag is 0 if the skill is given permanently (will get written with the
+character data) or 1 if it is temporary (will be lost eventually, this is
+meant for card item scripts usage.). The flag parameter is optional, and
+defaults to 1 in 'skill' and to 2 in 'addtoskill'.
Flag 2 means that the level parameter is to be interpreted as a stackable
-additional bonus to the skill level. If the character did not have that skill
-previously, they will now at 0+the level given.
+additional bonus to the skill level. If the character did not have that
+skill previously, they will now at 0+the level given.
-// This will permanently give the character Stone Throw (TF_THROWSTONE,152), at
-// level 1.
+// This will permanently give the character Stone Throw
+// (TF_THROWSTONE,152), at level 1.
skill 152,1,0;
-Flag 3 is the same as flag 0 in that it saves to the database. However, these skills
-are ignored when any action is taken that adjusts the skill tree (reset/job change).
+Flag 3 is the same as flag 0 in that it saves to the database. However,
+these skills are ignored when any action is taken that adjusts the skill
+tree (reset/job change).
+
+Flag 4 is the same as flag 1 in that it saves to the database. However,
+these skills are ignored when any action is taken that adjusts the skill
+tree (reset/job change).
+
---------------------------------------
*nude;
This command will unequip anything equipped on the invoking character.
-It is not required to do this when changing jobs since 'jobchange' will unequip
-everything not equippable by the new job class anyway.
+It is not required to do this when changing jobs since 'jobchange' will
+unequip everything not equippable by the new job class anyway.
---------------------------------------
@@ -5151,34 +5298,38 @@ undisguise; // Return to normal character sprite.
*marriage("<spouse name>");
-This function will marry two characters, the invoking character and the one
-referred to by name given, together, setting them up as each other's marriage
-partner. No second function call has to be issued (in current SVN at least) to
-make sure the marriage works both ways. The function returns 1 upon success, or
-0 if the marriage could not be completed, either because the other character
-wasn't found or because one of the two characters is already married.
+This function will marry two characters, the invoking character and the
+one referred to by name given, together, setting them up as each other's
+marriage partner. No second function call has to be issued (in current Git
+at least) to make sure the marriage works both ways. The function returns
+1 upon success, or 0 if the marriage could not be completed, either
+because the other character wasn't found or because one of the two
+characters is already married.
-This will do nothing else for the marriage except setting up the spouse ID for
-both of these characters. No rings will be given and no effects will be shown.
+This will do nothing else for the marriage except setting up the spouse ID
+for both of these characters. No rings will be given and no effects will
+be shown.
---------------------------------------
*wedding;
-This command will call up wedding effects - the music and confetti - centered on
-the invoking character. Example can be found in the wedding script.
+This command will call up wedding effects - the music and confetti -
+centered on the invoking character. Example can be found in the wedding
+script.
---------------------------------------
*divorce()
-This function will "un-marry" the invoking character from whoever they were
-married to. Both will no longer be each other's marriage partner, (at least in
-current SVN, which prevents the cases of multi-spouse problems). It will return
-1 upon success or 0 if the character was not married at all.
+This function will "un-marry" the invoking character from whoever they
+were married to. Both will no longer be each other's marriage partner,
+(at least in current Git, which prevents the cases of multi-spouse
+problems). It will return 1 upon success or 0 if the character was not
+married at all.
-This function will also destroy both wedding rings and send a message to both
-players, telling them they are now divorced.
+This function will also destroy both wedding rings and send a message to
+both players, telling them they are now divorced.
---------------------------------------
//
@@ -5189,12 +5340,14 @@ players, telling them they are now divorced.
*pcfollow <id>,<target id>;
*pcstopfollow <id>;
-Makes a character follow or stop following someone. This command does the same as the @follow command.
-The main difference is that @follow can use character names, and this commands needs the Account ID for the target.
+Makes a character follow or stop following someone. This command does the
+same as the @follow command. The main difference is that @follow can use
+character names, and this commands needs the Account ID for the target.
Examples:
-// This will make Aaron follow Bullah, when both of these characters are online.
+// This will make Aaron follow Bullah, when both of these characters are
+// online.
PCFollow getCharID(3,"Aaron"),getCharID(3,"Bullah");
// Makes Aaron stop following whoever he is following.
@@ -5204,9 +5357,10 @@ Examples:
*pcblockmove <id>,<option>;
-Prevents the given ID from moving when the option != 0, and 0 enables the ID to
-move again. The ID can either be the GID of a monster/NPC or account ID of a
-character, and will run for the attached player if zero is supplied.
+Prevents the given ID from moving when the option != 0, and 0 enables the
+ID to move again. The ID can either be the GID of a monster/NPC or account
+ID of a character, and will run for the attached player if zero is
+supplied.
Examples:
@@ -5226,25 +5380,26 @@ Examples:
*monster "<map name>",<x>,<y>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
*areamonster "<map name>",<x1>,<y1>,<x2>,<y2>,"<name to show>",<mob id>,<amount>{,"<event label>",<size>,<ai>};
-This command will spawn a monster on the specified coordinates on the specified
-map. If the script is invoked by a character, a special map name, "this", will
-be recognized to mean the name of the map the invoking character is located at.
-This command works fine in the item scripts.
+This command will spawn a monster on the specified coordinates on the
+specified map. If the script is invoked by a character, a special map
+name, "this", will be recognized to mean the name of the map the invoking
+character is located at. This command works fine in the item scripts.
The same command arguments mean the same things as described above in the
-beginning of this document when talking about permanent monster spawns. Monsters
-spawned in this manner will not respawn upon being killed.
+beginning of this document when talking about permanent monster spawns.
+Monsters spawned in this manner will not respawn upon being killed.
-Unlike the permanent monster spawns, if the mob id is -1, a random monster will
-be picked from the entire database according to the rules configured in the
-server for dead branches. This will work for all other kinds of non-permanent
-monster spawns.
+Unlike the permanent monster spawns, if the mob id is -1, a random monster
+will be picked from the entire database according to the rules configured
+in the server for dead branches. This will work for all other kinds of
+non-permanent monster spawns.
-The only very special thing about this command is an event label, which is an
-optional parameter. This label is written like '<NPC object name>::<label name>'
-and upon the monster being killed, it will execute the script inside of the
-specified NPC object starting from the label given. The RID of the player
-attached at this execution will be the RID of the killing character.
+The only very special thing about this command is an event label, which is
+an optional parameter. This label is written like
+'<NPC object name>::<label name>' and upon the monster being killed, it
+will execute the script inside of the specified NPC object starting from
+the label given. The RID of the player attached at this execution will be
+the RID of the killing character.
<size> can be:
0 = medium (default)
@@ -5260,15 +5415,35 @@ attached at this execution will be the RID of the killing character.
monster "place",60,100,"Poring",1002,1,"NPCNAME::OnLabel";
-The coordinates of 0,0 will spawn the monster on a random place on the map.
+The coordinates of 0,0 will spawn the monster on a random place on the
+map. Both 'monster' and 'areamonster' return the GID of the monster
+spawned if there was ONLY ONE monster to be spawned. This is useful for
+controlling each of the spawned mobs with the unit* commands shown below.
+For example:
+
+ // We'll make a poring which will automatically attack invoking player:
+ set .@mobGID, monster "Prontera",150,150,"Poring",1002,1;
+ unitattack .@mobGID, getcharid(3); // Attacker GID, attacked GID
+
+The way you can get the GID of more than only one monster is looping
+through all the summons to get their individual GIDs and do whatever you
+want with them. For example:
+
+ // We want to summon .mobnumber porings which will give us a kiss
+ for (set .@i, 0; .@i < .mobnumber; set .@i, .@i + 1){
+ set .@mobGID, monster "map",.x,.y,"Kisser Poring",1002,1;
+ unitemote .@mobGID, e_kis;
+ }
+
+Refer to the unit* commands below.
The 'areamonster' command works much like the 'monster' command and is not
-significantly different, but spawns the monsters within a square defined by
-x1/y1-x2/y2.
+significantly different, but spawns the monsters within a square defined
+by x1/y1-x2/y2.
Simple monster killing script:
- <Normal NPC object definition. Let's assume you called him NPCNAME.>
+ <NPC object definition. Let's assume you called him NPCNAME.>
mes "[Summon Man]";
mes "Want to start the kill?";
next;
@@ -5292,18 +5467,19 @@ Simple monster killing script:
set $PoringKilled,0;
end;
-For more good examples see just about any official 2-1 or 2-2 job quest script.
+For more examples see just about any official 2-1 or 2-2 job quest script.
---------------------------------------
*areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,<skill id>,<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
*areamobuseskill "<map name>",<x>,<y>,<range>,<mob id>,"<skill name>",<skill level>,<cast time>,<cancelable>,<emotion>,<target type>;
-This command will make all monsters of the specified mob ID in the specified
-area use the specified skill. Map name, x, and y define the center of the area,
-which extending <range> cells in each direction (ex: a range of 3 would create
-a 7x7 square). The skill can be specified by skill ID or name. <cast time> is in
-milliseconds (1000 = 1 second), and the rest should be self-explanatory.
+This command will make all monsters of the specified mob ID in the
+specified area use the specified skill. Map name, x, and y define the
+center of the area, which extending <range> cells in each direction (ex: a
+range of 3 would create a 7x7 square). The skill can be specified by skill
+ID or name. <cast time> is in milliseconds (1000 = 1 second), and the rest
+should be self-explanatory.
<target type> can be:
0 = self
@@ -5323,33 +5499,36 @@ Example:
*killmonster "<map name>","<event label>"{,<type>};
This command will kill all monsters that were spawned with 'monster' or
-'addmonster' and have a specified event label attached to them. Commonly used to
-get rid of remaining quest monsters once the quest is complete.
+'addmonster' and have a specified event label attached to them. Commonly
+used to get rid of remaining quest monsters once the quest is complete.
-If the label is given as "All", all monsters which have their respawn times set
-to -1 (like all the monsters summoned with 'monster' or 'areamonster' script
-command, and all monsters summoned with GM commands, but no other ones - that
-is, all non-permanent monsters) on the specified map will be killed regardless
-of the event label value.
+If the label is given as "All", all monsters which have their respawn
+times set to -1 (like all the monsters summoned with 'monster' or
+'areamonster' script command, and all monsters summoned with GM commands,
+but no other ones - that is, all non-permanent monsters) on the specified
+map will be killed regardless of the event label value.
-killmonster supports an optional argument type. Using 1 for type will make the command
-fire "OnMyMobDead" events from any monsters that do die as a result of this command.
+killmonster supports an optional argument type. Using 1 for type will make
+the command fire "OnMyMobDead" events from any monsters that do die as a
+result of this command.
---------------------------------------
*killmonsterall "<map name>"{,<type>};
-This command will kill all monsters on a specified map name, regardless of how
-they were spawned or what they are without triggering any event label attached to them,
-unless you specify 1 for type parameter. In this case, mob death labels will be allowed to
-trigger when there is no player. Any other number for this parameter won't be recognized.
+This command will kill all monsters on a specified map name, regardless of
+how they were spawned or what they are without triggering any event label
+attached to them, unless you specify 1 for type parameter. In this case,
+mob death labels will be allowed totrigger when there is no player. Any
+other number for this parameter won't be recognized.
---------------------------------------
*strmobinfo(<type>,<monster id>);
-This function will return information about a monster record in the database, as
-per 'db/(pre-)re/mob_db.txt'. Type is the kind of information returned. Valid types are:
+This function will return information about a monster record in the
+database, as per 'db/(pre-)re/mob_db.txt'. Type is the kind of information
+returned. Valid types are:
1 - 'english name' field in the database, a string.
2 - 'japanese name' field in the database, a string.
@@ -5364,64 +5543,67 @@ per 'db/(pre-)re/mob_db.txt'. Type is the kind of information returned. Valid ty
*mobcount("<map name>","<event label>")
-This function will count all the monsters on the specified map that have a given
-event label and return the number or 0 if it can't find any. Naturally, only
-monsters spawned with 'monster' and 'areamonster' script commands can have non-empty
-event label.
-If you pass this function an empty string for the event label, it will return
-the total count of monster without event label, including permanently spawning monsters.
-With the dynamic mobs system enabled, where mobs are not kept
-in memory for maps with no actual people playing on them, this will return a 0
-for any such map.
-If the event label is given as "all", all monsters will be counted, regardless of
-having any event label attached.
+This function will count all the monsters on the specified map that have a
+given event label and return the number or 0 if it can't find any.
+Naturally, only monsters spawned with 'monster' and 'areamonster' script
+commands can have non-empty event label.
+If you pass this function an empty string for the event label, it will
+return the total count of monster without event label, including
+permanently spawning monsters.
+With the dynamic mobs system enabled, where mobs are not kept in memory
+for maps with no actual people playing on them, this will return a 0 for
+any such map.
+If the event label is given as "all", all monsters will be counted,
+regardless of having any event label attached.
-If the map name is given as "this", the map the invoking character is on will
-be used. If the map is not found, or the invoker is not a character while the map
-is "this", it will return -1.
+If the map name is given as "this", the map the invoking character is on
+will be used. If the map is not found, or the invoker is not a character
+while the map is "this", it will return -1.
---------------------------------------
*clone "<map name>",<x>,<y>,"<event>",<char id>{,<master_id>{,<mode>{,<flag>,<duration>}}}
-This command creates a monster which is a copy of another player. The first
-four arguments serve the same purpose as in the monster script command, The
-<char id> is the character id of the player to clone (player must be online).
-If <master id> is given, the clone will be a 'slave/minion' of it. Master_id
-must be a character id of another online player.
+This command creates a monster which is a copy of another player. The
+first four arguments serve the same purpose as in the monster script
+command, The <char id> is the character id of the player to clone (player
+must be online).
+If <master id> is given, the clone will be a 'slave/minion' of it.
+Master_id must be a character id of another online player.
-The mode can be specified to determine the behavior of the clone, it's
-values are the same as the ones used for the mode field in the mob_db. The
+The mode can be specified to determine the behavior of the clone, its
+values are the same as the ones used for the mode field in the mob_db. The
default mode is aggressive, assists, can move, can attack.
-Flag can be either zero or one currently. If zero, the clone is a normal
-monster that'll target players, if one, it is considered a summoned monster,
-and as such, it'll target other monsters. Defaults to zero.
+Flag can be either zero or one currently. If zero, the clone is a normal
+monster that'll target players, if one, it is considered a summoned
+monster, and as such, it'll target other monsters. Defaults to zero.
-The duration specifies how long the clone will live before it is auto-removed.
-Specified in seconds, defaults to no limit (zero).
+The duration specifies how long the clone will live before it is
+auto-removed. Specified in seconds, defaults to no limit (zero).
-Returned value is the monster ID of the spawned clone. If command fails,
+Returned value is the monster ID of the spawned clone. If command fails,
returned value is zero.
---------------------------------------
*summon "Monster name",<monster id>{,<Time Out>{,"event label"}};
-This command will summon a monster. (see also 'monster') Unlike monsters spawned
-with other commands, this one will set up the monster to fight to protect the
-invoking character. Monster name and mob id obey the same rules as the one given
-at the beginning of this document for permanent monster spawns with the
-exceptions mentioned when describing 'monster' command.
+This command will summon a monster. (see also 'monster') Unlike monsters
+spawned with other commands, this one will set up the monster to fight to
+protect the invoking character. Monster name and mob id obey the same
+rules as the one given at the beginning of this document for permanent
+monster spawns with the exceptions mentioned when describing 'monster'
+command.
-The effect for the skill 'Call Homunculus' will be displayed centered on the
-invoking character.
+The effect for the skill 'Call Homunculus' will be displayed centered on
+the invoking character.
Timeout is the time in milliseconds the summon lives, and is set default
-to 60000 (1 minute). Note that also the value 0 will set the timer to default,
-and it is not possible to create a spawn that lasts forever.
-If an event label is given, upon the monster being killed, the event label will
-run as if by 'donpcevent'.
+to 60000 (1 minute). Note that also the value 0 will set the timer to
+default, and it is not possible to create a spawn that lasts forever.
+If an event label is given, upon the monster being killed, the event label
+will run as if by 'donpcevent'.
// Will summon a dead branch-style monster to fight for the character.
summon "--ja--",-1;
@@ -5433,42 +5615,73 @@ summon "--ja--",-1;
This command will try to evolve the current player's homunculus.
If it doesn't work, the /swt emotion is shown.
-To evolve a homunculus, the invoking player must have a homunculus,
-the homunculus must not be the last evolution and
-the homunculus must have above 91000 intimacy with its owner.
+To evolve a homunculus, the invoking player must have a homunculus, the
+homunculus must not be the last evolution and the homunculus must have
+above 91000 intimacy with its owner.
---------------------------------------
*hommutate {<ID>};
-This command will try to evolve the current player's homunculus into the
-new Homunculus S. If it doesn't work, the /swt emotion is shown.
+This command will try to mutate the invoking player's Homunculus into a
+Homunculus S. The Strange Embryo (ID 6415) is deleted upon success.
+
+The command will fail if the invoking player does not have an evolved
+Homunculus at level 99 or above, if it is not in the embryo state (from
+the 'morphembryo' command), or if the invoking player does not possess a
+Strange Embryo. The /swt emotion is shown upon failure.
+
+If the optional parameter <ID> is set, the invoking player's Homunculus
+will change into the specified Homunculus ID. Otherwise, a random
+Homunculus S will be chosen. See 'db/homunculus_db.txt' for a full list of
+IDs.
+
+Returns 1 upon success and 0 for all failures.
+
+---------------------------------------
+
+*checkhomcall()
-To mutate a homunculus, the invoking player must have an evolved
-homunculus and it must be at least level 99.
+This function checks if the attached player's Homunculus is active,
+and will return the following values:
+ -1: The player has no Homunculus.
+ 0: The player's Homunculus is active.
+ 1: The player's Homunculus is vaporized.
+ 2: The player's Homunculus is in morph state.
-If the optional parameter <ID> is set, the invoking player's homunculus will
-change into the given homunculus ID. Otherwise, a random Homunculus S
-will be chosen.
+---------------------------------------
+
+*gethominfo(<type>)
+
+This function works as a direct counterpart of 'getpetinfo':
+ 0 - Homunculus unique ID
+ 1 - Homunculus Class
+ 2 - Name
+ 3 - Friendly level (intimacy score). 100000 is full loyalty.
+ 4 - Hungry level. 100 is completely full.
+ 5 - Rename flag. 0 means this homunculus has not been named yet.
+ 6 - Homunculus level
---------------------------------------
*unitwalk <GID>,<x>,<y>;
*unitwalk <GID>,<mapid>;
-This is one command, but can be used in two ways. If only the first argument is given,
-the unit whose GID is given will start walking towards the map with the given mapid
-(we believe these are the map-indexes found in db/map_index.txt).
+This is one command, but can be used in two ways. If only the first
+argument is given, the unit whose GID is given will start walking towards
+the map with the given mapid (we believe these are the map-indexes found
+in db/map_index.txt).
-When 2 arguments are passed, the given unit will walk to the given x,y coordinates on
-the map where the unit currently is.
+When 2 arguments are passed, the given unit will walk to the given x,y
+coordinates on the map where the unit currently is.
Examples:
//Will move/walk the poring we made to the coordinates 150,150
unitwalk .GID,150,150;
-//Will move the poring towards alberta (if my assumed map-indexes are correct).
+//Will move the poring towards alberta (if my assumed map-indexes are
+//correct).
unitwalk .GID,3;
---------------------------------------
@@ -5482,7 +5695,8 @@ Examples:
Okay, these commands should be fairly self explaining.
For the emotions, you can look in db/const.txt for prefixes with e_
-PS: unitwarp supports a <GID> of zero, which causes the executor of the script to be affected. This can be used with OnTouchNPC to warp monsters:
+PS: unitwarp supports a <GID> of zero, which causes the executor of the
+script to be affected. This can be used with OnTouchNPC to warp monsters:
OnTouchNPC:
unitwarp 0,"this",-1,-1;
@@ -5493,45 +5707,46 @@ OnTouchNPC:
*enablenpc "<NPC object name>";
These two commands will disable and enable, respectively, an NPC object
-specified by name. The disabled NPC will disappear from sight and will no longer
-be triggerable in the normal way. It is not clear whether it will still be
-accessible through 'donpcevent' and other triggering commands, but it probably
-will be. You can disable even warp NPCs if you know their object names, which is
-an easy way to make a map only accessible through walking half the time. Then
-you 'enablenpc' them back.
+specified by name. The disabled NPC will disappear from sight and will no
+longer be triggerable in the normal way. It is not clear whether it will
+still be accessible through 'donpcevent' and other triggering commands,
+but it probably will be. You can disable even warp NPCs if you know their
+object names, which is an easy way to make a map only accessible through
+walking half the time. Then you 'enablenpc' them back.
You can also use these commands to create the illusion of an NPC switching
-between several locations, which is often better than actually moving the NPC -
-create one NPC object with a visible and a hidden part to their name, make a few
-copies, and then disable all except one.
+between several locations, which is often better than actually moving the
+NPC - create one NPC object with a visible and a hidden part to their
+name, make a few copies, and then disable all except one.
---------------------------------------
*hideonnpc "<NPC object name>";
*hideoffnpc "<NPC object name>";
-These commands will make the NPC object specified display as hidden/visible,
-even though not actually disabled per se. Hidden as in thief Hide skill, but
-unfortunately, not detectable by Ruwach or Sight.
+These commands will make the NPC object specified display as hidden or
+visible, even though not actually disabled per se. Hidden as in thief Hide
+skill, but unfortunately, not detectable by Ruwach or Sight.
As they are now, these commands are pointless, it is suggested to use
-'disablenpc'/'enablenpc', because these two commands actually unload the NPC
-sprite location and other accompanying data from memory when it is not used.
-However, you can use these for some quest ideas (such as cloaking NPCs talking
-while hidden then revealing.... you can wonder around =P
+'disablenpc'/'enablenpc', because these two commands actually unload the
+NPC sprite location and other accompanying data from memory when it is not
+used. However, you can use these for some quest ideas (such as cloaking
+NPCs talking while hidden then revealing... you can wonder around =P).
---------------------------------------
*doevent "<NPC object name>::<event label>";
-This command will start a new execution thread in a specified NPC object at the
-specified label. The execution of the script running this command will not stop,
-and the event called by the 'doevent' command will not run until the invoking
-script has terminated. No parameters may be passed with a doevent call.
+This command will start a new execution thread in a specified NPC object
+at the specified label. The execution of the script running this command
+will not stop, and the event called by the 'doevent' command will not run
+until the invoking script has terminated. No parameters may be passed with
+a doevent call.
-The script of the NPC object invoked in this manner will run as if it's been
-invoked by the RID that was active in the script that issued a 'doevent'. As
-such, the command will not work if an RID is not attached.
+The script of the NPC object invoked in this manner will run as if it's
+been invoked by the RID that was active in the script that issued a
+'doevent'. As such, the command will not work if an RID is not attached.
place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
mes "This is what you will see when you click me";
@@ -5549,19 +5764,21 @@ such, the command will not work if an RID is not attached.
*donpcevent "<NPC object name>::<event label>";
-This command invokes the event label code within an another NPC or NPCs. It
-starts a separate instance of execution, and the invoking NPC will resume
-execution its immediately.
+This command invokes the event label code within an another NPC or NPCs.
+It starts a separate instance of execution, and the invoking NPC will
+resume execution its immediately.
-If the supplied event label has the form "NpcName::OnLabel", then only given
-NPC's event label will be invoked (much like 'goto' into another NPC). If the
-form is "::OnLabel" (NPC name omitted), the event code of all NPCs with given
-label will be invoked, one after another. In both cases the invoked script
-will run without an attached RID, whether or not the invoking script was
-attached to a player. The event label name is required to start with "On".
+If the supplied event label has the form "NpcName::OnLabel", then only
+given NPC's event label will be invoked (much like 'goto' into another
+NPC). If the form is "::OnLabel" (NPC name omitted), the event code of all
+NPCs with given label will be invoked, one after another. In both cases
+the invoked script will run without an attached RID, whether or not the
+invoking script was attached to a player. The event label name is required
+to start with "On".
-This command can be used to make other NPCs act, as if they were responding to
-the invoking NPC's actions, such as using an emotion or talking.
+This command can be used to make other NPCs act, as if they were
+responding to the invoking NPC's actions, such as using an emotion or
+talking.
place,100,100,1%TAB%script%TAB%NPC%TAB%53,{
mes "Hey NPC2 copy what I do";
@@ -5583,8 +5800,8 @@ the invoking NPC's actions, such as using an emotion or talking.
end;
}
-Whichever of the both NPCs is talked to, both will show a random emotion at the
-same time.
+Whichever of the both NPCs is talked to, both will show a random emotion
+at the same time.
Command returns 1 or 0 on success and failure.
A debug message also shows on the console when no events are triggered.
@@ -5600,10 +5817,10 @@ It is an approximation of official server script language's 'cmdothernpc'.
*npctalk "<message>";
-This command will display a message to the surrounding area as if the NPC object
-running it was a player talking - that is, above their head and in the chat
-window. The display name of the NPC will get appended in front of the message to
-complete the effect.
+This command will display a message to the surrounding area as if the NPC
+object running it was a player talking - that is, above their head and in
+the chat window. The display name of the NPC will get appended in front of
+the message to complete the effect.
// This will make everyone in the area see the NPC greet the character
// who just invoked it.
@@ -5629,21 +5846,23 @@ Size is 0 = normal 1 = small 2 = big.
*deltimer "NPC::OnLabel";
*addtimercount <ticks>,"NPC::OnLabel";
-These commands will create, destroy, and delay a countdown timer - 'addtimer' to
-create, 'deltimer' to destroy and 'addtimercount' to delay it by the specified
-number of ticks. For all three cases, the event label given is the identifier of
-that timer. The timer runs on the character object that is attached to the script,
-and can have multiple instances. When the label is run, it is run as if the player that
-the timer runs on has clicked the NPC.
+These commands will create, destroy, and delay a countdown timer -
+'addtimer' to create, 'deltimer' to destroy and 'addtimercount' to delay
+it by the specified number of ticks. For all three cases, the event label
+given is the identifier of that timer. The timer runs on the character
+object that is attached to the script, and can have multiple instances.
+When the label is run, it is run as if the player that the timer runs on
+has clicked the NPC.
-When this timer runs out, a new execution thread will start in the specified NPC
-object at the specified label.
+When this timer runs out, a new execution thread will start in the
+specified NPC object at the specified label.
The ticks are given in 1/1000ths of a second.
-One more thing. These timers are stored as part of player data. If the player
-logs out, all of these get immediately deleted, without executing the script.
-If this behavior is undesirable, use some other timer mechanism (like 'sleep').
+One more thing. These timers are stored as part of player data. If the
+player logs out, all of these get immediately deleted, without executing
+the script. If this behavior is undesirable, use some other timer
+mechanism (like 'sleep').
Example:
<NPC Header> {
@@ -5668,53 +5887,59 @@ On5secs:
*attachnpctimer {"<character name>"};
*detachnpctimer {"<NPC name>"};
-This set of commands and functions will create and manage an NPC-based timer.
-The NPC name may be omitted, in which case the calling NPC is used as target.
+This set of commands and functions will create and manage an NPC-based
+timer. The NPC name may be omitted, in which case the calling NPC is used
+as target.
-Contrary to addtimer/deltimer commands which let you have many different timers
-referencing different labels in the same NPC, each with their own countdown,
-'initnpctimer' can only have one per NPC object. But it can trigger many labels
-and let you know how many were triggered already and how many still remain.
+Contrary to addtimer/deltimer commands which let you have many different
+timers referencing different labels in the same NPC, each with their own
+countdown, 'initnpctimer' can only have one per NPC object. But it can
+trigger many labels and let you know how many were triggered already and
+how many still remain.
-This timer is counting up from 0 in ticks of 1/1000ths of a second each. Upon
-creating this timer, the execution will not stop, but will happily continue
-onward. The timer will then invoke new execution threads at labels
-"OnTimer<time>:" in the NPC object it is attached to.
+This timer is counting up from 0 in ticks of 1/1000ths of a second each.
+Upon creating this timer, the execution will not stop, but will happily
+continue onward. The timer will then invoke new execution threads at
+labels "OnTimer<time>:" in the NPC object it is attached to.
To create the timer, use the 'initnpctimer', which will start it running.
-'stopnpctimer' will pause the timer, without clearing the current tick, while
-'startnpctimer' will let the paused timer continue.
-
-By default timers do not have a RID attached, which lets them continue even
-if the player that started them logs off. To attach a RID to a timer, you can
-either use the optional "attach flag" when using 'initnpctimer/startnpctimer',
-or do it manually by using 'attachnpctimer'. Likewise, the optional flag of
-stopnpctimer lets you detach any RID after stopping the timer, and by using
-'detachnpctimer' you can detach a RID at any time.
-
-Normally there is only a single timer per NPC, but as an exception, as long as
-you attach a player to the timer, you can have multiple timers running at once,
-because these will get stored on the players instead of the NPC.
+'stopnpctimer' will pause the timer, without clearing the current tick,
+while 'startnpctimer' will let the paused timer continue.
+
+By default timers do not have a RID attached, which lets them continue
+even if the player that started them logs off. To attach a RID to a timer,
+you can either use the optional "attach flag" when using
+'initnpctimer/startnpctimer', or do it manually by using 'attachnpctimer'.
+Likewise, the optional flag of stopnpctimer lets you detach any RID after
+stopping the timer, and by using 'detachnpctimer' you can detach a RID at
+any time.
+
+Normally there is only a single timer per NPC, but as an exception, as
+long as you attach a player to the timer, you can have multiple timers
+running at once, because these will get stored on the players instead of
+the NPC.
NOTE: You need to attach the RID before the timer _before_ you start it to
get a player-attached timer. Otherwise it'll stay a NPC timer (no effect).
-If the player that is attached to the npctimer logs out, the "OnTimerQuit:"
-event label of that NPC will be triggered, so you can do the appropriate
-cleanup (the player is still attached when this event is triggered).
+If the player that is attached to the npctimer logs out, the
+"OnTimerQuit:" event label of that NPC will be triggered, so you can do
+the appropriate cleanup (the player is still attached when this event is
+triggered).
-The 'setnpctimer' command will explicitly set the timer to a given tick.
+The 'setnpctimer' command will explicitly set the timer to a given tick.
'getnpctimer' provides timer information. Its parameter defines what type:
0 - Will return the current tick count of the timer.
1 - Will return 1 if there are remaining "OnTimer<ticks>:" labels in the
specified NPC waiting for execution.
- 2 - Will return the number of times the timer has triggered and will trigger
- an "OnTimer<tick>:" label in the specified NPC.
+ 2 - Will return the number of times the timer has triggered and will
+ trigger an "OnTimer<tick>:" label in the specified NPC.
Example 1:
<NPC Header> {
- // We need to use attachnpctimer because the mes command below needs RID attach
+ // We need to use attachnpctimer because the mes command below
+ // needs RID attach
attachnpctimer;
initnpctimer;
npctalk "I cant talk right now, give me 10 seconds";
@@ -5739,7 +5964,8 @@ Example 1:
mes "[Man]";
mes "Ok we can talk now";
detachnpctimer;
- // and remember attachnpctimer and detachnpctimer can only use while the NPC timer is not running !
+ // and remember attachnpctimer and detachnpctimer can only be used
+ // while the NPC timer is not running!
}
Example 2:
@@ -5749,13 +5975,15 @@ Example 2:
// You have to use 'initnpctimer' instead of 'setnpctimer 0'.
// This is equal to 'setnpctimer 0' + 'startnpctimer'.
- // Alternatively, you can also insert another 'OnTimer15001' label so that the timer won't stop. */
+ // Alternatively, you can also insert another 'OnTimer15001' label
+ // so that the timer won't stop.
initnpctimer;
end;
- // This OnInit label will run when the script is loaded, so that the timer
- // is initialized immediately as the server starts. It is dropped back to 0
- // every time the NPC says something, so it will cycle continuously.
+ // This OnInit label will run when the script is loaded, so that the
+ // timer is initialized immediately as the server starts. It is
+ // dropped back to 0 every time the NPC says something, so it will
+ // cycle continuously.
OnInit:
initnpctimer;
end;
@@ -5764,7 +5992,8 @@ Example 3:
mes "[Man]";
mes "I have been waiting "+(getnpctimer(0)/1000)+" seconds for you.";
- // We divide the timer returned by 1000 to convert milliseconds to seconds.
+ // We divide the timer returned by 1000 to convert milliseconds to
+ // seconds.
close;
Example 4:
@@ -5773,8 +6002,8 @@ Example 4:
mes "Ok, I will let you have 30 more seconds...";
close2;
setnpctimer (getnpctimer(0)-30000);
- // Notice the 'close2'. If there were a 'next' there the timer would be
- // changed only after the player pressed the 'next' button.
+ // Notice the 'close2'. If there were a 'next' there the timer would
+ // be changed only after the player pressed the 'next' button.
end;
---------------------------------------
@@ -5784,27 +6013,32 @@ Example 4:
*awake "<NPC name>";
These commands are used to control the pause of a NPC.
-sleep and sleep2 will pause the script for the given amount of milliseconds.
-Awake is used to cancel a sleep. When awake is called on a NPC it will run as
-if the sleep timer ran out, and thus making the script continue. Sleep and sleep2
-basically do the same, but the main difference is that sleep will not keep the rid,
-while sleep2 does.
+sleep and sleep2 will pause the script for the given amount of
+milliseconds.
+Awake is used to cancel a sleep. When awake is called on a NPC it will run
+as if the sleep timer ran out, and thus making the script continue. Sleep
+and sleep2 basically do the same, but the main difference is that sleep
+will not keep the rid, while sleep2 does.
Examples:
- sleep 10000; //pause the script for 10 seconds and ditch the RID (so no player is attached anymore)
- sleep2 5000; //pause the script for 5 seconds, and continue with the RID attached.
- awake "NPC"; //Cancels any running sleep timers on the NPC 'NPC'.
+ // This will pause the script for 10 seconds and ditch the RID
+ // (so no player is attached anymore)
+ sleep 10000;
+ // Pauses the script for 5 seconds, and continue with the RID attached.
+ sleep2 5000;
+ //Cancels any running sleep timers on the NPC 'NPC'.
+ awake "NPC";
---------------------------------------
*progressbar "<color>",<seconds>;
-This command works almost like sleep2, but displays a progress bar
-above the head of the currently attached character (like cast bar).
-Once the given amount of seconds passes, the script resumes. If the
-character moves while the progress bar progresses, it is aborted and
-the script ends. The color format is in RGB (0xRRGGBB). The color is
-currently ignored by the client and appears always green.
+This command works almost like sleep2, but displays a progress bar above
+the head of the currently attached character (like cast bar). Once the
+given amount of seconds passes, the script resumes. If the character moves
+while the progress bar progresses, it is aborted and the script ends. The
+color format is in RGB (0xRRGGBB). The color is currently ignored by the
+client and appears always green.
---------------------------------------
//
@@ -5818,51 +6052,59 @@ This command will broadcast a message to all or most players, similar to
announce "This will be shown to everyone at all in yellow.",0;
-The region the broadcast is heard in (target), source of the broadcast
-and the color the message will come up as is determined by the flags.
+The region the broadcast is heard in (target), source of the broadcast and
+the color the message will come up as is determined by the flags.
-The flag values are coded as constants in db/const.txt to make them easier to use.
+The flag values are coded as constants in db/const.txt to make them easier
+to use.
Target flags:
-- bc_all: Broadcast message is sent server-wide (default).
-- bc_map: Message is sent to everyone in the same map as the source of the broadcast (see below).
+- bc_all: Broadcast message is sent server-wide (default).
+- bc_map: Message is sent to everyone in the same map as the source of
+ the broadcast (see below).
- bc_area: Message is sent to players in the vicinity of the source.
- bc_self: Message is sent only to current player.
You cannot use more than one target flag.
Source flags:
-- bc_pc: Broadcast source is the attached player (default).
-- bc_npc: Broadcast source is the NPC, not the player attached to the script
- (useful when a player is not attached or the message should be sent to those
- nearby the NPC).
+- bc_pc: Broadcast source is the attached player (default).
+- bc_npc: Broadcast source is the NPC, not the player attached to the
+ script (useful when a player is not attached or the message
+ should be sent to those nearby the NPC).
You cannot use more than one source flag.
Special flags:
- bc_yellow: Broadcast will be displayed in yellow color (default).
-- bc_blue: Broadcast will be displayed in blue color.
-- bc_woe: Indicates that this broadcast is 'WoE Information' that can be disabled client-side.
-Due to the way client handles broadcasts, it is impossible to set both bc_blue and bc_woe.
+- bc_blue: Broadcast will be displayed in blue color.
+- bc_woe: Indicates that this broadcast is 'WoE Information' that can
+ be disabled client-side.
+Due to the way client handles broadcasts, it is impossible to set both
+bc_blue and bc_woe.
+
+The optional parameters allow usage of broadcasts in custom colors,
+font-weights, sizes etc. If any of the optional parameters is used,
+special flag is ignored. Optional parameters may not work well (or at all)
+depending on a game client used.
-The optional parameters allow usage of broadcasts in custom colors, font-weights, sizes etc.
-If any of the optional parameters is used, special flag is ignored.
-Optional parameters may not work well (or at all) depending on a game client used.
+The color parameter is a single number which can be in hexadecimal
+notation.
-The color parameter is a single number which can be in hexadecimal notation.
For example:
announce "This will be shown to everyone at all in green.",bc_all,0x00FF00;
-Will display a global announce in green. The color format is in RGB (0xRRGGBB).
+Will display a global announce in green. The color format is in RGB
+(0xRRGGBB).
In official scripts only two font-weights (types) are used:
- normal (FW_NORMAL = 400, default),
- - bold (FW_BOLD = 700).
+ - bold (FW_BOLD = 700).
Default font size is 12.
-Using this for private messages to players is probably not that good an idea,
-but it can be used instead in NPCs to "preview" an announce.
+Using this for private messages to players is probably not that good an
+idea, but it can be used instead in NPCs to "preview" an announce.
- // This will be a private message to the player using the NPC that made the
- // announcement
+ // This will be a private message to the player using the NPC that
+ // made the announcement
announce "This is my message just for you",bc_blue|bc_self;
// This will be shown on everyones screen that is in sight of the NPC.
@@ -5872,17 +6114,19 @@ but it can be used instead in NPCs to "preview" an announce.
*mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
-This command will work like 'announce' but will only broadcast to characters
-currently residing on the specified map. The flag and optional parameters
-parameters are the same as in 'announce', but target and source flags are ignored.
+This command will work like 'announce' but will only broadcast to
+characters currently residing on the specified map. The flag and optional
+parameters parameters are the same as in 'announce', but target and source
+flags are ignored.
---------------------------------------
*areaannounce "<map name>",<x1>,<y1>,<x2>,<y2>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};
This command works like 'announce' but will only broadcast to characters
-residing in the specified x1/y1-x2/y2 rectangle on the map given. The flags and
-optional parameters are the same as in 'announce', but target and source flags are ignored.
+residing in the specified x1/y1-x2/y2 rectangle on the map given. The
+flags and optional parameters are the same as in 'announce', but target
+and source flags are ignored.
areaannounce "prt_church",0,0,350,350,"God's in his heaven, all right with the world",0;
@@ -5891,7 +6135,8 @@ optional parameters are the same as in 'announce', but target and source flags a
*callshop "<name>",<option>;
These are a series of commands used to create dynamic shops.
-The callshop function calls a invisible shop (view -1) as if the player clicked on it.
+The callshop function calls an invisible shop (view -1) as if the player
+clicked on it.
For the options on callShop:
0 = The normal window (buy, sell and cancel)
@@ -5900,36 +6145,40 @@ For the options on callShop:
Example:
-callshop "DaShop",1; //Will call the shop named DaShop and opens the buy menu.
+//Will call the shop named DaShop and opens the buy menu.
+callshop "DaShop",1;
-The shop which is called by callshop (as long as an npcshop* command is executed
-from that NPC (see note 1)) will trigger the labels OnBuyItem and OnSellitem. These
-labels can take over handling for relatively the buying of items from the shop
-and selling the items to a shop. Via these labels you can customize the way an item
-is bought or sold by a player.
-In the OnBuyItem, two arrays are set (@bought_nameid and @bought_quantity), which
-hold information about the name id (item id) sold and the amount sold of it. Same
-goes for the OnSellItem label, only the variables are named different
-(@sold_nameid, @sold_quantity, @sold_refine, @sold_attribute, @sold_identify,
-@sold_card1, @sold_card2, @sold_card3, @sold_card4). An example on a shop comes
-with Hercules, and can be found in the doc/sample/npc_dynamic_shop.txt file.
+The shop which is called by callshop (as long as an npcshop* command is
+executed from that NPC (see note 1)) will trigger the labels OnBuyItem and
+OnSellitem. These labels can take over handling for relatively the buying
+of items from the shop and selling the items to a shop. Via these labels
+you can customize the way an item is bought or sold by a player.
+
+In the OnBuyItem, two arrays are set (@bought_nameid and
+@bought_quantity), which hold information about the name id (item id) sold
+and the amount sold of it. Same goes for the OnSellItem label, only the
+variables are named different (@sold_nameid, @sold_quantity, @sold_refine,
+@sold_attribute, @sold_identify, @sold_card1, @sold_card2, @sold_card3,
+@sold_card4). An example on a shop comes with Hercules, and can be found
+in the doc/sample/npc_dynamic_shop.txt file.
-This example shows how to use the labels and their set variables to create a dynamic shop.
+This example shows how to use the labels and their set variables to create
+a dynamic shop.
-Note 1: These labels will only be triggered if a npcshop* command is executed, this is
-because these commands set a special data on the shop NPC,named master_nd in the source.
-The OnSellItem and OnBuyItem are triggered in the NPC whose master_nd is given in the shop.
-This was found out thanks to 'Hondacrx', noticing the OnBuyItem wasn't triggered unless
-npcshopitem was used. After rechecking the source, I found what caused this.
+Note 1: These labels will only be triggered if a npcshop* command is
+executed, this is because these commands set a special data on the shop
+NPC, named master_nd in the source.
+The OnSellItem and OnBuyItem are triggered in the NPC whose master_nd is
+given in the shop.
---------------------------------------
*npcshopitem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}}
-This command lets you override the contents of an existing NPC shop or cashshop. The
-current sell list will be wiped, and only the items specified with the price
-specified will be for sale.
+This command lets you override the contents of an existing NPC shop or
+cashshop. The current sell list will be wiped, and only the items
+specified with the price specified will be for sale.
The function returns 1 if shop was updated successfully, or 0 if not found.
@@ -5939,9 +6188,9 @@ Note that you cannot use -1 to specify default selling price!
*npcshopadditem "<name>",<item id>,<price>{,<item id>,<price>{,<item id>,<price>{,...}}}
-This command will add more items at the end of the selling list for the
-specified NPC shop or cashshop. If you specify an item already for sell, that item will
-appear twice on the sell list.
+This command will add more items at the end of the selling list for the
+specified NPC shop or cashshop. If you specify an item already for sell,
+that item will appear twice on the sell list.
The function returns 1 if shop was updated successfully, or 0 if not found.
@@ -5952,10 +6201,10 @@ Note that you cannot use -1 to specify default selling price!
*npcshopdelitem "<name>",<item id>{,<item id>{,<item id>{,...}}}
This command will remove items from the specified NPC shop or cashshop.
-If the item to remove exists more than once on the shop, all instances will be
-removed.
+If the item to remove exists more than once on the shop, all instances
+will be removed.
-Note that the function returns 1 even if no items were removed. The return
+Note that the function returns 1 even if no items were removed. The return
value is only to confirm that the shop was indeed found.
---------------------------------------
@@ -5963,16 +6212,16 @@ value is only to confirm that the shop was indeed found.
*npcshopattach "<name>"{,<flag>}
This command will attach the current script to the given NPC shop.
-When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem"
-of your script will be executed whenever a player buys/sells from the shop.
-Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[]
-and @sold_quantity[] will be filled up with the items and quantities
-bought/sold.
+When a script is attached to a shop, the events "OnBuyItem" and
+"OnSellItem" of your script will be executed whenever a player buys/sells
+from the shop. Additionally, the arrays @bought_nameid[],
+@bought_quantity[] or @sold_nameid[] and @sold_quantity[] will be filled
+up with the items and quantities bought/sold.
-The optional parameter specifies whether to attach ("1") or detach ("0") from
-the shop (the default is to attach). Note that detaching will detach any NPC
-attached to the shop, even if it's from another script, while attaching will
-override any other script that may be already attached.
+The optional parameter specifies whether to attach ("1") or detach ("0")
+from the shop (the default is to attach). Note that detaching will detach
+any NPC attached to the shop, even if it's from another script, while
+attaching will override any other script that may be already attached.
The function returns 0 if the shop was not found, 1 otherwise.
@@ -5984,45 +6233,48 @@ This command will create a chat room, owned by the NPC object running this
script and displayed above the NPC sprite.
The maximum length of a chat room name is 60 letters.
-The limit is the maximum number of people allowed to enter the chat room.
-The attached NPC is included in this count. If the optional event and trigger
-parameters are given, the event label ("<NPC object name>::<label name>")
-will be invoked as if with a 'doevent' upon the number of people in the chat
-room reaching the given triggering amount.
+The limit is the maximum number of people allowed to enter the chat room.
+The attached NPC is included in this count. If the optional event and
+trigger parameters are given, the event label
+("<NPC object name>::<label name>") will be invoked as if with a 'doevent'
+upon the number of people in the chat room reaching the given triggering
+amount.
-// The NPC will just show a box above its head that says "Hello World", clicking
-// it will do nothing, since the limit is zero.
+// The NPC will just show a box above its head that says "Hello World",
+// clicking it will do nothing, since the limit is zero.
waitingroom "Hello World",0;
-// The NPC will have a box above its head, it will say "Disco - Waiting Room"
-// and will have 8 waiting slots. Clicking this will enter the chat room, where
-// the player will be able to wait until 7 players accumulate. Once this happens,
-// it will cause the NPC "Bouncer" run the label "OnStart".
+// The NPC will have a box above its head, with "Disco - Waiting Room"
+// written on it, and will have 8 waiting slots. Clicking this will enter
+// the chat room, where the player will be able to wait until 7 players
+// accumulate. Once this happens, it will cause the NPC "Bouncer" run the
+// label "OnStart".
waitingroom "Disco - Waiting Room",8,"Bouncer::OnStart",7;
-// The NPC will have a box above its head, it will say "Party - Waiting Room"
-// and will have 8 waiting slots. Clicking this will allow a player who has
-// 5000 zeny and lvl 50~99 to enter the chat room, where the player will be
-// able to wait until 7 players accumulate. Once this happens, it will cause
-// the NPC "Bouncer" run the label "OnStart".
+// The NPC will have a box above its head, with "Party - Waiting Room"
+// written on it, and will have 8 waiting slots. Clicking this will allow
+// a player who has 5000 zeny and lvl 50~99 to enter the chat room, where
+// the player will be able to wait until 7 players accumulate. Once this
+// happens, it will cause the NPC "Bouncer" run the label "OnStart".
waitingroom "Party - Waiting Room",8,"Bouncer::OnStart",7,5000,50,99;
-Creating a waiting room does not stop the execution of the script and it will
-continue to the next line.
+Creating a waiting room does not stop the execution of the script and it
+will continue to the next line.
-For more examples see the 2-1 and 2-2 job quest scripts which make extensive use
-of waiting rooms.
+For more examples see the 2-1 and 2-2 job quest scripts which make
+extensive use of waiting rooms.
---------------------------------------
*delwaitingroom {"<NPC object name"};
This command will delete a waiting room. If no parameter is given, it will
-delete a waiting room attached to the NPC object running this command, if it is,
-it will delete a waiting room owned by another NPC object. This is the only way
-to get rid of a waiting room, nothing else will cause it to disappear.
+delete a waiting room attached to the NPC object running this command, if
+it is, it will delete a waiting room owned by another NPC object. This is
+the only way to get rid of a waiting room, nothing else will cause it to
+disappear.
It's not clear what happens to a waiting room if the NPC is disabled with
'disablenpc', by the way.
@@ -6035,28 +6287,28 @@ It's not clear what happens to a waiting room if the NPC is disabled with
*disablearena;
This will enable and disable triggering the waiting room event (see
-'waitingroom') respectively. Optionally giving an NPC object name will do that
-for a specified NPC object. The chat room will not disappear when triggering is
-disabled and enabled in this manner and players will not be kicked out of it.
-Enabling a chat room event will also cause it to immediately check whether the
-number of users in it exceeded the trigger amount and trigger the event
-accordingly.
+'waitingroom') respectively. Optionally giving an NPC object name will do
+that for a specified NPC object. The chat room will not disappear when
+triggering is disabled and enabled in this manner and players will not be
+kicked out of it. Enabling a chat room event will also cause it to
+immediately check whether the number of users in it exceeded the trigger
+amount and trigger the event accordingly.
Normally, whenever a waiting room was created to make sure that only one
character is, for example, trying to pass a job quest trial, and no other
characters are present in the room to mess up the script.
-The 'enablearena'/'disablearena' commands are just aliases with no parameter.
-These are supposedly left here for compatibility with official server scripts,
-but no Hercules script uses these at the moment.
+The 'enablearena'/'disablearena' commands are just aliases with no
+parameter. These are supposedly left here for compatibility with official
+server scripts, but no Hercules script uses these at the moment.
---------------------------------------
*getwaitingroomstate(<information type>{,"<NPC object name>"})
This function will return information about the waiting room state for the
-attached waiting room or for a waiting room attached to the specified NPC if
-any.
+attached waiting room or for a waiting room attached to the specified NPC
+if any.
The valid information types are:
@@ -6067,30 +6319,31 @@ The valid information types are:
3 - Will return 1 if the waiting room is currently disabled.
0 otherwise.
4 - The Title of the waiting room (string)
- 5 - Password of the waiting room, if any. Pointless, since there is no way to
- set a password on a waiting room right now.
+ 5 - Password of the waiting room, if any. Pointless, since there is no
+ way to set a password on a waiting room right now.
16 - Event name of the waiting room (string)
32 - Whether or not the waiting room is full.
- 33 - Whether the amount of users in the waiting room is higher than the trigger
- number.
+ 33 - Whether the amount of users in the waiting room is higher than the
+ trigger number.
---------------------------------------
*warpwaitingpc "<map name>",<x>,<y>{,<number of people>};
-This command will warp the amount of characters equal to the trigger number of
-the waiting room chat attached to the NPC object running this command to the
-specified map and coordinates, kicking them out of the chat. Those waiting the
-longest will get warped first. It can also do a random warp on the same map
-("Random" instead of map name) and warp to the save point ("SavePoint").
+This command will warp the amount of characters equal to the trigger
+number of the waiting room chat attached to the NPC object running this
+command to the specified map and coordinates, kicking them out of the
+chat. Those waiting the longest will get warped first. It can also do a
+random warp on the same map ("Random" instead of map name) and warp to the
+save point ("SavePoint").
-The list of characters to warp is taken from the list of the chat room members.
-Those not in the chat room will not be considered even if they are talking to
-the NPC in question. If the number of people is given, exactly this much people
-will be warped.
+The list of characters to warp is taken from the list of the chat room
+members. Those not in the chat room will not be considered even if they
+are talking to the NPC in question. If the number of people is given,
+exactly this much people will be warped.
-This command can also keep track of who just got warped. It does this by setting
-special variables:
+This command can also keep track of who just got warped. It does this by
+setting special variables:
$@warpwaitingpc[] is an array containing the account_id numbers of the
characters who were just warped.
@@ -6098,9 +6351,9 @@ $@warpwaitingpcnum contains the number of the character it just warped.
See also 'getpartymember' for advice on what to do with those variables.
-The obvious way of using this effectively would be to set up a waiting room for
-two characters to be warped onto a random PVP map for a one-on-one duel, for
-example.
+The obvious way of using this effectively would be to set up a waiting
+room for two characters to be warped onto a random PVP map for a
+one-on-one duel, for example.
---------------------------------------
@@ -6112,33 +6365,34 @@ This command kicks everybody out of a specified waiting room chat.
*setmapflagnosave "<map name>","<alternate map name>",<x>,<y>;
-This command sets the 'nosave' flag for the specified map and also gives an
-alternate respawn-upon-relogin point.
+This command sets the 'nosave' flag for the specified map and also gives
+an alternate respawn-upon-relogin point.
-It does not make a map impossible to make a save point on as you would normally
-think, 'savepoint' will still work. It will, however, make the specified map
-kick the reconnecting players off to the alternate map given to the coordinates
-specified.
+It does not make a map impossible to make a save point on as you would
+normally think, 'savepoint' will still work. It will, however, make the
+specified map kick the reconnecting players off to the alternate map given
+to the coordinates specified.
---------------------------------------
*setmapflag "<map name>",<flag>{,<val>};
-This command marks a specified map with a map flag given. Map flags alter the
-behavior of the map, you can see the list of the available ones in
+This command marks a specified map with a map flag given. Map flags alter
+the behavior of the map, you can see the list of the available ones in
'db/const.txt' under 'mf_'.
-The map flags alter the behavior of the map regarding teleporting (mf_nomemo,
-mf_noteleport, mf_nowarp, mf_nogo), storing location when disconnected
-(mf_nosave), dead branch usage (mf_nobranch), penalties upon death
-(mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp, mf_pvp_noparty,
-mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty), ability to use
-skills or open up trade deals (mf_notrade, mf_novending, mf_noskill, mf_noicewall),
-current weather effects (mf_snow, mf_fog, mf_sakura, mf_leaves, mf_rain, mf_clouds,
-mf_fireworks) and whether night will be in effect on this map (mf_nightenabled).
+The map flags alter the behavior of the map regarding teleporting
+(mf_nomemo, mf_noteleport, mf_nowarp, mf_nogo), storing location when
+disconnected (mf_nosave), dead branch usage (mf_nobranch), penalties upon
+death (mf_nopenalty, mf_nozenypenalty), PVP behavior (mf_pvp,
+mf_pvp_noparty, mf_pvp_noguild), WoE behavior (mf_gvg,mf_gvg_noparty),
+ability to use skills or open up trade deals (mf_notrade, mf_novending,
+mf_noskill, mf_noicewall), current weather effects (mf_snow, mf_fog,
+mf_sakura, mf_leaves, mf_rain, mf_clouds, mf_fireworks) and whether night
+will be in effect on this map (mf_nightenabled).
-The val optional parameter is as the mapflags variable when one exists,
-it may be a number or a string depending on the mapflag in question.
+The val optional parameter is as the mapflags variable when one exists, it
+may be a number or a string depending on the mapflag in question.
---------------------------------------
@@ -6147,13 +6401,15 @@ it may be a number or a string depending on the mapflag in question.
This command removes a mapflag from a specified map.
See 'setmapflag' for a list of mapflags.
-The zone optional parameter is used to remove the zone from restricted mapflags.
+The zone optional parameter is used to remove the zone from restricted
+mapflags.
---------------------------------------
*getmapflag("<map name>",<flag>)
-This command checks the status of a given mapflag and returns the mapflag's state.
+This command checks the status of a given mapflag and returns the
+mapflag's state.
0 means OFF, and 1 means ON. See 'setmapflag' for a list of mapflags.
---------------------------------------
@@ -6162,14 +6418,16 @@ This command checks the status of a given mapflag and returns the mapflag's stat
*getbattleflag("<battle flag>")
Sets or gets the value of the given battle flag.
-Battle flags are the flags found in the battle/*.conf files and is also used in Lupus' variable rates script.
+Battle flags are the flags found in the battle/*.conf files and is also
+used in Lupus' variable rates script.
Examples:
// Will set the base experience rate to 20x (2000%)
setBattleFlag "base_exp_rate",2000;
-// Will return the value of the base experience rate (when used after the above example, it would print 2000).
+// Will return the value of the base experience rate (when used after the
+// above example, it would print 2000).
mes getBattleFlag("base_exp_rate");
---------------------------------------
@@ -6177,22 +6435,24 @@ Examples:
*warpportal <x>,<y>,"<mapname>",<x>,<y>;
Creates a warp Portal as if a acolyte class character did it.
-The first x and y is the place of the warp portal on the map where the NPC is on
-The mapname and second x and y is the target area of the warp portal.
+The first x and y is the place of the warp portal on the map where the NPC
+is on the mapname and second x and y is the target area of the warp portal.
Examples:
-// Will create a warp portal on the NPC's map at 150,150 leading to prontera, coords 150,180.
+// Will create a warp portal on the NPC's map at 150,150
+// leading to prontera, coords 150,180.
warpportal 150,150,"prontera",150,180;
---------------------------------------
*mapwarp "<from map>","<to map>",<x>,<y>{,<type>,<ID>};
-This command will collect all characters located on the From map and warp them
-wholesale to the same point on the To map, or randomly distribute them there if
-the coordinates are zero. "Random" is understood as a special To map name and
-will mean randomly shuffling everyone on the same map.
+This command will collect all characters located on the From map and warp
+them wholesale to the same point on the To map, or randomly distribute
+them there if the coordinates are zero. "Random" is understood as a
+special To map name and will mean randomly shuffling everyone on the same
+map.
Optionally, a type and ID can be specified. Available types are:
@@ -6202,7 +6462,7 @@ Optionally, a type and ID can be specified. Available types are:
Example:
-// Will warp all members of guild with ID 63 on map prontera to map alberta.
+// Will warp all members of guild with ID 63 on map prontera to alberta.
mapwarp "prontera","alberta",150,150,1,63;
---------------------------------------
@@ -6213,19 +6473,21 @@ Example:
*maprespawnguildid "<map name>",<guild id>,<flag>;
-This command goes through the specified map and for each player and monster
-found there does stuff.
+This command goes through the specified map and for each player and
+monster found there does stuff.
Flag is a bit-mask (add up numbers to get effects you want)
1 - warp all guild members to their save points.
2 - warp all non-guild members to their save points.
4 - remove all monsters which are not guardian or Emperium.
-Flag 7 will, therefore, mean 'wipe all mobs but guardians and the Emperium and
-kick all characters out', which is what the official scripts do upon castle
-surrender. Upon start of WoE, the scripts do 2 (warp all intruders out).
+Flag 7 will, therefore, mean 'wipe all mobs but guardians and the Emperium
+and kick all characters out', which is what the official scripts do upon
+castle surrender. Upon start of WoE, the scripts do 2 (warp out all people
+not in the guild that owns the castle).
-Characters not belonging to any guild will warp out regardless of the flag setting.
+Characters not belonging to any guild will be warped out regardless of the
+flag setting.
For examples, check the WoE scripts in the distribution.
@@ -6236,37 +6498,39 @@ For examples, check the WoE scripts in the distribution.
*agitstart2;
*agitend2;
-These four commands will start and end War of Emperium or War of Emperium SE.
+These four commands will start/end War of Emperium or War of Emperium SE.
-This is a bit more complex than it sounds, since the commands themselves won't
-actually do anything interesting, except causing all 'OnAgitStart:' and
-'OnAgitEnd:', or 'OnAgitStart2:' and 'OnAgitEnd2:' in the case of latter two
-commands, events to run everywhere, respectively. They are used as simple
-triggers to run a lot of complex scripts all across the server, and they,
-in turn, are triggered by clock with an 'OnClock<time>:' time-triggering label.
+This is a bit more complex than it sounds, since the commands themselves
+won't actually do anything interesting, except causing all 'OnAgitStart:'
+and 'OnAgitEnd:', or 'OnAgitStart2:' and 'OnAgitEnd2:' in the case of
+latter two commands, events to run everywhere, respectively. They are used
+as simple triggers to run a lot of complex scripts all across the server,
+and they, in turn, are triggered by clock with an 'OnClock<time>:'
+time-triggering label.
---------------------------------------
*gvgon "<map name>";
*gvgoff "<map name>";
-These commands will turn GVG mode for the specified maps on and off, setting up
-appropriate map flags. In GVG mode, maps behave as if during the time of WoE,
-even though WoE itself may or may not actually be in effect.
+These commands will turn GVG mode for the specified maps on and off,
+setting up appropriate map flags. In GVG mode, maps behave as if during
+the time of WoE, even though WoE itself may or may not actually be in
+effect.
---------------------------------------
*flagemblem <guild id>;
-This command only works when run by the NPC objects which have sprite id 722,
-which is a 3D guild flag sprite. If it isn't, the data will change, but nothing
-will be seen by anyone. If it is invoked in that manner, the emblem of the
-specified guild will appear on the flag, though, if any players are watching it
-at this moment, they will not see the emblem change until they move out of sight
-of the flag and return.
+This command only works when run by the NPC objects which have sprite id
+722, which is a 3D guild flag sprite. If it isn't, the data will change,
+but nothing will be seen by anyone. If it is invoked in that manner, the
+emblem of the specified guild will appear on the flag, though, if any
+players are watching it at this moment, they will not see the emblem
+change until they move out of sight of the flag and return.
-This is commonly used in official guildwar scripts with a function call which
-returns a guild id:
+This is commonly used in official guildwar scripts with a function call
+which returns a guild id:
// This will change the emblem on the flag to that of the guild that owns
// "guildcastle"
@@ -6277,21 +6541,23 @@ returns a guild id:
*guardian "<map name>",<x>,<y>,"<name to show>",<mob id>{,"<event label>"{,<guardian index>}};
-This command is roughly equivalent to 'monster', but is meant to be used with
-castle guardian monsters and will only work with them. It will set the guardian
-characteristics up according to the castle's investment values and otherwise
-set the things up that only castle guardians need.
+This command is roughly equivalent to 'monster', but is meant to be used
+with castle guardian monsters and will only work with them. It will set
+the guardian characteristics up according to the castle's investment
+values and otherwise set the things up that only castle guardians need.
Returns the id of the mob or 0 if an error occurred.
When 'guardian index' isn't supplied it produces a temporary guardian.
-Temporary guardians are not saved with the castle and can't be accessed by guardianinfo.
+Temporary guardians are not saved with the castle and can't be accessed by
+guardianinfo.
---------------------------------------
*guardianinfo("<map name>", <guardian number>, <type>);
-This function will return various info about the specified guardian, or -1
-if it fails for some reason. It is primarily used in the castle manager NPC.
+This function will return various info about the specified guardian, or -1
+if it fails for some reason. It is primarily used in the castle manager
+NPC.
Map name and guardian number (value between 0 and 7) define the target.
Type indicates what information to return:
@@ -6309,26 +6575,28 @@ Type indicates what information to return:
*npcwalkto <x>,<y>;
*npcstop;
-These commands will make the NPC object in question move around the map. As they
-currently are, they are a bit buggy and are not useful for much more than making
-an NPC move randomly around the map.
+These commands will make the NPC object in question move around the map.
+As they currently are, they are a bit buggy and are not useful for much
+more than making an NPC move randomly around the map.
'npcspeed' will set the NPCs walking speed to a specified value. As in the
-@speed GM command, 200 is the slowest possible speed while 0 is the fastest
-possible (instant motion). 100 is the default character walking speed.
-'npcwalkto' will start the NPC sprite moving towards the specified coordinates
-on the same map as it is currently on.
+@speed GM command, 200 is the slowest possible speed while 0 is the
+fastest possible (instant motion). 100 is the default character walking
+speed.
+'npcwalkto' will start the NPC sprite moving towards the specified
+coordinates on the same map as it is currently on. The script proceeds
+immediately after the NPC begins moving.
'npcstop' will stop the motion.
-While in transit, the NPC will be clickable, but invoking it will cause it to
-stop motion, which will make it's coordinates different from what the client
-computed based on the speed and motion coordinates. The effect is rather
-unnerving.
+While in transit, the NPC will be clickable, but invoking it will cause it
+to stop moving, which will make it's coordinates different from what the
+client computed based on the speed and motion coordinates. The effect is
+rather unnerving.
-Only a few NPC sprites have walking animations, and those that do, do not get
-the animation invoked when moving the NPC, due to the problem in the NPC walking
-code, which looks a bit silly. You might have better success by defining a job-
-sprite based sprite id in 'db/mob_avail.txt' with this.
+Only a few NPC sprites have walking animations, and those that do, do not
+get the animation invoked when moving the NPC, due to the problem in the
+NPC walking code, which looks a bit silly. You might have better success
+by defining a job-sprite based sprite id in 'db/mob_avail.txt' with this.
---------------------------------------
@@ -6336,14 +6604,16 @@ sprite based sprite id in 'db/mob_avail.txt' with this.
This command looks like the NPCWalkToxy function,but is a little different.
-While NPCWalkToXY just makes the NPC 'walk' to the coordinates given (which
-sometimes gives problems if the path isn't a straight line without objects),
-this command just moves the NPC. It basically warps out and in on the current
-and given spot. Direction can be used to change the NPC's facing direction.
+While NPCWalkToXY just makes the NPC 'walk' to the coordinates given
+(which sometimes gives problems if the path isn't a straight line without
+objects), this command just moves the NPC. It basically warps out and in
+on the current and given spot. Direction can be used to change the NPC's
+facing direction.
Example:
-// This will move Bugga from to the coordinates 100,20 (if those coordinates are legit).
+// This will move Bugga from to the coordinates 100,20 (if those
+// coordinates are legit).
moveNPC "Bugga",100,20;
---------------------------------------
@@ -6355,8 +6625,8 @@ Example:
*debugmes "<message>";
-This command will send the message to the server console (map-server window). It
-will not be displayed anywhere else.
+This command will send the message to the server console (map-server
+window). It will not be displayed anywhere else.
// Displays "NAME has clicked me!" in the map-server window.
debugmes strcharinfo(0)+" has clicked me!";
@@ -6365,31 +6635,31 @@ will not be displayed anywhere else.
*logmes "<message>";
-This command will write the message given to the map server NPC log file, as
-specified in 'conf/logs.conf'. In the TXT version of the server, the log
-file is 'log/npclog.log' by default. In the SQL version, if SQL logging is
-enabled, the message will go to the 'npclog' table, otherwise, it will go to the
-same log file.
+This command will write the message given to the map server NPC log file,
+as specified in 'conf/logs.conf'. If SQL logging is enabled, the message
+will go to the 'npclog' table.
-If logs are not enabled, nothing will happen.
+If logs are not enabled for NPCs, nothing will happen.
---------------------------------------
*globalmes "<message>"{,"<NPC name>"};
-This command will send a message to the chat window of all currently connected
-characters.
+This command will send a message to the chat window of all currently
+connected characters.
-If NPC name is specified, the message will be sent as if the sender would be
-the NPC with the said name.
+If NPC name is specified, the message will be sent as if the sender would
+be the NPC with the said name.
---------------------------------------
*rand(<number>{,<number>});
This function returns a number ...
-(if you specify one) ... randomly positioned between 0 and the number you specify -1.
-(if you specify two) ... randomly positioned between the two numbers you specify.
+(if you specify one) ... randomly positioned between 0 and the number you
+ specify -1.
+(if you specify two) ... randomly positioned between the two numbers you
+ specify.
rand(10) would result in 0,1,2,3,4,5,6,7,8 or 9
rand(0,9) would result in 0,1,2,3,4,5,6,7,8 or 9
@@ -6399,20 +6669,21 @@ rand(2,5) would result in 2,3,4 or 5
*viewpoint <action>,<x>,<y>,<point number>,<color>;
-This command will mark places on the mini map in the client connected to the
-invoking character. It uses the normal X and Y coordinates from the main map.
-The colors of the marks are defined using a hexadecimal number, same as the ones
-used to color text in 'mes' output, but are written as hexadecimal numbers in C.
-(They look like 0x<six numbers>.)
-
-Action is what you want to do with a point, 1 will set it, while 2 will clear
-it. 0 will also set it, but automatically removes the point after 15 seconds.
-Point number is the number of the point - you can have several. If more than
-one point is drawn at the same coordinates, they will cycle, which can be used
-to create flashing marks.
-
- // This command will show a mark at coordinates X 30 Y 40, is mark number 1,
- // and will be red.
+This command will mark places on the mini map in the client connected to
+the invoking character. It uses the normal X and Y coordinates from the
+main map. The colors of the marks are defined using a hexadecimal number,
+same as the ones used to color text in 'mes' output, but are written as
+hexadecimal numbers in C. (They look like 0x<six numbers>.)
+
+Action is what you want to do with a point, 1 will set it, while 2 will
+clear it. 0 will also set it, but automatically removes the point after 15
+seconds.
+Point number is the number of the point - you can have several. If more
+than one point is drawn at the same coordinates, they will cycle, which
+can be used to create flashing marks.
+
+ // This command will show a mark at coordinates X 30 Y 40, is mark
+ // number 1, and will be red.
viewpoint 1,30,40,1,0xFF0000;
@@ -6428,16 +6699,16 @@ And this is how you remove them:
viewpoint 2,35,45,2,0xFF0000;
viewpoint 2,40,50,3,0xFF0000;
-The client determines what it does with the points entirely, the server keeps no
-memory of where the points are set whatsoever.
+The client determines what it does with the points entirely, the server
+keeps no memory of where the points are set whatsoever.
---------------------------------------
*cutin "<filename>",<position>;
-This command will display a picture, usually an NPC illustration, also called
-cutin, for the currently attached client. The position parameter determines the
-placement of the illustration and takes following values:
+This command will display a picture, usually an NPC illustration, also
+called cutin, for the currently attached client. The position parameter
+determines the placement of the illustration and takes following values:
0 - bottom left corner
1 - bottom middle
@@ -6445,18 +6716,19 @@ placement of the illustration and takes following values:
3 - middle of screen in a movable window with an empty title bar
4 - middle of screen without the window header, but still movable
-The picture is read from data\texture\유저ì¸í„°íŽ˜ì´ìŠ¤\illust, from both the GRF archive
-and data folder, and is required to be a bitmap. The file extension .bmp can be
-omitted. Magenta color (#ff00ff) is considered transparent. There is no limit
-placed on the size of the illustrations by the client, although loading of large
-pictures (about 700x700 and larger) causes the client to freeze shortly (lag).
-Typically the size is about 320x480. New illustrations can be added by just
-putting the new file into the location above.
+The picture is read from data\texture\???????\illust, from both the
+GRF archive and data folder, and is required to be a bitmap. The file
+extension .bmp can be omitted. Magenta color (#ff00ff) is considered
+transparent. There is no limit placed on the size of the illustrations
+by the client, although loading of large pictures (about 700x700 and
+larger) causes the client to freeze shortly (lag). Typically the size is
+about 320x480. New illustrations can be added by just putting the new file
+into the location above.
-The client is able to display only one cutin at the same time and each new one
-will cause the old one to disappear. To delete the currently displayed
-illustration without displaying a new one, an empty file name and position 255
-must be used.
+The client is able to display only one cutin at the same time and each new
+one will cause the old one to disappear. To delete the currently displayed
+illustration without displaying a new one, an empty file name and position
+255 must be used.
// Displays the Comodo Kafra illustration in lower right corner.
cutin "kafra_07",2;
@@ -6472,10 +6744,10 @@ must be used.
*pet <pet id>;
-This command is used in all the item scripts for taming items. Running this
-command will make the pet catching cursor appear on the client connected to the
-invoking character, usable on the monsters with the specified pet ID number. It
-will still work outside an item script.
+This command is used in all the item scripts for taming items. Running
+this command will make the pet catching cursor appear on the client
+connected to the invoking character, usable on the monsters with the
+specified pet ID number. It will still work outside an item script.
A full list of pet IDs can be found inside 'db/pet_db.txt'
@@ -6484,55 +6756,57 @@ A full list of pet IDs can be found inside 'db/pet_db.txt'
*emotion <emotion number>{,<target>{,"<target name>"}};
This command makes an object display an emotion sprite above their own as
-if they were doing that emotion. For a full list of emotion numbers,
-see 'db/const.txt' under 'e_'. The not so obvious ones are 'e_what' (a question mark)
-and 'e_gasp' (the exclamation mark).
+if they were doing that emotion. For a full list of emotion numbers, see
+'db/const.txt' under 'e_'. The not so obvious ones are 'e_what' (a
+question mark) and 'e_gasp' (the exclamation mark).
-The optional target parameter specifies who will get the emotion on top of
-their head. If 0 (the default if omitted), the NPC in current use will show
+The optional target parameter specifies who will get the emotion on top of
+their head. If 0 (default if omitted), the NPC in current use will show
the emotion, if 1, the player that is running the script will display it.
-Target name parameter allows to display emotion on top of other NPC/PC without
-event labels. If specified name is not found, command does nothing.
+Target name parameter allows to display emotion on top of other NPC/PC
+without event labels. If specified name is not found, command does nothing.
---------------------------------------
*misceffect <effect number>;
This command, if run from an NPC object that has a sprite, will call up a
-specified effect number, centered on the NPC sprite. If the running code does
-not have an object ID (a 'floating' NPC) or is not running from an NPC object at
-all (an item script) the effect will be centered on the character who's RID got
-attached to the script, if any. For usable item scripts, this command will
-create an effect centered on the player using the item.
+specified effect number, centered on the NPC sprite. If the running code
+does not have an object ID (a 'floating' NPC) or is not running from an
+NPC object at all (an item script) the effect will be centered on the
+character who's RID got attached to the script, if any. For usable item
+scripts, this command will create an effect centered on the player using
+the item.
-A full list of known effects is found in 'doc/effect_list.txt'. The list of
-those that actually work may differ greatly between client versions.
+A full list of known effects is found in 'doc/effect_list.txt'. The list
+of those that actually work may differ greatly between client versions.
---------------------------------------
*soundeffect "<effect filename>",<type>;
*soundeffectall "<effect filename>",<type>{,"<map name>"}{,<x0>,<y0>,<x1>,<y1>};
-These two commands will play a sound effect to either the invoking character
-only ('soundeffect') or multiple characters ('soundeffectall'). If the running
-code does not have an object ID (a 'floating' NPC) or is not running from an NPC
-object at all (an item script) the sound will be centered on the character who's
-RID got attached to the script, if any. If it does, it will be centered on that
-object. (an NPC sprite)
+These two commands will play a sound effect to either the invoking
+character only ('soundeffect') or multiple characters ('soundeffectall').
+If the running code does not have an object ID (a 'floating' NPC) or is
+not running from an NPC object at all (an item script) the sound will be
+centered on the character who's RID got attached to the script, if any.
+If it does, it will be centered on that object. (an NPC sprite)
Effect filename is the filename in a GRF. It must have the .wav extension.
-It's not quite certain what the 'type' actually does, it is sent to the client
-directly. It probably determines which directory to play the effect from.
-It's certain that giving 0 for the number will play sound files from '\data\wav\',
-but where the other numbers will read from is unclear.
+It's not quite certain what the 'type' actually does, it is sent to the
+client directly. It probably determines which directory to play the effect
+from. It's certain that giving 0 for the number will play sound files from
+'\data\wav\', but where the other numbers will read from is unclear.
-The sound files themselves must be in the PCM format, and file names should also
-have a maximum length of 23 characters including the .wav extension:
+The sound files themselves must be in the PCM format, and file names
+should also have a maximum length of 23 characters including the .wav
+extension:
-soundeffect "1234567890123456789.wav", 0; // this will play the soundeffect
-soundeffect "12345678901234567890.wav", 0; // throw gravity error
+soundeffect "1234567890123456789.wav", 0; // will play the soundeffect
+soundeffect "12345678901234567890.wav", 0; // throws gravity error
You can add your own effects this way, naturally.
@@ -6541,14 +6815,14 @@ You can add your own effects this way, naturally.
*playBGM "<BGM filename>";
*playBGMall "<BGM filename>"{,"<map name>"{,<x0>,<y0>,<x1>,<y1>}};
-These two commands will play a Background Music to either the invoking character
-only ('playBGM') or multiple characters ('playBGMall').
+These two commands will play a Background Music to either the invoking
+character only ('playBGM') or multiple characters ('playBGMall').
-BGM filename is the filename in /BGM/ folder. It has to be in .mp3 extension.
+BGM filename is the filename in /BGM/ folder. It has to be in .mp3
+extension, but it's not required to specify the extension in the script.
-It's not required to specify the extension inside the script.
-If coordinates are omitted, BGM will be broadcasted on the entire map. If the map name
-is omitted as well the BGM will be played for the entire server.
+If coordinates are omitted, BGM will be broadcasted on the entire map. If
+the map name is also omitted the BGM will be played for the entire server.
You can add your own BGMs this way, naturally.
@@ -6557,32 +6831,33 @@ You can add your own BGMs this way, naturally.
*pvpon "<map name>";
*pvpoff "<map name>";
-These commands will turn PVP mode for the specified maps on and off. Beside
-setting the flags referred to in 'setmapflag', 'pvpon' will also create a PVP
-timer and ranking as will @pvpon GM command do.
+These commands will turn PVP mode for the specified maps on and off.
+Beside setting the flags referred to in 'setmapflag', 'pvpon' will also
+create a PVP timer and ranking as will @pvpon GM command do.
---------------------------------------
*atcommand "<command>";
-This command will run the given command line exactly as if it was typed in from
-the keyboard by the player connected to the invoking character, and that
-character belonged to an account which had GM level 99.
+This command will run the given command line exactly as if it was typed in
+from the keyboard by the player connected to the invoking character, and
+that character belonged to an account which had GM level 99.
- // This will ask the invoker for a character name and then use the '@nuke'
- // GM command on them, killing them mercilessly.
+ // This will ask the invoker for a character name and then use the
+ // '@nuke' GM command on them, killing them mercilessly.
input @player$;
atcommand "@nuke "+@player$;
-This command has a lot of good uses, I am sure you can have some fun with this
-one.
+This command has a lot of good uses, I am sure you can have some fun with
+this one.
---------------------------------------
*charcommand "<command>";
-This command will run the given command line exactly as if it was typed in from
-the keyboard from a character that belonged to an account which had GM level 99.
+This command will run the given command line exactly as if it was typed in
+from the keyboard from a character that belonged to an account which had
+GM level 99.
The commands can also run without an attached rid.
@@ -6594,20 +6869,22 @@ The commands can also run without an attached rid.
*bindatcmd "command","<NPC object name>::<event label>"{,<group level>,<group level char>,<log>};
-This command will bind a NPC event label to an atcommand. Upon execution of the
-atcommand, the user will invoke the NPC event label. Each atcommand is only allowed
-one binding. If you rebind, it will override the original binding. If group level is provided,
-only users of that group level or above will be able to access the command, if not provided,
-everyone will be able to access the command.
-"group level char" is the minimum group level required for the label to be used on others,
-like a char command would, e.g. "#command "target" params" , when not provided,
-"group level char" defaults to 99.
-"log" whether to log the usages of this command with the atcommand log (1 = log, 0 = no log),
-default is to not log.
+This command will bind a NPC event label to an atcommand. Upon execution
+of the atcommand, the user will invoke the NPC event label. Each atcommand
+is only allowed one binding. If you rebind, it will override the original
+binding. If group level is provided, only users of that group level or
+above will be able to access the command, if not provided, everyone will
+be able to access the command.
+"group level char" is the minimum group level required for the label to be
+used on others like a char command would, e.g. "#command "target" params",
+when not provided, "group level char" defaults to 99.
+"log" whether to log the usages of this command with the atcommand log
+(1 = log, 0 = no log), default is to not log.
The following variables are set upon execution:
.@atcmd_command$ = The name of the @command used.
- .@atcmd_parameters$[] = Array containing the given parameters, starting from an index of 0.
+ .@atcmd_parameters$[] = Array containing the given parameters,
+ starting from an index of 0.
.@atcmd_numparameters = The number of parameters defined.
Example:
@@ -6633,8 +6910,9 @@ This command will unbind a NPC event label from an atcommand.
*useatcmd "command";
-This command will execute an atcommand binding on the attached RID from a script.
-The three .@atcmd_***** variables will NOT be set when invoking scripts-atcommands this way.
+This command will execute an atcommand binding on the attached RID from a
+script. The three .@atcmd_***** variables will NOT be set when invoking
+scripts-atcommands this way.
---------------------------------------
@@ -6643,8 +6921,8 @@ The three .@atcmd_***** variables will NOT be set when invoking scripts-atcomman
*unitskillusepos <GID>,<skill id>,<skill lvl>,<x>,<y>;
*unitskillusepos <GID>,"<skill name>",<skill lvl>,<x>,<y>;
-This is the replacement of the older commands, these use the same values for
-GID as the other unit* commands (See 'GID').
+This is the replacement of the older commands, these use the same values
+for GID as the other unit* commands (See 'GID').
Skill ID is the ID of the skill, skill level is the level of the skill.
For the position, the x and y are given in the unitSkillUsePos.
@@ -6654,14 +6932,14 @@ For the position, the x and y are given in the unitSkillUsePos.
*npcskill <skill id>,<skill lvl>,<stat point>,<NPC level>;
*npcskill "<skill name>",<skill lvl>,<stat point>,<NPC level>;
-This command causes the attached NPC object to cast a skill on the attached
-player. The skill will have no cast time or cooldown. The player must be
-within the default skill range or the command will fail silently.
+This command causes the attached NPC object to cast a skill on the
+attached player. The skill will have no cast time or cooldown. The player
+must be within the default skill range or the command will fail silently.
-The "stat point" parameter temporarily sets all NPC stats to the given value,
-and "NPC level" is the temporary level of the NPC (used in some skills).
-Neither value can be greater than the max level defined in config, and will
-not work properly if the NPC has a mob sprite.
+The "stat point" parameter temporarily sets all NPC stats to the given
+value, and "NPC level" is the temporary level of the NPC (used in some
+skills). Neither value can be greater than the max level defined in
+config, and will not work properly if the NPC has a mob sprite.
// Casts Level 10 Heal on the attached player, calculated with
// all stats 99 and base level 60.
@@ -6672,8 +6950,8 @@ not work properly if the NPC has a mob sprite.
*day;
*night;
-These two commands will switch the entire server between day and night mode
-respectively. If your server is set to cycle between day and night by
+These two commands will switch the entire server between day and night
+mode respectively. If your server is set to cycle between day and night by
configuration, it will eventually return to that cycle.
Example:
@@ -6690,9 +6968,11 @@ OnClock1800:
end;
}
-This script allows to emulate the day/night cycle as the server does, but also
-allows triggering additional effects upon change, like announces, gifts, etc.
-The day/night cycle set by configuration should be disabled when this script is used.
+This script allows to emulate the day/night cycle as the server does, but
+also allows triggering additional effects upon change, like announces,
+gifts, etc.
+The day/night cycle set by configuration should be disabled when this
+script is used.
---------------------------------------
@@ -6701,44 +6981,45 @@ The day/night cycle set by configuration should be disabled when this script is
*deactivatepset <set number>;
*deletepset <set number>;
-This set of commands is only available if the server is compiled with regular
-expressions library enabled. Default compilation and most binary distributions
-aren't, which is probably bad, since these, while complex to use, are quite
-fascinating.
+This set of commands is only available if the server is compiled with
+regular expressions library enabled. Default compilation and most binary
+distributions aren't, which is probably bad, since these, while complex to
+use, are quite fascinating.
-They will make the NPC object listen for text spoken publicly by players and
-match it against regular expression patterns, then trigger labels associated
-with these regular expression patterns.
+They will make the NPC object listen for text spoken publicly by players
+and match it against regular expression patterns, then trigger labels
+associated with these regular expression patterns.
-Patterns are organized into sets, which are referred to by a set number. You can
-have multiple sets patterns, and multiple patterns may be active at once.
-Numbers for pattern sets start at 1.
+Patterns are organized into sets, which are referred to by a set number.
+You can have multiple sets patterns, and multiple patterns may be active
+at once. Numbers for pattern sets start at 1.
-'defpattern' will associate a given regular expression pattern with an event
-label. This event will be triggered whenever something a player says is matched
-by this regular expression pattern, if the pattern is currently active.
+'defpattern' will associate a given regular expression pattern with an
+event label. This event will be triggered whenever something a player says
+is matched by this regular expression pattern, if the pattern is currently
+active.
-'activatepset' will make the pattern set specified active. An active pattern
-will enable triggering labels defined with 'defpattern', which will not happen
-by default.
-'deactivatepset' will deactivate a specified pattern set. Giving -1 as a pattern
-set number in this case will deactivate all pattern sets defined.
+'activatepset' will make the pattern set specified active. An active
+pattern will enable triggering labels defined with 'defpattern', which
+will not happen by default.
+'deactivatepset' will deactivate a specified pattern set. Giving -1 as a
+pattern set number in this case will deactivate all pattern sets defined.
-'deletepset' will delete a pattern set from memory, so you can create a new
-pattern set in its place.
+'deletepset' will delete a pattern set from memory, so you can create a
+new pattern set in its place.
-Using regular expressions is high wizardry. But with this high wizardry comes
-unparalleled power of text manipulation. For an explanation of what a regular
-expression pattern is, see a few web pages:
+Using regular expressions is high wizardry. But with this high wizardry
+comes unparalleled power of text manipulation. For an explanation of what
+a regular expression pattern is, see a few web pages:
http://www.regular-expressions.info/
http://www.weitz.de/regex-coach/
For an example of this in use, see doc/sample/npc_test_pcre.txt
-With this you could, for example, automatically punish players for asking for
-Zeny in public places, or alternatively, automatically give them Zeny instead if
-they want it so much.
+With this you could, for example, automatically punish players for asking
+for Zeny in public places, or alternatively, automatically give them Zeny
+instead if they want it so much.
---------------------------------------
@@ -6775,18 +7056,19 @@ Returns the md5 checksum of a number or string.
Example:
mes md5(12345);
- mes md5("12345"); // Will both display 827ccb0eea8a706c4c34a16891f84e7b
- mes md5("qwerty"); // Will display d8578edf8458ce06fbc5bb76a58c5ca4
+ mes md5("12345"); // Will both display 827ccb0eea8a706c4c34a16891f84e7b
+ mes md5("qwerty");// Will display d8578edf8458ce06fbc5bb76a58c5ca4
---------------------------------------
*query_sql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
*query_logsql("your MySQL query"{, <array variable>{, <array variable>{, ...}}});
-Executes an SQL query. A 'select' query can fill array variables with up to 128 rows of values,
-and will return the number of rows (i.e. array size).
+Executes an SQL query. A 'select' query can fill array variables with up
+to 128 rows of values, and will return the number of rows (the array size).
-Note that 'query_sql' runs on the main database while 'query_logsql' runs on the log database.
+Note that 'query_sql' runs on the main database while 'query_logsql' runs
+on the log database.
Example:
set @nb, query_sql("select name,fame from `char` ORDER BY fame DESC LIMIT 5", @name$, @fame);
@@ -6801,8 +7083,8 @@ mes "5."+@name$[4]+"("+@fame[4]+")";
*escape_sql(<value>)
-Converts the value to a string and escapes special characters so that it is safe to use in query_sql().
-Returns the escaped form of the given value.
+Converts the value to a string and escapes special characters so that it's
+safe to use in query_sql(). Returns the escaped form of the given value.
Example:
set .@str$, "John's Laptop";
@@ -6813,7 +7095,8 @@ Example:
*setiteminfo(<item id>,<type>,<value>)
This function will set some value of an item.
-Returns the new value on success, or -1 on fail (item_id not found or invalid type).
+Returns the new value on success, or -1 on fail (item_id not found or
+invalid type).
Valid types are:
0 - Buy Price; 1 - Sell Price; 2 - Item Type;
@@ -6832,8 +7115,9 @@ setiteminfo 7049,6,9990; // Stone now weighs 999.0
*setitemscript(<item id>,<"{ new item script }">{,<type>});
Set a new script bonus to the Item. Very useful for game events.
-You can remove an item's itemscript by leaving the itemscript argument empty.
-Returns 1 on success, or 0 on fail (item_id not found or new item script is invalid).
+You can remove an item's itemscript by leaving the itemscript argument
+empty. Returns 1 on success, or 0 on fail (item_id not found or new item
+script is invalid).
Type can optionally be used indicates which script to set (default is 0):
0 - Script
1 - OnEquip_Script
@@ -6849,9 +7133,9 @@ setitemscript 2637,"";
*atoi ("<string>")
*axtoi ("<string>")
-These commands are used to convert strings to numbers. 'atoi' will interpret
-given string as a decimal number (base 10), while 'axtoi' interprets strings as
-hexadecimal numbers (base 16).
+These commands are used to convert strings to numbers. 'atoi' will
+interpret given string as a decimal number (base 10), while 'axtoi'
+interprets strings as hexadecimal numbers (base 16).
Hexadecimal number set: {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}
@@ -6865,8 +7149,8 @@ mes axtoi("11"); // Displays 17 (1 = 1, 10 = 16)
*compare(<string>,<substring>)
-This command returns 1 or 0 when the substring is in the main string (1) or not (0).
-This command is not case sensitive.
+This command returns 1 or 0 when the substring is in the main string (1)
+or not (0). This command is not case sensitive.
Examples:
@@ -6881,23 +7165,25 @@ Examples:
*getstrlen("<string>")
-This function will return the length of the string given as an argument. It is
-useful to check if anything input by the player exceeds name length limits and
-other length limits and asking them to try to input something else.
+This function will return the length of the string given as an argument.
+It is useful to check if anything input by the player exceeds name length
+limits and other length limits and asking them to try to input something
+else.
---------------------------------------
*charisalpha("<string>",<position>)
-This function will return 1 if the character number Position in the given string
-is a letter, 0 if it isn't a letter but a digit or a space.
+This function will return 1 if the character number Position in the given
+string is a letter, 0 if it isn't a letter but a digit or a space.
The first letter is position 0.
---------------------------------------
*charat(<string>,<index>)
-Returns char at specified index. If index is out of range, returns empty string.
+Returns char at specified index. If index is out of range, returns an
+empty string.
Example:
@@ -6907,9 +7193,9 @@ Example:
*setchar(<string>,<char>,<index>)
-Returns the original string with the char at the specified index set to the
-specified char. If index out of range, the original string will be returned.
-Only the 1st char in the <char> parameter will be used.
+Returns the original string with the char at the specified index set to
+the specified char. If index is out of range, the original string will be
+returned. Only the 1st char in the <char> parameter will be used.
Example:
@@ -6919,9 +7205,10 @@ Example:
*insertchar(<string>,<char>,<index>)
-Returns the original string with the specified char inserted at the specified
-index. If index is out of range, the char will be inserted on the end of the
-string that it is closest. Only the 1st char in the <char> parameter will be used.
+Returns the original string with the specified char inserted at the
+specified index. If index is out of range, the char will be inserted on
+the end of the string that it is closest. Only the 1st char in the <char>
+parameter will be used.
Example:
@@ -6956,7 +7243,8 @@ Example:
*charislower(<string>,<index>)
Returns 1 if character at specified index of specified string is
-uppercase/lowercase. Otherwise, 0. Characters not of the alphabelt will return 0.
+uppercase for 'charisupper' or lowercase for 'charislower'. Otherwise, 0.
+Characters not of the alphabelt will return 0.
Example:
@@ -6966,8 +7254,8 @@ Example:
*substr(<string>,<start_index>,<end_index>)
-Returns the sub-string of the specified string inclusively between the set
-indexes. If indexes are out of range, or the start index is after the end
+Returns the sub-string of the specified string inclusively between the set
+indexes. If indexes are out of range, or the start index is after the end
index, an empty string will be returned.
Example:
@@ -6978,10 +7266,11 @@ Example:
*explode(<dest_array>,<string>,<delimiter>)
-Breaks a string up into substrings based on the specified delimiter. Substrings
-will be stored within the specified string array. Only the 1st char of the
-delimiter parameter will be used. If an empty string is passed as a delimiter,
-the string will be placed in the array in it's original form.
+Breaks a string up into substrings based on the specified delimiter.
+Substrings will be stored within the specified string array. Only the 1st
+char of the delimiter parameter will be used. If an empty string is passed
+as a delimiter, the string will be placed in the array in its original
+form, without any changes.
Example:
@@ -6997,8 +7286,9 @@ Example:
*implode(<string_array>{,<glue>})
-Combines all substrings within the specified string array into a single string.
-If the glue parameter is specified, it will be inserted inbetween each substring.
+Combines all substrings within the specified string array into a single
+string. If the glue parameter is specified, it will be inserted inbetween
+each substring.
Example:
setarray .@my_array$[0], "This", "is", "a", "test";
@@ -7006,24 +7296,28 @@ Example:
---------------------------------------
-*sprintf(<format>[,param[,param[,...]]]) [Mirei]
+*sprintf(<format>[,param[,param[,...]]])
-C style sprintf. The resulting string is returned same as in PHP. All C format
-specifiers are supported except %n. More info: sprintf @ www.cplusplus.com.
-The number of params is only limited by rA's script engine.
+C style sprintf. The resulting string is returned same as in PHP. All C
+format specifiers are supported except %n. For more info check sprintf
+function at www.cplusplus.com
+Number of params is only limited by Hercules' script engine.
Example:
.@format$ = 'The %s contains %d monkeys';
- dispbottom(sprintf(.@format$, "zoo", 5)); //prints "The zoo contains 5 monkeys"
- dispbottom(sprintf(.@format$, "barrel", 82)); //prints "The barrel contains 82 monkeys"
+ dispbottom(sprintf(.@format$, "zoo", 5));
+ //prints "The zoo contains 5 monkeys"
+
+ dispbottom(sprintf(.@format$, "barrel", 82));
+ //prints "The barrel contains 82 monkeys"
---------------------------------------
-*sscanf(<string>,<format>[,param[,param[,...]]]) [Mirei]
+*sscanf(<string>,<format>[,param[,param[,...]]])
C style sscanf. All C format specifiers are supported.
-More info: sscanf @ www.cplusplus.com. The number of params is only limited
-by rA's script engine.
+More info: sscanf @ www.cplusplus.com. The number of params is only
+limited by Hercules' script engine.
Example:
sscanf("This is a test: 42 foobar", "This is a test: %d %s", .@num, .@str$);
@@ -7047,9 +7341,9 @@ Example:
*replacestr(<input>, <search>, <replace>{, <usecase>{, <count>}})
-Replaces all instances of a search string in the input with the specified
-replacement string. By default is case sensitive unless <usecase> is set
-to 0. If specified it will only replace as many instances as specified
+Replaces all instances of a search string in the input with the specified
+replacement string. By default is case sensitive unless <usecase> is set
+to 0. If specified it will only replace as many instances as specified
in the count parameter.
Example:
@@ -7061,7 +7355,7 @@ Example:
*countstr(<input>, <search>{, <usecase>})
-Counts all instances of a search string in the input. By default is case
+Counts all instances of a search string in the input. By default is case
sensitive unless <usecase> is set to 0.
Example:
@@ -7072,10 +7366,9 @@ Example:
*setfont <font>;
-This command sets the current RO client interface font to one of the
-fonts stored in data\*.eot by using an ID of the font. When the ID
-of the currently used font is used, default interface font is used
-again.
+This command sets the current RO client interface font to one of the fonts
+stored in data\*.eot by using an ID of the font. When the ID of the
+currently used font is used, default interface font is used again.
0 - Default
1 - RixLoveangel
@@ -7092,22 +7385,22 @@ again.
*showdigit <value>{,<type>};
-Displays given numeric 'value' in large digital clock font on top of
-the screen. The optional parameter 'type' specifies visual aspects
-of the "clock" and can be one of the following values:
+Displays given numeric 'value' in large digital clock font on top of the
+screen. The optional parameter 'type' specifies visual aspects of the
+"clock" and can be one of the following values:
0 - Displays the value for 5 seconds (default).
1 - Incremental counter (1 tick/second).
- 2 - Decremental counter (1 tick/second). Does not stop at zero,
- but overflows.
- 3 - Decremental counter (1 tick/second). Two digits only, stops
- at zero.
+ 2 - Decremental counter (1 tick/second). Does not stop at zero, but
+ overflows.
+ 3 - Decremental counter (1 tick/second). Two digits only, stops at
+ zero.
-For type 1 and 2 the start value is set by using negative number of
-the one intended to set (ex. -10 starts the counter at 10 seconds).
-Except for type 3 the value is interpreted as seconds and formatted
-as time in days, hours, minutes and seconds. Note, that the official
-script command does not have the optional parameter.
+For type 1 and 2 the start value is set by using negative number of the
+one intended to set (ex. -10 starts the counter at 10 seconds). Except for
+type 3 the value is interpreted as seconds and formatted as time in days,
+hours, minutes and seconds. Note, that the official script command does
+not have the optional parameter.
// displays 23:59:59 for 5 seconds
showdigit 86399;
@@ -7119,43 +7412,44 @@ script command does not have the optional parameter.
* The Pet AI commands
-These commands will only work if the invoking character has a pet, and are meant
-to be executed from pet scripts. They will modify the pet AI decision-making for
-the current pet of the invoking character, and will NOT have any independent
-effect by themselves, which is why only one of them each may be in effect at any
-time for a specific pet. A pet may have 'petloot', 'petskillbonus',
-'petskillattack' OR 'petpetskillattack2' and 'petskillsupport' OR 'petheal' at
-the same time. 'petheal' is deprecated and is no longer used in the default pet
-scripts.
+These commands will only work if the invoking character has a pet, and are
+meant to be executed from pet scripts. They will modify the pet AI
+decision-making for the current pet of the invoking character, and will
+NOT have any independent effect by themselves, which is why only one of
+them each may be in effect at any time for a specific pet. A pet may
+have 'petloot', 'petskillbonus', 'petskillattack' OR 'petpetskillattack2'
+and 'petskillsupport' OR 'petheal' at the same time. 'petheal' is
+deprecated and is no longer used in the default pet scripts.
*petskillbonus <bonus type>,<value>,<duration>,<delay>;
-This command will make the pet give a bonus to the owner's stat (bonus type -
-bInt,bVit,bDex,bAgi,bLuk,bStr,bSpeedRate - for a full list, see the values
-starting with 'b' in 'db/const.txt')
+This command will make the pet give a bonus to the owner's stat (bonus
+type - bInt,bVit,bDex,bAgi,bLuk,bStr,bSpeedRate - for a full list, see the
+values starting with 'b' in 'db/const.txt').
*petrecovery <status type>,<delay>;
-This command will make the pet cure a specified status condition. The curing
-actions will occur once every Delay seconds. For a full list of status
-conditions that can be cured, see the list of 'SC_' status condition constants
-in 'db/const.txt'
+This command will make the pet cure a specified status condition. The
+curing actions will occur once every <delay> seconds. For a full list of
+status conditions that can be cured, see the list of 'SC_' status
+condition constants in 'db/const.txt'
*petloot <max items>;
-This command will turn on pet looting, with a maximum number of items to loot
-specified. Pet will store items and return them when the maximum is reached or
-when pet performance is activated.
+This command will turn on pet looting, with a maximum number of items to
+loot specified. Pet will store items and return them when the maximum is
+reached or when pet performance is activated.
*petskillsupport <skill id>,<skill level>,<delay>,<percent hp>,<percent sp>;
*petskillsupport "<skill name>",<skill level>,<delay>,<percent hp>,<percent sp>;
*petheal <level>,<delay>,<percent hp>,<percent sp>;
-This will make the pet use a specified support skill on the owner whenever the
-HP and SP are below the given percent values, with a specified delay time
-between activations. The skill numbers are as per 'db/(pre-)re/skill_db.txt'.
-'petheal' works the same as 'petskillsupport' but has the skill ID hard-coded to
-28 (Heal). This command is deprecated.
+This will make the pet use a specified support skill on the owner whenever
+the HP and SP are below the given percent values, with a specified delay
+time between activations. The skill numbers are as per
+'db/(pre-)re/skill_db.txt'.
+'petheal' works the same as 'petskillsupport' but has the skill ID
+hard-coded to 28 (Heal). This command is deprecated.
It's not quite certain who's stats will be used for the skills cast, the
character's or the pets. Probably, Skotlex can answer that question.
@@ -7164,30 +7458,31 @@ character's or the pets. Probably, Skotlex can answer that question.
*petskillattack2 <skill id>,<damage>,<number of attacks>,<rate>,<bonusrate>;
*petskillattack2 "<skill name>",<damage>,<number of attacks>,<rate>,<bonusrate>;
-These two commands will make the pet cast an attack skill on the enemy the pet's
-owner is currently fighting. Skill IDs and levels are as per 'petskillsupport'.
-'petskillattack2' will make the pet cast the skill with a fixed amount of damage
-inflicted and the specified number of attacks.
-
-All commands with delays and durations will only make the behavior active for
-the specified duration of seconds, with a delay of the specified number of
-seconds between activations. Rates are a chance of the effect occurring and are
-given in percent. 'bonusrate' is added to the normal rate if the pet intimacy is
-at the maximum possible.
-
-The behavior modified with the above mentioned commands will only be exhibited if
-the pet is loyal and appropriate configuration options are set in
-'battle.conf'.
-
-Pet scripts in the database normally run whenever a pet of that type hatches
-from the egg. Other commands usable in item scripts (see 'bonus') will also
-happily run from pet scripts. Apparently, the pet-specific commands will also
-work in NPC scripts and modify the behavior of the current pet up until the pet
-is hatched again. (Which will also occur when the character is logged in again
-with the pet still out of the egg.) It is not certain for how long the effect of
-such command running from an NPC script will eventually persist, but apparently,
-it is possible to usefully employ them in usable item scripts to create pet
-buffing items.
+These two commands will make the pet cast an attack skill on the enemy the
+pet's owner is currently fighting. Skill IDs and levels are as per
+'petskillsupport'.
+'petskillattack2' will make the pet cast the skill with a fixed amount of
+damage inflicted and the specified number of attacks.
+
+All commands with delays and durations will only make the behavior active
+for the specified duration of seconds, with a delay of the specified
+number of seconds between activations. Rates are a chance of the effect
+occurring and are given in percent. 'bonusrate' is added to the normal
+rate if the pet intimacy is at the maximum possible.
+
+The behavior modified with the above mentioned commands will only be
+exhibited if the pet is loyal and appropriate configuration options are
+set in 'battle.conf'.
+
+Pet scripts in the database normally run whenever a pet of that type
+hatches from the egg. Other commands usable in item scripts (see 'bonus')
+will also happily run from pet scripts. Apparently, the pet-specific
+commands will also work in NPC scripts and modify the behavior of the
+current pet up until the pet is hatched again. (Which will also occur when
+the character is logged in again with the pet still out of the egg.) It is
+not certain for how long the effect of such command running from an NPC
+script will eventually persist, but apparently, it is possible to usefully
+employ them in usable item scripts to create pet buffing items.
Nobody tried this before, so you're essentially on your own here.
@@ -7196,9 +7491,9 @@ Nobody tried this before, so you're essentially on your own here.
*bpet;
This command opens up a pet hatching window on the client connected to the
-invoking character. It is used in item script for the pet incubators and will
-let the player hatch an owned egg. If the character has no eggs, it will just
-open up an empty incubator window.
+invoking character. It is used in item script for the pet incubators and
+will let the player hatch an owned egg. If the character has no eggs, it
+will just open up an empty incubator window.
This is still usable outside item scripts.
---------------------------------------
@@ -7207,15 +7502,15 @@ This is still usable outside item scripts.
This command will create a pet egg and put it in the invoking character's
inventory. The kind of pet is specified by pet ID numbers listed in
-'db/pet_db.txt'. The egg is created exactly as if the character just successfully
-caught a pet in the normal way.
+'db/pet_db.txt'. The egg is created exactly as if the character just
+successfully caught a pet in the normal way.
// This will make you a poring:
makepet 1002;
-Notice that you absolutely have to create pet eggs with this command. If you try
-to give a pet egg with 'getitem', pet data will not be created by the char
-server and the egg will disappear when anyone tries to hatch it.
+Notice that you absolutely have to create pet eggs with this command. If
+you try to give a pet egg with 'getitem', pet data will not be created by
+the char server and the egg will disappear when anyone tries to hatch it.
---------------------------------------
@@ -7229,14 +7524,16 @@ current invoking character.
*setcell "<map name>",<x1>,<y1>,<x2>,<y2>,<type>,<flag>;
Each map cell has several 'flags' that specify the properties of that cell.
-These include terrain properties (walkability, shootability, presence of water),
-skills (basilica, land protector, ...) and other (NPC nearby, no vending, ...).
+These include terrain properties (walkability, shootability, presence of
+water), skills (basilica, land protector, ...) and other (NPC nearby, no
+vending, ...).
Each of these can be 'on' or 'off'. Together they define a cell's behavior.
-This command lets you alter these flags for all map cells in the specified
-(x1,y1)-(x2,y2) rectangle. The 'flag' can be 0 or 1 (0:clear flag, 1:set flag).
-The 'type' defines which flag to modify. Possible options include cell_walkable,
+This command lets you alter these flags for all map cells in the specified
+(x1,y1)-(x2,y2) rectangle.
+'type' defines which flag to modify. Possible options include cell_walkable,
cell_shootable, cell_basilica. For a full list, see const.txt.
+'flag' can be 0 or 1 (0:clear flag, 1:set flag).
Example:
@@ -7245,11 +7542,12 @@ Example:
setcell "arena",135,135,165,165,cell_walkable,0;
setcell "arena",140,140,160,160,cell_walkable,1;
-This will add a makeshift ring into the center of the map. The ring will be
-surrounded by a 5-cell wide 'gap' to prevent interference from outside, and
-the rest of the map will be marked as 'basilica', preventing observers from
-casting any offensive skills or fighting among themselves. Note that the wall
-will not be shown nor known client-side, which may cause movement problems.
+This will add a makeshift ring into the center of the map. The ring will
+be surrounded by a 5-cell wide 'gap' to prevent interference from outside,
+and the rest of the map will be marked as 'basilica', preventing observers
+from casting any offensive skills or fighting among themselves. Note that
+the wall will not be shown nor known client-side, which may cause movement
+problems.
Another example:
@@ -7268,17 +7566,20 @@ remove a nonwalkable row of cells after the barricade mobs.
*checkcell ("<map name>",<x>,<y>,<type>);
-This command will return 1 or 0, depending on whether the specified cell has
-the 'type' flag set or not. There are various types to check, all mimicking
-the server's cell_chk enumeration. The types can be found in db/const.txt.
+This command will return 1 or 0, depending on whether the specified cell
+has the 'type' flag set or not. There are various types to check, all
+mimicking the server's cell_chk enumeration. The types can be found in
+db/const.txt.
-The meaning of the individual types can be confusing, so here's an overview:
+The meaning of the individual types can be confusing, so here's an
+overview:
- cell_chkwall/water/cliff
these check directly for the 'terrain component' of the specified cell
- cell_chkpass/reach/nopass/noreach
- passable = not wall & not cliff, reachable = passable wrt. no-stacking mod
+ passable = not wall & not cliff, reachable = passable
+ wrt. no-stacking mod
- cell_chknpc/basilica/landprotector/novending/nochat
- these check for specific dynamic flags (their name indicates what they do)
+ these check for specific dynamic flags (name indicates what they do)
Example:
@@ -7305,16 +7606,17 @@ Example:
*setwall "<map name>",<x>,<y>,<size>,<dir>,<shootable>,"<name>";
*delwall "<name>";
-Creates an invisible wall, an array of "setcell" starting from x,y and doing a
-line of the given size in the given direction. The difference with setcell is
-this one update client part too to avoid the glitch problem. Directions are the
-same as NPC sprite facing directions: 0=north, 1=northwest, 2=west, etc.
+Creates an invisible wall, an array of "setcell" starting from x,y and
+doing a line of the given size in the given direction. The difference with
+setcell is this one update client part too to avoid the glitch problem.
+Directions are the same as NPC sprite facing directions: 0=north,
+1=northwest, 2=west, etc.
---------------------------------------
*readbook <book id>,<page>;
-This will open a book item at the specified page
+This will open a book item at the specified page.
---------------------------------------
@@ -7323,11 +7625,12 @@ This will open a book item at the specified page
========================
---------------------------------------
-*instance_create("<instance name>",<party id>);
+*instance_create("<instance name>",<owner id>{,<optional owner_type>});
-Create an instance using the name "<instance name>" for the Party of <party id>.
-Most instance_* commands are used in conjunction with this command and depend
-on the ID this command returns.
+Create an instance using the name "<instance name>" for the <owner_id> of
+owner_type (when not provided, defaults to IOT_PARTY). Most instance_*
+commands are used in conjunction with this command and depend on the
+ID this command returns.
Example:
// Store the Party ID of the invoking character.
@@ -7355,46 +7658,48 @@ Example:
*instance_destroy {<instance id>};
-Destroys instance with the ID <instance id>. If no ID is specified, the instance
-the script is attached to is used. If the script is not attached to an instance,
-the instance of the currently attached player's party is used. If no player is
-currently attached, the command fails and causes the script to halt.
+Destroys instance with the ID <instance id>. If no ID is specified, the
+instance the script is attached to is used. If in the end no instance_id,
+is found the command halts the script execution.
---------------------------------------
-*instance_attachmap("<map name>",<instance id>{,<use base name>});
+*instance_attachmap("<map name>",<instance id>{,<use base name>{,"<new map name>"}});
-Attaches the map "<map name>" to the instance specified with <instance id>. The
-optional parameter specifies, whether a map requires emulation for instancing (1)
-or not (0 = default).
+Attaches the map "<map name>" to the instance specified with
+<instance id>. The optional parameter specifies, whether a map requires
+emulation for instancing (1) or not (0 = default). if use base name is specified,
+and "<new map name>" too the server will instance the map under the "<new map name>",
+name.
Returns the resulting map name on success or an empty string on failure.
+Example:
+ instance_attachmap("prontera", .@instance_id,1,"via");
+^ the above creates a instance (or clone) of prontera, on a map called "via"
+
---------------------------------------
*instance_detachmap "<map name>"{,<instance id>};
-Detach the map "<map name>" to the instance with the <instance id>. If no ID is
-specified, the instance the script is attached to is used. If the script is not
-attached to an instance, the instance of the currently attached player's party is
-used. If no player is currently attached, the command fails and causes the script
-to halt.
+Detach the map "<map name>" to the instance with the <instance id>. If no
+ID is specified, the instance the script is attached to is used. If in the
+end no instance_id is found the command halts the script execution.
---------------------------------------
*instance_init <instance id>;
-Initializes the instance given by <instance id>. This copies all NPCs from the
-source maps to the instanced maps.
+Initializes the instance given by <instance id>. This copies all NPCs from
+the source maps to the instanced maps.
---------------------------------------
*instance_announce <instance id>,"<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}};
-Works like announce, but has the <instance id> parameter. If instance id is 0, the
-instance the script is attached to is used. If the script is not attached to an
-instance, the instance of the currently attached player's party is used. If no
-player is currently attached, the command fails and causes the script to halt.
+Works like announce, but has the <instance id> parameter. If instance id
+is -1, the instance the script is attached to is used. If in the
+end no instance_id is found the command halts the script execution.
---------------------------------------
@@ -7406,58 +7711,50 @@ Attaches the current script to the instance given by <instance id>.
*instance_npcname("<npc name>"{,<instance id>});
-Retrieves the unique name given to a copy of an NPC given by "<npc name>" in an
-instance specified <instance id>. If no ID is specified, the instance the script
-is attached to is used. If the script is not attached to an instance, the
-instance of the currently attached player's party is used. If no player is
-currently attached, the command fails and causes the script to halt.
+Retrieves the unique name given to a copy of an NPC given by "<npc name>"
+in an instance specified <instance id>. If no ID is specified, the
+instance the script is attached to is used. If in the end no instance_id,
+is found the command halts the script execution.
---------------------------------------
*has_instance("<map name>"{,<instance id>});
-Checks whether or not the given map belongs to specified instance. If no ID is
-specified, the instance the script is attached to is used. If the script is not
-attached to an instance, the instance of the currently attached player's party
-is used. If no player is currently attached, the command fails and causes the
-script to halt.
+Checks whether or not the given map belongs to specified instance. If no
+ID is specified, the instance the script is attached to is used. If the
+script is not attached to an instance, it'll try to check whether the,
+player attached to the script possesses an instance with a map matching
+"<map name>". If in the end no instance_id is found the command halts the,
+script execution.
-Returns the name of the instanced map on success, otherwise an empty string.
+Returns name of the instanced map on success, otherwise an empty string.
---------------------------------------
-*instance_id({<type>});
+*instance_id();
-Retrieves the instance id, depending on <type>. If type is not given, it defaults
-to 0.
-
-Type:
- 0 - Instance ID the script is attached to.
- 1 - Instance ID of the currently attached player's party.
+Retrieves the instance id of the script it is being run on.
---------------------------------------
*instance_warpall "<map name>",<x>,<y>{,<instance id>};
-Warps all players in the instance <instance id> to <map name> at given
-coordinates. If no ID is specified, the instance the script is attached to
-is used. If the script is not attached to an instance, the instance of the
-currently attached player's party is used. If no player is currently attached,
-the command fails and causes the script to halt.
+Warps all players in the instance <instance id> to <map name> at given
+coordinates. If no ID is specified, the instance the script is attached to
+is used. If in the end no instance_id is found the command halts the,
+script execution.
---------------------------------------
*instance_set_timeout <alive timeout>,<idle timeout>{,<instance id>};
-Sets the timeout values for an instance given by <instance id>. If no ID is
-specified, the instance the script is attached to is used. If the script is
-not attached to an instance, the instance of the currently attached player's
-party is used. If no player is currently attached, the command fails and causes
-the script to halt.
+Sets the timeout values for an instance given by <instance id>. If no ID
+is specified, the instance the script is attached to is used. If in the end,
+no instance_id is found the command halts the script execution.
-Parameter <alive timeout> specifies the total amount of time the instance will
-exist. Parameter <idle timeout> specifies how long players have, when they are
-outside of the instance, until it is destroyed.
+Parameter <alive timeout> specifies the total amount of time the instance
+will exist. Parameter <idle timeout> specifies how long players have, when
+they are outside of the instance, until it is destroyed.
Both timeout values are in seconds.
@@ -7465,12 +7762,14 @@ Both timeout values are in seconds.
*instance_check_party(<party id>{,<amount>{,<min>{,<max>}}});
-This function checks if a party meets certain requirements, returning 1 if all
-conditions are met and 0 otherwise. It will only check online characters.
+This function checks if a party meets certain requirements, returning 1 if
+all conditions are met and 0 otherwise. It will only check online
+characters.
amount - number of online party members (default is 1).
min - minimum level of all characters in the party (default is 1).
-max - maximum level of all characters in the party (default is max level in conf).
+max - maximum level of all characters in the party (default is max
+ level in conf).
Example:
@@ -7498,7 +7797,8 @@ Place quest of <ID> in the users quest log, the state of which is "active".
*completequest <ID>;
-Change the state for the given quest <ID> to "complete" and remove from the users quest log.
+Change the state for the given quest <ID> to "complete" and remove from
+the users quest log.
---------------------------------------
@@ -7526,34 +7826,41 @@ If no additional argument supplied, return the state of the quest:
If parameter "PLAYTIME" is supplied:
-1 = Quest not started (not in quest log)
0 = the time limit has not yet been reached
- 1 = the time limit has not been reached but the quest is marked as complete
+ 1 = the time limit has not been reached but the quest is marked as
+ complete
2 = the time limit has been reached
If parameter "HUNTING" is supplied:
-1 = Quest not started (not in quest log)
- 0 = you haven't killed all of the target monsters and the time limit has not been reached.
- 1 = you haven't killed all of the target monsters but the time limit has been reached.
+ 0 = you haven't killed all of the target monsters and the time limit
+ has not been reached.
+ 1 = you haven't killed all of the target monsters but the time limit
+ has been reached.
2 = you've killed all of the target monsters
---------------------------------------
*showevent <state>, <color>;
-Show a colored mark in the mini-map like "viewpoint" and an emotion on top of a NPC.
-This is used to indicate that a NPC has a quest or an event to certain player/s.
+Show a colored mark in the mini-map like "viewpoint" and an emotion on top
+of a NPC. This is used to indicate that a NPC has a quest or an event to
+certain player/s.
state can be:
- 0 = disable ( Used to disable and remove the mark and the emotion from the NPC. )
- 1 = exclamation emotion ( Used to show an important quest event to certain player. )
- 2 = interrogation emotion ( Used to show an non-important quest event to certain player. )
- Other value may cause client crashes.
+ 0 = disable ( Used to disable and remove the mark and the emotion from
+ the NPC. )
+ 1 = exclamation emotion ( Used to show an important quest event to
+ certain player. )
+ 2 = interrogation emotion ( Used to show an non-important quest event
+ to certain player. )
+Other value may cause client crashes.
color can be:
0 = yellow "Quest"
1 = orange "Job"
2 = green "Event"
3 = an MVP flag
- other values show a transparent mark in the mini-map.
+Other values show a transparent mark in the mini-map.
----------------------------------------
@@ -7564,25 +7871,31 @@ color can be:
*waitingroom2bg_single(<battle group>,"<mapname>",<x>,<y>,"<npc name>");
-Adds the first waiting player from the chat room of given NPC to an
-existing battleground group and warps it to specified coordinates on
-given map.
+Adds the first waiting player from the chat room of given NPC to an
+existing battleground group and warps it to specified coordinates on given
+map.
---------------------------------------
*waitingroom2bg("<mapname>",<x>,<y>,"<On Quit Event>","<On Death Event>"{,"<npc name>"});
-<Mapname> and X Y coordinates refer to where the "respawn" base is, where the player group will respawn when they die.
-<On Quit Event> refers to an NPC label that attaches to the character and is run when they relog.
-<On Death Event> refers to an NPC label that attaches to the character and is run when they die. Can be "" for empty.
+<Mapname> and X Y coordinates refer to where the "respawn" base is, where
+the player group will respawn when they die.
+<On Quit Event> refers to an NPC label that attaches to the character and
+is run when they relog.
+<On Death Event> refers to an NPC label that attaches to the character and
+is run when they die. Can be "" for empty.
-Unlike the prior command, the latter will attach a GROUP in a waiting room to the battleground, and
-sets the array $@arenamembers[0] where 0 holds the IDs of the first group, and 1 holds the IDs of the second.
+Unlike the prior command, the latter will attach a GROUP in a waiting room
+to the battleground, and sets the array $@arenamembers[0] where 0 holds
+the IDs of the first group, and 1 holds the IDs of the second.
-If the option parameter is left out, the waiting room of the current NPC is used.
+If the option parameter is left out, the waiting room of the current NPC
+is used.
Example:
- // Battle Group will be referred to as $@KvM01BG_id1, and when they die, respawn at bat_c01,52,129.
+ // Battle Group will be referred to as $@KvM01BG_id1, and when they
+ // die, respawn at bat_c01,52,129.
set $@KvM01BG_id1, waitingroom2bg("bat_c01",52,129,"KvM01_BG::OnGuillaumeQuit","KvM01_BG::OnGuillaumeDie");
end;
@@ -7590,7 +7903,8 @@ Example:
*bg_team_setxy <Battle Group ID>,<x>,<y>;
-Update the respawn point of the given battle group to x, y on the same map. The <Battle Group ID> can be retrieved using getcharid(4)
+Update the respawn point of the given battle group to x, y on the same
+map. The <Battle Group ID> can be retrieved using getcharid(4).
Example:
bg_team_setxy getcharid(4),56,212;
@@ -7617,7 +7931,8 @@ Example:
Similar to monster script command.
Spawn a monster with allegiance to the given battle group.
Does not allow for the summoning of multiple monsters.
-Monsters are similar to that in War of Emperium, in that the specified Battle group is considered friendly.
+Monsters are similar to that in War of Emperium, in that the specified
+Battle group is considered friendly.
Example:
// It can be used in two different ways.
@@ -7668,7 +7983,8 @@ As the name says, destroys the battle group created for that battle ground.
*areapercentheal "<mapname>",<x1>,<y1>,<x2>,<y2>,<hp>,<sp>;
-Not exactly limited to battleground use, this will restore HP/SP in a defined area at a percentage.
+Not exactly limited to battleground use, this will restore HP/SP in a
+defined area at a percentage.
Example:
areapercentheal "bat_a01",52,208,61,217,100,100;
@@ -7678,7 +7994,8 @@ Example:
*bg_get_data(<Battle Group>,<type>);
-Retrieves data related to given battle group. Type can be one of the following:
+Retrieves data related to given battle group. Type can be one of the
+following:
0 - Amount of players currently belonging to the group.
@@ -7686,8 +8003,8 @@ Retrieves data related to given battle group. Type can be one of the following:
*bg_getareausers(<battle group>,<map name>,<x0>,<y0>,<x1>,<y1>);
-Retrieves amount of players belonging to given battle group on given
-map within an specified rectangular area.
+Retrieves amount of players belonging to given battle group on given map
+within an specified rectangular area.
----------------------------------------
@@ -7695,7 +8012,7 @@ map within an specified rectangular area.
This command will force the update of the displayed scoreboard.
It is only usable when the map is defined as a Type 2 Battleground:
-mapflag <mapname> battleground 2
+mapflag%TAB%<mapname>%TAB%battleground%TAB%2
----------------------------------------
@@ -7706,22 +8023,21 @@ mapflag <mapname> battleground 2
*mercenary_create <class>,<contract time>;
-This command summons a mercenary of given class, for given amount of
-time in milliseconds. Typically used in item scripts of mercenary
-scrolls.
+This command summons a mercenary of given class, for given amount of time
+in milliseconds. Typically used in item scripts of mercenary scrolls.
----------------------------------------
*mercenary_heal <hp>,<sp>;
-This command works like 'heal', but affects the mercenary of the
-currently attached character.
+This command works like 'heal', but affects the mercenary of the currently
+attached character.
----------------------------------------
*mercenary_sc_start <type>,<tick>,<val1>;
-This command works like 'sc_start', but affects the mercenary of the
+This command works like 'sc_start', but affects the mercenary of the
currently attached character.
----------------------------------------
@@ -7729,7 +8045,7 @@ currently attached character.
*mercenary_get_calls(<guild>);
*mercenary_set_calls <guild>,<value>;
-Sets or gets the mercenary calls value for given guild for currently
+Sets or gets the mercenary calls value for given guild for currently
attached character. Guild can be one or the following constants:
ARCH_MERC_GUILD
@@ -7741,7 +8057,7 @@ attached character. Guild can be one or the following constants:
*mercenary_get_faith(<guild>);
*mercenary_set_faith <guild>,<value>;
-Sets or gets the mercenary faith value for given guild for currently
+Sets or gets the mercenary faith value for given guild for currently
attached character. Guild can be one or the following constants:
ARCH_MERC_GUILD
@@ -7752,10 +8068,10 @@ attached character. Guild can be one or the following constants:
*getmercinfo(<type>{,<char id>});
-Retrieves information about mercenary of the currently attached
-character. If char id is given, the information of that character is
-retrieved instead. Type specifies what information to retrieve and
-can be one of the following:
+Retrieves information about mercenary of the currently attached character.
+If char id is given, the information of that character is retrieved
+instead. Type specifies what information to retrieve and can be one of the
+following:
0 - Database ID
1 - Class
@@ -7771,5 +8087,90 @@ for name and 0 for all other types.
----------------------------------------
-Whew.
-That's about all of them.
+======================
+|11.- Queue Commands.|
+======================
+---------------------------------------
+
+*queue();
+
+Creates a new queue instance and returns the created queue id.
+
+---------------------------------------
+
+*queuesize(<queue_id>);
+
+Returns the amount of entries in the queue instance of <queue_id>.
+
+---------------------------------------
+
+*queueadd(<queue_id>,<var_id>);
+
+Adds <var_id> to queue of <queue_id>, returning 1 if <var_id> is already
+present in the queue, otherwise returning 0.
+
+---------------------------------------
+
+*queueremove(<queue_id>,<var_id>);
+
+Removes <var_id> from queue of <queue_id>, returning 1 if <var_id> is not
+present in the queue, otherwise returning 0.
+
+---------------------------------------
+
+*queueopt(<queue_id>,<optionType>,{Optional <option val>});
+
+Modifies <queue_id>'s <optionType>. When <option val> is not present
+<optionType> is removed from <queue_id>. When present it modifies
+<queue_id>'s <optionType> with the new <option val> value.
+
+Currently 3 options are available:
+HQO_OnDeath (0), HQO_OnLogout (1), HQO_OnMapChange (2)
+
+Note: The constant names are not final.
+
+Example:
+ queueopt(.@queue_id,0,"MyNPC::MyOnQueueMemberDeathEventName");
+
+---------------------------------------
+
+*queuedel(<queue_id>);
+
+Deletes <queue_id> and returns 1 when <queue_id> is not found, otherwise
+0 is returned.
+
+---------------------------------------
+
+*queueiterator(<queue_id>);
+
+Creates a new queue iterator instance.
+A queue iterator is not a reference to a queue's actual members, it copies
+the queues members when initialized, this way you can loop through them
+even if you remove them from the queue.
+
+---------------------------------------
+
+*qicheck(<queue_iterator_id>);
+checks whether there is a next member in the iterator's queue, 1 when
+it does, 0 otherwise.
+
+---------------------------------------
+
+*qiget(<queue_iterator_id>);
+
+obtains the next member in the iterator's queue, returns the next member's
+id or 0 when it doesnt exist.
+
+Example:
+ for( set .@elem,qiget(.@queue_iterator_id); qicheck(.@queue_iterator_id); set .@elem,qiget(.@queue_iterator_id) ) {
+ //Do something
+ }
+
+---------------------------------------
+
+*qiclear(<queue_iterator_id>);
+
+Deletes a queue iterator from memory and returns 1 when it fails,
+otherwise 0 is returned.
+
+---------------------------------------
diff --git a/doc/whisper_sys.txt b/doc/whisper_sys.txt
index c5c042f4d..3c870b543 100644
--- a/doc/whisper_sys.txt
+++ b/doc/whisper_sys.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= NPC Whisper System
//===== By: ==================================================
//= lordalfa
diff --git a/doc/woe_time_explanation.txt b/doc/woe_time_explanation.txt
index 2b645118e..9f288eae7 100644
--- a/doc/woe_time_explanation.txt
+++ b/doc/woe_time_explanation.txt
@@ -1,4 +1,4 @@
-//===== Hercules Documentation ================================
+//===== Hercules Documentation ===============================
//= WoE Time Explanation
//===== By: ==================================================
//= erKURITA
diff --git a/npc/MOTD.txt b/npc/MOTD.txt
new file mode 100644
index 000000000..7b2f086b4
--- /dev/null
+++ b/npc/MOTD.txt
@@ -0,0 +1,15 @@
+//====================================================
+//= _ _ _
+//= | | | | | |
+//= | |_| | ___ _ __ ___ _ _| | ___ ___
+//= | _ |/ _ \ '__/ __| | | | |/ _ \/ __|
+//= | | | | __/ | | (__| |_| | | __/\__ \
+//= \_| |_/\___|_| \___|\__,_|_|\___||___/
+//=
+//= http://hercules.ws/board/
+//====================================================
+// run when any character logs in, attached to them.
+- script HerculesMOTD -1,{
+message strcharinfo(0),"Welcome to Hercules! Enjoy! Please report any bugs you find.";
+end;
+} \ No newline at end of file
diff --git a/npc/airports/airships.txt b/npc/airports/airships.txt
index eb621c9bf..b45d20312 100644
--- a/npc/airports/airships.txt
+++ b/npc/airports/airships.txt
@@ -1,18 +1,18 @@
//===== Hercules Script ======================================
//= The Airship System Script
-//===== By: ==================================================
-//= rAthena Dev Team
-//===== Description: =========================================
+//===== By: ==================================================
+//= Hercules Dev Team
+//===== Description: =========================================
//= The Airship System used in the official servers.
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= Official NPCs.
-//============================================================
+//============================================================
-//============================================================
+//============================================================
//= Domestic Airship Route
//= ... -> Juno -> Einbroch -> Lighthalzen -> Einbroch
//= -> Juno -> Hugel -> ...
-//============================================================
+//============================================================
airplane,243,73,0 script #AirshipWarp-1 45,1,1,{
end;
diff --git a/npc/airports/hugel.txt b/npc/airports/hugel.txt
index d5f3155ed..2d65fdc30 100644
--- a/npc/airports/hugel.txt
+++ b/npc/airports/hugel.txt
@@ -1,12 +1,12 @@
//===== Hercules Script ======================================
//= Hugel Airport NPCs
-//===== By: ==================================================
-//= rAthena Dev Team
-//===== Description: =========================================
+//===== By: ==================================================
+//= Hercules Dev Team
+//===== Description: =========================================
//= Hugel Airport NPCs
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= Official NPCs.
-//============================================================
+//============================================================
hugel,178,142,0 script toairplane#hugel 45,1,1,{
end;
diff --git a/npc/airports/izlude.txt b/npc/airports/izlude.txt
index 48ccbde79..fe46c1169 100644
--- a/npc/airports/izlude.txt
+++ b/npc/airports/izlude.txt
@@ -1,12 +1,12 @@
//===== Hercules Script ======================================
//= Izlude Airport NPCs
-//===== By: ==================================================
-//= rAthena Dev Team
-//===== Description: =========================================
+//===== By: ==================================================
+//= Hercules Dev Team
+//===== Description: =========================================
//= Izlude Airport NPCs
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= Official NPCs.
-//============================================================
+//============================================================
- script ::Airship_Staff_izlude -1,{
mes "[Airship Staff]";
diff --git a/npc/airports/rachel.txt b/npc/airports/rachel.txt
index 87749961c..88c48cd16 100644
--- a/npc/airports/rachel.txt
+++ b/npc/airports/rachel.txt
@@ -1,12 +1,12 @@
//===== Hercules Script ======================================
//= Rachel Airport NPCs
-//===== By: ==================================================
-//= rAthena Dev Team
-//===== Description: =========================================
+//===== By: ==================================================
+//= Hercules Dev Team
+//===== Description: =========================================
//= Rachel Airport NPCs
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= Official NPCs.
-//============================================================
+//============================================================
ra_fild12,295,208,0 script toairplane#rachel 45,1,1,{
end;
diff --git a/npc/custom/breeder.txt b/npc/custom/breeder.txt
index bf7c34592..2bb3c6274 100644
--- a/npc/custom/breeder.txt
+++ b/npc/custom/breeder.txt
@@ -3,15 +3,16 @@
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
-//= 1.0
+//= 1.1
//===== Description: =========================================
//= One-click automatic mount rentals.
+//= Replaced 'close' with 'end' [Streusel]
//============================================================
prontera,124,201,1 script Universal Rental NPC 726,{
if (ismounting()) {
message strcharinfo(0),"You must first remove your mount.";
- close; }
+ end; }
else if ((eaclass()&EAJ_THIRDMASK==EAJ_RANGER) && !countitem(6124)) {
if (!checkfalcon() && getskilllv("HT_FALCON") && !checkoption(Option_Wug) && !checkoption(Option_Wugrider)) {
if(select(" ~ Falcon: ~ Warg")==1) setfalcon;
@@ -30,7 +31,7 @@ prontera,124,201,1 script Universal Rental NPC 726,{
else if (!checkmadogear() && getskilllv("NC_MADOLICENCE")) setmadogear;
else {
message strcharinfo(0),"You do not meet requirements to rent.";
- close; }
+ end; }
specialeffect2 EF_TEIHIT3;
end;
}
@@ -45,4 +46,4 @@ prontera,124,201,1 script Universal Rental NPC 726,{
//= 1.3a Fixed a Typo Error. [Samuray22]
//= Thanks to ~AnnieRuru~.
//= 1.4 Optimized Script. No need for 50 million Labels. [Spre]
-//============================================================ \ No newline at end of file
+//============================================================
diff --git a/npc/custom/etc/floating_rates.txt b/npc/custom/etc/floating_rates.txt
index daa11878e..f499a4f9d 100644
--- a/npc/custom/etc/floating_rates.txt
+++ b/npc/custom/etc/floating_rates.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Floating Server Rates
//===== By: ==================================================
//= Lupus
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= It's a simply example of setbattleflag
//= This script will change your server rates from 1x to 1.5x every 6 hours
diff --git a/npc/custom/etc/lottery.txt b/npc/custom/etc/lottery.txt
index 7cc9a53f1..1e35280a4 100644
--- a/npc/custom/etc/lottery.txt
+++ b/npc/custom/etc/lottery.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Lottery
//===== By: ==================================================
//= acky
//===== Current Version: =====================================
//= 1.2.1a
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Daily lottery draw
//===== Additional Comments: =================================
diff --git a/npc/custom/etc/marriage.txt b/npc/custom/etc/marriage.txt
index 0f21c46e7..00f44193a 100644
--- a/npc/custom/etc/marriage.txt
+++ b/npc/custom/etc/marriage.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Wedding Script
//===== By: ==================================================
//= AppleGirl, Evera
//===== Current Version: =====================================
//= 2.9
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Fully working wedding script for all kind of weddings
//===== Additional Comments: =================================
diff --git a/npc/custom/etc/monster_arena.txt b/npc/custom/etc/monster_arena.txt
index 0b6b1cc96..52ffa115b 100644
--- a/npc/custom/etc/monster_arena.txt
+++ b/npc/custom/etc/monster_arena.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Monster vs Monster
//===== By: ==================================================
//= acky
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Players train monsters and battle other players.
//= Experience can be earned and monsters upgraded.
diff --git a/npc/custom/etc/morroc_raceway.txt b/npc/custom/etc/morroc_raceway.txt
index 768084173..34614538a 100644
--- a/npc/custom/etc/morroc_raceway.txt
+++ b/npc/custom/etc/morroc_raceway.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Morroc Raceway
//===== By: ==================================================
//= acky
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Lets players race around Morroc (pvp_y_1-5)
//===== Additional Comments: =================================
diff --git a/npc/custom/etc/mvp_arena.txt b/npc/custom/etc/mvp_arena.txt
index de4eb542b..d95ed7621 100644
--- a/npc/custom/etc/mvp_arena.txt
+++ b/npc/custom/etc/mvp_arena.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= MVP Arena
//===== By: ==================================================
//= Darkchild
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Rooms containing 16 different MVPs
//===== Additional Comments: =================================
diff --git a/npc/custom/etc/penal_servitude.txt b/npc/custom/etc/penal_servitude.txt
index bfbd39c63..414458cb9 100644
--- a/npc/custom/etc/penal_servitude.txt
+++ b/npc/custom/etc/penal_servitude.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Penal Servitude
//===== By: ==================================================
//= Lupus
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= A simple Penal Servitude Script.
//= It could cheer up your prisoners a bit.
diff --git a/npc/custom/etc/quest_warper.txt b/npc/custom/etc/quest_warper.txt
index 2c2d31083..840325636 100644
--- a/npc/custom/etc/quest_warper.txt
+++ b/npc/custom/etc/quest_warper.txt
@@ -1,14 +1,14 @@
-//===== rAthena Script ============================================
+//===== Hercules Script ======================================
//= Quest Warper Script
-//===== By: =======================================================
+//===== By: ==================================================
//= DZeroX, Darkchild, Neouni
-//===== Current Version: ==========================================
+//===== Current Version: =====================================
//= 2.3
-//===== Compatible With: ==========================================
-//= rAthena SVN
-//===== Description: ==============================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= Warper that works only after locations are unlocked.
-//===== Additional Comments: ======================================
+//===== Additional Comments: =================================
//= 1.0 - NPCs created
//= 1.1 - Add Dungeons by sturm
//= 1.2 - Add All char in account unlocked by ace_killer
@@ -66,7 +66,7 @@
//= 2.3 - Added new town maps, cleanup, and removed pre-1.8 backwards fix. [Euphy]
//=================================================================
-//========================Function=&=Script========================
+//========================Function & Script========================
function script Q_Warpra {
mes "[Warpra]";
diff --git a/npc/custom/etc/rpsroulette.txt b/npc/custom/etc/rpsroulette.txt
index 8e3d04a3e..87048a97b 100644
--- a/npc/custom/etc/rpsroulette.txt
+++ b/npc/custom/etc/rpsroulette.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Rock Scissors Roulette
//===== By: ==================================================
//= acky
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Plays a hybrid Russian Roulette Rock Scissors Paper game.
//===== Additional Comments: =================================
diff --git a/npc/custom/etc/shifty_assassin.txt b/npc/custom/etc/shifty_assassin.txt
index 46d3aab07..d0fe41d45 100644
--- a/npc/custom/etc/shifty_assassin.txt
+++ b/npc/custom/etc/shifty_assassin.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Shifty Assassin
//===== By: ==================================================
//= acky
//===== Current Version: =====================================
//= 1.1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Players buy ninjas to assassinate other players
//===== Additional Comments: =================================
diff --git a/npc/custom/etc/stock_market.txt b/npc/custom/etc/stock_market.txt
index 6f90bcaef..26d368cdf 100644
--- a/npc/custom/etc/stock_market.txt
+++ b/npc/custom/etc/stock_market.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Stock Market Game
//===== By: ==================================================
//= acky
//===== Current Version: =====================================
//= 1.3.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= NPC for a stock market game.
//===== Additional Comments: =================================
diff --git a/npc/custom/events/disguise.txt b/npc/custom/events/disguise.txt
index a3113a288..ad5ba1185 100644
--- a/npc/custom/events/disguise.txt
+++ b/npc/custom/events/disguise.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Disguise Event
//===== By: ==================================================
//= GmOcean
//===== Current Version: =====================================
//= 5.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Additional Comments: =================================
//= Note: This script requires PCRE to run properly.
//= 5.0 Last update by GmOcean.
diff --git a/npc/custom/events/hallow06.txt b/npc/custom/events/hallow06.txt
index 57c4ebdf6..4663ab996 100644
--- a/npc/custom/events/hallow06.txt
+++ b/npc/custom/events/hallow06.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Custom Halloween Event 2006
//===== By: ==================================================
//= Stryker
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Halloween Event Script
//===== Additional Comments: =================================
diff --git a/npc/custom/events/mushroom_event.txt b/npc/custom/events/mushroom_event.txt
index 9ebd3211a..c13bde1cc 100644
--- a/npc/custom/events/mushroom_event.txt
+++ b/npc/custom/events/mushroom_event.txt
@@ -1,18 +1,18 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Find the Mushroom
//===== By: ==================================================
//= Mysterious
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 3.6a
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= Find the Mushroom - random amount of Mushrooms spawns in random maps.
//= Players need to find these mushrooms and kill them to gain prizes!
//===== Additional Comments: =================================
//= 3.0 Fully Functional with Rewritten script. [Mysterious]
//= 3.6a Slightly edited. [Euphy]
-//============================================================
+//============================================================
prontera,142,228,6 script Find the Mushroom 1084,{
mes "[ Find The Mushroom ]";
diff --git a/npc/custom/events/uneasy_cemetery.txt b/npc/custom/events/uneasy_cemetery.txt
index 60d569483..50262933d 100644
--- a/npc/custom/events/uneasy_cemetery.txt
+++ b/npc/custom/events/uneasy_cemetery.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Uneasy Prontera Cemetery Quest
//===== By: ==================================================
//= Lupus
//===== Current Version: =====================================
//= 1.2a (Tested and fully working!)
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= A periodical quest of the Uneasy Cemetery (Kill undead / Prevent their appearance)
//= Every day, at the midnight Prontera receive a wave of Undeads.
diff --git a/npc/custom/events/valentinesdayexp.txt b/npc/custom/events/valentinesdayexp.txt
index 509b25f71..065d4e32d 100644
--- a/npc/custom/events/valentinesdayexp.txt
+++ b/npc/custom/events/valentinesdayexp.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Valentine Event Script + EXP bonus
//===== By: ==================================================
//= Lupus (based on Muad_Dib's work)
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN; 4500+
+//= Hercules
//===== Description: =========================================
// Close to other official stValentine event (added white chocolate)
// Custom: Handmade choco gives some EXP bonuses to married people
diff --git a/npc/custom/events/xmas_rings_event.txt b/npc/custom/events/xmas_rings_event.txt
index 1a52fd43a..7c0ec5bf0 100644
--- a/npc/custom/events/xmas_rings_event.txt
+++ b/npc/custom/events/xmas_rings_event.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Karachun Event (Xmas Rings Quest)
//===== By: ==================================================
//= Lupus (1.0)
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN; 4880+ (with 'setItemScript' command)
+//= Hercules
//===== Description: =========================================
//= Custom event: Karachun (from 8 Dec till 8 Jan), X-Mas, HNY
//===== Additional Comments: =================================
diff --git a/npc/custom/healer.txt b/npc/custom/healer.txt
index 5533330cd..31f247695 100644
--- a/npc/custom/healer.txt
+++ b/npc/custom/healer.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Healer
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Basic healer script.
//============================================================
diff --git a/npc/custom/item_signer.txt b/npc/custom/item_signer.txt
index 96c33ba00..b70244ed1 100644
--- a/npc/custom/item_signer.txt
+++ b/npc/custom/item_signer.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Sign Your Items
//===== By: ==================================================
//= Lupus
//===== Current Version: =====================================
//= 1.1a
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Write you name on your rare equipment or weapon ^_-
//===== Additional Comments: =================================
diff --git a/npc/custom/itemmall.txt b/npc/custom/itemmall.txt
index b6c4bb800..6eb162f9c 100644
--- a/npc/custom/itemmall.txt
+++ b/npc/custom/itemmall.txt
@@ -1,13 +1,13 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Shop Street
//===== By: ==================================================
//= Masao
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
-//= A Shop Street in Prontera.
+//= Street shops in Prontera.
//============================================================
prontera,147,240,5 shop Armor 99,2304:10000,2306:20000,2308:20000,2310:50000,2311:50000,2313:50000,2315:75000,2317:100000,2322:20000,2326:60000,2331:75000,2342:100000,2353:75000,2364:150000,2367:100000,2399:50000
diff --git a/npc/custom/jobmaster.txt b/npc/custom/jobmaster.txt
index c4c259b64..00963bf36 100644
--- a/npc/custom/jobmaster.txt
+++ b/npc/custom/jobmaster.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Job Master
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= rAthena SVN r16114+
+//= Hercules
//===== Description: =========================================
//= A fully functional job changer.
//===== Additional Comments: =================================
diff --git a/npc/custom/platinum_skills.txt b/npc/custom/platinum_skills.txt
index 4de742817..7f80158a3 100644
--- a/npc/custom/platinum_skills.txt
+++ b/npc/custom/platinum_skills.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Platinum Skills
//===== By: ==================================================
//= Keichii, DarkChild
//===== Current Version: =====================================
//= 2.8
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Single NPC that assigns quests skills for all classes
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/dead_branch.txt b/npc/custom/quests/dead_branch.txt
index 505da6c0a..306a553c8 100644
--- a/npc/custom/quests/dead_branch.txt
+++ b/npc/custom/quests/dead_branch.txt
@@ -1,16 +1,16 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Dead Branch (+Bloody Branch) Quest
-//===== By: ==================================================
+//===== By: ==================================================
//= GM-Yevon
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//= Hercules
+//===== Description: =========================================
// Simple item trade-in quest, a person can get a Dead Branch
// by simply providing the items: Log x3 (7201), Wooden Heart x1 (7189),
// Trunk x5 (1019), and Wooden Gnarl x1 (7222).
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.1 Optimized, added Bloody Branch with 0.01% chance [Lupus]
//============================================================
diff --git a/npc/custom/quests/elvenear.txt b/npc/custom/quests/elvenear.txt
index c547bf524..4cb5c11de 100644
--- a/npc/custom/quests/elvenear.txt
+++ b/npc/custom/quests/elvenear.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Daily Job Quest For Elven Ears
//===== By: ==================================================
//= someone
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Elven Ears (require 75+ Base Level)
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/event_6_new_hats.txt b/npc/custom/quests/event_6_new_hats.txt
index 56edaed19..37b5e52b7 100644
--- a/npc/custom/quests/event_6_new_hats.txt
+++ b/npc/custom/quests/event_6_new_hats.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Custom Quest For New Headgears
//===== By: ==================================================
//= RedxSwordxHero, Lupus
//===== Current Version: =====================================
//= 1.4b
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= 4 brothers give you quests to get 6 new hats (missing
//= from official quests)
diff --git a/npc/custom/quests/hunting_missions.txt b/npc/custom/quests/hunting_missions.txt
index d89ad3281..fd07b8de6 100644
--- a/npc/custom/quests/hunting_missions.txt
+++ b/npc/custom/quests/hunting_missions.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Hunting Missions
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Random hunting missions.
//= Rewards are based on quest difficulty.
diff --git a/npc/custom/quests/jewel_case.txt b/npc/custom/quests/jewel_case.txt
index dfa52bdf6..9ec952a23 100644
--- a/npc/custom/quests/jewel_case.txt
+++ b/npc/custom/quests/jewel_case.txt
@@ -1,16 +1,14 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Jewel Case Quest
//===== By: ==================================================
//= Lupus
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= A quest for players at base level 99,
//= with Jewel Case as a reward.
-//===== Additional Comments: =================================
-//=
//============================================================
lighthalzen,108,229,2 script La Fenn 766,{
diff --git a/npc/custom/quests/kaho_balmung.txt b/npc/custom/quests/kaho_balmung.txt
index f3a82def4..a2a154acf 100644
--- a/npc/custom/quests/kaho_balmung.txt
+++ b/npc/custom/quests/kaho_balmung.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Balmung & Lord Kaho's Horns Quest
//===== By: ==================================================
//= MagicalTux
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Custom quests for Balmung and Lord Kaho's Horns.
//= WARNING: The quests are very easy, so be careful!
diff --git a/npc/custom/quests/kahohorn.txt b/npc/custom/quests/kahohorn.txt
index 697047821..031631b74 100644
--- a/npc/custom/quests/kahohorn.txt
+++ b/npc/custom/quests/kahohorn.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Lord Kaho's Horns Quest
//===== By: ==================================================
//=
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Custom quest for Lord Kaho's Horns.
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/kings_items.txt b/npc/custom/quests/kings_items.txt
index 8140827c1..d935dac08 100644
--- a/npc/custom/quests/kings_items.txt
+++ b/npc/custom/quests/kings_items.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Event King Items
//===== By: ==================================================
//= $ephiroth
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Grand Circlet Quest combined with Excalibur Quest.
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/may_hats.txt b/npc/custom/quests/may_hats.txt
index 10319ae6a..e0f1f87ee 100644
--- a/npc/custom/quests/may_hats.txt
+++ b/npc/custom/quests/may_hats.txt
@@ -1,4 +1,4 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Quests: Bird Nest, Lion Mask, Skeleton Manteau,
//= Fashion Hip Sack & Sales Banner
//===== By: ==================================================
@@ -6,7 +6,7 @@
//===== Current Version: =====================================
//= 1.01
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Custom quest for some RO mobile game bonus items
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/quest_shop.txt b/npc/custom/quests/quest_shop.txt
index 539c29f23..3f69c73ef 100644
--- a/npc/custom/quests/quest_shop.txt
+++ b/npc/custom/quests/quest_shop.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Euphy's Quest Shop
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.6
//===== Compatible With: =====================================
-//= rAthena SVN r16862+
+//= Hercules
//===== Description: =========================================
//= A dynamic quest shop based on Lunar's, with easier config.
//= Includes support for multiple shops & cashpoints.
diff --git a/npc/custom/quests/questboard.txt b/npc/custom/quests/questboard.txt
index cccbea7ee..abfb61a4d 100644
--- a/npc/custom/quests/questboard.txt
+++ b/npc/custom/quests/questboard.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= tr0n's Questboard
//===== By: ==================================================
//= tr0n
//===== Current Version: =====================================
//= 1.4.4
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Easily add collection and hunting quests.
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/sphinx_mask.txt b/npc/custom/quests/sphinx_mask.txt
index 00910428c..b2cf64559 100644
--- a/npc/custom/quests/sphinx_mask.txt
+++ b/npc/custom/quests/sphinx_mask.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Sphinx Mask Quest (custom)
//===== By: ==================================================
//= sabernet09
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= This quest is related to Umbalian Chief.
//= 1.1 Removed it from official Umbala quests [Lupus]
diff --git a/npc/custom/quests/sunglasses.txt b/npc/custom/quests/sunglasses.txt
index fb3353556..6e44ce007 100644
--- a/npc/custom/quests/sunglasses.txt
+++ b/npc/custom/quests/sunglasses.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Slotted Sunglasses Quest
//===== By: ==================================================
//= amichan
//===== Current Version: =====================================
//= 1.8
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Quest to get Slotted Sunglasses.
//= Will reset after quest completion.
diff --git a/npc/custom/quests/tha_statues.txt b/npc/custom/quests/tha_statues.txt
index fb52d7ed4..a9c53a033 100644
--- a/npc/custom/quests/tha_statues.txt
+++ b/npc/custom/quests/tha_statues.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Custom Thanatos Tower Quest
//===== By: ==================================================
//= Bibilol, Moryagorn
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Custom Thanatos Tower Quest
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/thq/THQS_ChatingNPC.txt b/npc/custom/quests/thq/THQS_ChatingNPC.txt
index 55971e51f..752681e39 100644
--- a/npc/custom/quests/thq/THQS_ChatingNPC.txt
+++ b/npc/custom/quests/thq/THQS_ChatingNPC.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Treasure Hunter Quests
//===== By: ==================================================
//= Fredzilla
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Start for Treasure hunter quests
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/thq/THQS_GuildNPC.txt b/npc/custom/quests/thq/THQS_GuildNPC.txt
index b5bbf5d28..01b14687f 100644
--- a/npc/custom/quests/thq/THQS_GuildNPC.txt
+++ b/npc/custom/quests/thq/THQS_GuildNPC.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Treasure Hunter Quests
//===== By: ==================================================
//= Fredzilla
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Start for Treasure hunter quests
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/thq/THQS_QuestNPC.txt b/npc/custom/quests/thq/THQS_QuestNPC.txt
index 6a3b33699..5b4d98a27 100644
--- a/npc/custom/quests/thq/THQS_QuestNPC.txt
+++ b/npc/custom/quests/thq/THQS_QuestNPC.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Treasure Hunter Quests
//===== By: ==================================================
//= Fredzilla
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Start for Treasure hunter quests
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/thq/THQS_Quests.txt b/npc/custom/quests/thq/THQS_Quests.txt
index b1e6c1652..70494ab9b 100644
--- a/npc/custom/quests/thq/THQS_Quests.txt
+++ b/npc/custom/quests/thq/THQS_Quests.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Treasure Hunter Quests
//===== By: ==================================================
//= Fredzilla
//===== Current Version: =====================================
//= 1.6
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Start for Treasure hunter quests
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/thq/THQS_TTShop.txt b/npc/custom/quests/thq/THQS_TTShop.txt
index 7752a0960..0a706869b 100644
--- a/npc/custom/quests/thq/THQS_TTShop.txt
+++ b/npc/custom/quests/thq/THQS_TTShop.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Treasure Hunter Quests
//===== By: ==================================================
//= Fredzilla
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Start for Treasure hunter quests
//===== Additional Comments: =================================
diff --git a/npc/custom/quests/umbalian_language.txt b/npc/custom/quests/umbalian_language.txt
index 674ea6e03..f41b5500e 100644
--- a/npc/custom/quests/umbalian_language.txt
+++ b/npc/custom/quests/umbalian_language.txt
@@ -1,14 +1,14 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Custom Umbalian Language Quest
-//===== By: ==================================================
+//===== By: ==================================================
//= sabernet09
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.1
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= 1.1 Removed it from offical Umbala Quests [Lupus]
-//============================================================
+//============================================================
prontera,145,290,5 script Mason 742,{
mes "[Mason]";
diff --git a/npc/custom/quests/valhallen.txt b/npc/custom/quests/valhallen.txt
index 19480b105..07112c1c8 100644
--- a/npc/custom/quests/valhallen.txt
+++ b/npc/custom/quests/valhallen.txt
@@ -1,17 +1,17 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Valhallen Items Quests NPC
-//===== By: ==================================================
+//===== By: ==================================================
//= Avaji
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.1
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= All-in-one: Mjolnir,Sleipnir,Brisingamen,Gleipnir,Megingjard
//= Custom quest, ingredients based on official RO FAQ
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.1 Optimized. [Euphy]
-//============================================================
+//============================================================
prontera,147,171,5 script Lenneth 811,{
mes "[Lenneth]";
diff --git a/npc/custom/resetnpc.txt b/npc/custom/resetnpc.txt
index c3ad9afb2..cbb633e6a 100644
--- a/npc/custom/resetnpc.txt
+++ b/npc/custom/resetnpc.txt
@@ -1,7 +1,7 @@
//===== Hercules Script ======================================
//= Reset NPC
//===== By: ==================================================
-//= rAthena Dev Team
+//= Hercules Dev Team
//===== Current Version: =====================================
//= 1.3
//===== Description: =========================================
diff --git a/npc/custom/stylist.txt b/npc/custom/stylist.txt
index 77bbf7bdb..853553f26 100644
--- a/npc/custom/stylist.txt
+++ b/npc/custom/stylist.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Stylist
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Changes your hair style, hair color, and cloth color.
//===== Additional Comments: =================================
diff --git a/npc/custom/warper.txt b/npc/custom/warper.txt
index b0fb07a66..14dcfebf0 100644
--- a/npc/custom/warper.txt
+++ b/npc/custom/warper.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Warper
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= A complete - but very condensed - warper script.
//= Coordinates written largely by Tekno-Kanix and ToastOfDoom.
diff --git a/npc/custom/woe_controller.txt b/npc/custom/woe_controller.txt
index fe88b0934..c7d3f4e9e 100644
--- a/npc/custom/woe_controller.txt
+++ b/npc/custom/woe_controller.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Euphy's WOE Controller
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
-//= rAthena SVN r16958+
+//= Hercules
//===== Description: =========================================
//= A controller for War of Emperium designed for
//= simplicity and ease of use.
diff --git a/npc/guild/payg_cas02.txt b/npc/guild/payg_cas02.txt
index 4ada2da53..27e5fc4f0 100644
--- a/npc/guild/payg_cas02.txt
+++ b/npc/guild/payg_cas02.txt
@@ -3,20 +3,21 @@
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
-//= 1.3
+//= 1.4
//===== Description: =========================================
-//= NPCs that relate to Payon Guild Castle 1
+//= NPCs that relate to Payon Guild Castle 2
//===== Additional Comments: =================================
//= 1.0 First Version. No longer uses functions. [L0ne_W0lf]
//= 1.1 Corrected flag-in spawn point. [L0ne_W0lf]
//= 1.2 Removed dialog from interior flags. [L0ne_W0lf]
//= Fixed position of Guild dungeon switch.
//= 1.3 Partially rewrote Script. [Masao]
+//= 1.4 Fixed names [Streusel]
//============================================================
// Guild Flags (Outside Castle)
//============================================================
-- script Sacred Palace#1::OutsideFlagsPA2 722,{
+- script Scarlet Palace#1::OutsideFlagsPA2 722,{
set .@GID, GetCastleData("payg_cas02",1);
@@ -66,14 +67,14 @@ OnRecvCastlePy02:
end;
}
-pay_gld,292,112,6 duplicate(OutsideFlagsPA2) Sacred Palace#1-2 722
-pay_gld,292,120,6 duplicate(OutsideFlagsPA2) Sacred Palace#2 722
-pay_gld,291,135,6 duplicate(OutsideFlagsPA2) Sacred Palace#3 722
-pay_gld,271,163,0 duplicate(OutsideFlagsPA2) Sacred Palace#4 722
+pay_gld,292,112,6 duplicate(OutsideFlagsPA2) Scarlet Palace#1-2 722
+pay_gld,292,120,6 duplicate(OutsideFlagsPA2) Scarlet Palace#2 722
+pay_gld,291,135,6 duplicate(OutsideFlagsPA2) Scarlet Palace#3 722
+pay_gld,271,163,0 duplicate(OutsideFlagsPA2) Scarlet Palace#4 722
// Guild Flags (Inside Castle)
//============================================================
-- script Sacred Palace#5::InsideFlagsPA2 722,{
+- script Scarlet Palace#5::InsideFlagsPA2 722,{
end;
OnRecvCastlePy02:
@@ -81,17 +82,17 @@ OnRecvCastlePy02:
end;
}
-payg_cas02,254,40,6 duplicate(InsideFlagsPA2) Sacred Palace#5-2 722
-payg_cas02,254,48,6 duplicate(InsideFlagsPA2) Sacred Palace#6 722
-payg_cas02,202,49,0 duplicate(InsideFlagsPA2) Sacred Palace#7 722
-payg_cas02,209,49,0 duplicate(InsideFlagsPA2) Sacred Palace#8 722
-payg_cas02,59,282,4 duplicate(InsideFlagsPA2) Sacred Palace#9 722
-payg_cas02,70,282,4 duplicate(InsideFlagsPA2) Sacred Palace#10 722
+payg_cas02,254,40,6 duplicate(InsideFlagsPA2) Scarlet Palace#5-2 722
+payg_cas02,254,48,6 duplicate(InsideFlagsPA2) Scarlet Palace#6 722
+payg_cas02,202,49,0 duplicate(InsideFlagsPA2) Scarlet Palace#7 722
+payg_cas02,209,49,0 duplicate(InsideFlagsPA2) Scarlet Palace#8 722
+payg_cas02,59,282,4 duplicate(InsideFlagsPA2) Scarlet Palace#9 722
+payg_cas02,70,282,4 duplicate(InsideFlagsPA2) Scarlet Palace#10 722
// Guild Flag (Town)
//============================================================
-payon,97,322,4 duplicate(InsideFlagsPA2) Sacred Altar#11 722
-payon,166,173,3 duplicate(InsideFlagsPA2) Sacred Altar#12 722
+payon,97,322,4 duplicate(InsideFlagsPA2) Scarlet Palace#11 722
+payon,166,173,3 duplicate(InsideFlagsPA2) Scarlet Palace#12 722
// Kafra Employee
//============================================================
diff --git a/npc/guild/payg_cas04.txt b/npc/guild/payg_cas04.txt
index b3ddce797..4f584e368 100644
--- a/npc/guild/payg_cas04.txt
+++ b/npc/guild/payg_cas04.txt
@@ -3,20 +3,21 @@
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
-//= 1.3
+//= 1.4
//===== Description: =========================================
-//= NPCs that relate to Payon Guild Castle 1
+//= NPCs that relate to Payon Guild Castle 4
//===== Additional Comments: =================================
//= 1.0 First Version. No longer uses functions. [L0ne_W0lf]
//= 1.1 Corrected flag-in spawn point. [L0ne_W0lf]
//= 1.2 Removed dialog from interior flags. [L0ne_W0lf]
//= Fixed position of Guild dungeon switch.
//= 1.3 Partially rewrote Script. [Masao]
+//= 1.4 Fixed named [Streusel]
//============================================================
// Guild Flags (Outside Castle)
//============================================================
-- script Scarlet Palace#1::OutsideFlagsPA4 722,{
+- script Sacred Altar#1::OutsideFlagsPA4 722,{
set .@GID, GetCastleData("payg_cas04",1);
@@ -66,14 +67,14 @@ OnRecvCastlePy04:
end;
}
-pay_gld,137,160,0 duplicate(OutsideFlagsPA4) Scarlet Palace#1-2 722
-pay_gld,143,160,0 duplicate(OutsideFlagsPA4) Scarlet Palace#2 722
-pay_gld,133,151,2 duplicate(OutsideFlagsPA4) Scarlet Palace#3 722
-pay_gld,153,166,1 duplicate(OutsideFlagsPA4) Scarlet Palace#4 722
+pay_gld,137,160,0 duplicate(OutsideFlagsPA4) Sacred Altar#1-2 722
+pay_gld,143,160,0 duplicate(OutsideFlagsPA4) Sacred Altar#2 722
+pay_gld,133,151,2 duplicate(OutsideFlagsPA4) Sacred Altar#3 722
+pay_gld,153,166,1 duplicate(OutsideFlagsPA4) Sacred Altar#4 722
// Guild Flags (Inside Castle)
//============================================================
-- script Scarlet Palace#5::InsideFlagsPA4 722,{
+- script Sacred Altar#5::InsideFlagsPA4 722,{
end;
OnRecvCastlePy04:
@@ -81,17 +82,17 @@ OnRecvCastlePy04:
end;
}
-payg_cas04,255,259,0 duplicate(InsideFlagsPA4) Scarlet Palace#5-2 722
-payg_cas04,248,259,0 duplicate(InsideFlagsPA4) Scarlet Palace#6 722
-payg_cas04,248,168,6 duplicate(InsideFlagsPA4) Scarlet Palace#7 722
-payg_cas04,248,160,6 duplicate(InsideFlagsPA4) Scarlet Palace#8 722
-payg_cas04,232,181,4 duplicate(InsideFlagsPA4) Scarlet Palace#9 722
-payg_cas04,239,181,4 duplicate(InsideFlagsPA4) Scarlet Palace#10 722
+payg_cas04,255,259,0 duplicate(InsideFlagsPA4) Sacred Altar#5-2 722
+payg_cas04,248,259,0 duplicate(InsideFlagsPA4) Sacred Altar#6 722
+payg_cas04,248,168,6 duplicate(InsideFlagsPA4) Sacred Altar#7 722
+payg_cas04,248,160,6 duplicate(InsideFlagsPA4) Sacred Altar#8 722
+payg_cas04,232,181,4 duplicate(InsideFlagsPA4) Sacred Altar#9 722
+payg_cas04,239,181,4 duplicate(InsideFlagsPA4) Sacred Altar#10 722
// Guild Flag (Town)
//============================================================
-payon,118,322,4 duplicate(InsideFlagsPA4) Scarlet Palace#11 722
-payon,166,165,3 duplicate(InsideFlagsPA4) Scarlet Palace#12 722
+payon,118,322,4 duplicate(InsideFlagsPA4) Sacred Altar#11 722
+payon,166,165,3 duplicate(InsideFlagsPA4) Sacred Altar#12 722
// Kafra Employee
//============================================================
diff --git a/npc/instances/EndlessTower.txt b/npc/instances/EndlessTower.txt
index 7edbc618f..68cf25000 100644
--- a/npc/instances/EndlessTower.txt
+++ b/npc/instances/EndlessTower.txt
@@ -481,7 +481,7 @@ e_tower,151,185,4 script Purification Stone#et2 844,{
}
else {
delitem 6000,1; //Dark_Ashes
- instance_announce 0, .@move_name$ + ". You will be warped to the 26th Level.",bc_map,"0x00ff99";
+ instance_announce -1, .@move_name$ + ". You will be warped to the 26th Level.",bc_map,"0x00ff99";
warp "2@tower",52,354;
}
break;
@@ -493,7 +493,7 @@ e_tower,151,185,4 script Purification Stone#et2 844,{
}
else {
delitem 6000,2; //Dark_Ashes
- instance_announce 0, .@move_name$ + ". You will be warped to the 51st Level.",bc_map,"0x00ff99";
+ instance_announce -1, .@move_name$ + ". You will be warped to the 51st Level.",bc_map,"0x00ff99";
warp "3@tower",52,354;
}
break;
@@ -505,7 +505,7 @@ e_tower,151,185,4 script Purification Stone#et2 844,{
}
else {
delitem 6000,3; //Dark_Ashes
- instance_announce 0, .@move_name$ + ". You will be warped to the 76th Level.",bc_map,"0x00ff99";
+ instance_announce -1, .@move_name$ + ". You will be warped to the 76th Level.",bc_map,"0x00ff99";
warp "4@tower",52,354;
}
break;
@@ -532,11 +532,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 1
}
else
- instance_announce 0, "Remaining Monsters on the 1st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 1st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 1st Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 1st Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("1FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -567,11 +567,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 2
}
else
- instance_announce 0, "Remaining Monsters on the 2nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 2nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 2nd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 2nd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("2FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -605,11 +605,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 3
}
else
- instance_announce 0, "Remaining Monsters on the 3rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 3rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 3rd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 3rd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("3FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -643,11 +643,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 4
}
else
- instance_announce 0, "Remaining Monsters on the 4th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 4th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 4th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 4th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("4FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -680,11 +680,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 5
}
else
- instance_announce 0, "Remaining Monsters on the 5th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 5th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 5th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 5th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("5FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -716,11 +716,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 6
}
else
- instance_announce 0, "Remaining Monsters on the 6th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 6th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 6th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 6th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("6FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -752,11 +752,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 7
}
else
- instance_announce 0, "Remaining Monsters on the 7th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 7th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 7th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 7th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("7FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -786,11 +786,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 8
}
else
- instance_announce 0, "Remaining Monsters on the 8th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 8th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 8th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 8th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("8FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -821,11 +821,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 9
}
else
- instance_announce 0, "Remaining Monsters on the 9th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 9th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 9th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 9th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("9FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -856,11 +856,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 10
}
else
- instance_announce 0, "Remaining Monsters on the 10th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 10th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 10th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 10th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("10FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -892,11 +892,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 11
}
else
- instance_announce 0, "Remaining Monsters on the 11th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 11th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 11th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 11th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("11FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -926,11 +926,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 12
}
else
- instance_announce 0, "Remaining Monsters on the 12th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 12th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 12th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 12th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("12FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -961,11 +961,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 13
}
else
- instance_announce 0, "Remaining Monsters on the 13th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 13th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 13th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 13th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("13FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -998,11 +998,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 14
}
else
- instance_announce 0, "Remaining Monsters on the 14th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 14th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 14th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 14th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("14FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1037,11 +1037,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 15
}
else
- instance_announce 0, "Remaining Monsters on the 15th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 15th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 15th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 15th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("15FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1073,11 +1073,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 16
}
else
- instance_announce 0, "Remaining Monsters on the 16th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 16th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 16th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 16th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("16FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1109,11 +1109,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 17
}
else
- instance_announce 0, "Remaining Monsters on the 17th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 17th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 17th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 17th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("17FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1143,11 +1143,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 18
}
else
- instance_announce 0, "Remaining Monsters on the 18th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 18th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 18th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 18th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("18FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1179,11 +1179,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 19
}
else
- instance_announce 0, "Remaining Monsters on the 19th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 19th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 19th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 19th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("19FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1213,11 +1213,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 20
}
else
- instance_announce 0, "Remaining Monsters on the 20th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 20th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 20th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 20th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("20FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1250,11 +1250,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 21
}
else
- instance_announce 0, "Remaining Monsters on the 21st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 21st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 21st Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 21st Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("21FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1288,11 +1288,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 22
}
else
- instance_announce 0, "Remaining Monsters on the 22nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 22nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 22nd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 22nd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("22FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1325,11 +1325,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 23
}
else
- instance_announce 0, "Remaining Monsters on the 23rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 23rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 23rd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 23rd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("23FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1360,11 +1360,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 24
}
else
- instance_announce 0, "Remaining Monsters on the 24th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 24th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 24th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 24th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("24FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1395,11 +1395,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 25
}
else
- instance_announce 0, "Remaining Monsters on the 25th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 25th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 25th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 25th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("25FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1487,11 +1487,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 26
}
else
- instance_announce 0, "Remaining Monsters on the 26th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 26th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 26th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 26th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("26FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1525,11 +1525,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 27
}
else
- instance_announce 0, "Remaining Monsters on the 27th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 27th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 27th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 27th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("27FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1561,11 +1561,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 28
}
else
- instance_announce 0, "Remaining Monsters on the 28th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 28th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 28th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 28th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("28FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1599,11 +1599,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 29
}
else
- instance_announce 0, "Remaining Monsters on the 29th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 29th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 29th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 29th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("29FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1633,11 +1633,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 30
}
else
- instance_announce 0, "Remaining Monsters on the 30th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 30th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 30th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 30th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("30FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1669,11 +1669,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 31
}
else
- instance_announce 0, "Remaining Monsters on the 31st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 31st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 31st Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 31st Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("31FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1708,11 +1708,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 32
}
else
- instance_announce 0, "Remaining Monsters on the 32nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 32nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 32nd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 32nd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("32FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1745,11 +1745,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 33
}
else
- instance_announce 0, "Remaining Monsters on the 33rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 33rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 33rd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 33rd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("33FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1780,11 +1780,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 34
}
else
- instance_announce 0, "Remaining Monsters on the 34th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 34th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 34th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 34th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("34FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1817,11 +1817,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 35
}
else
- instance_announce 0, "Remaining Monsters on the 35th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 35th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 35th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 35th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("35FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1852,11 +1852,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 36
}
else
- instance_announce 0, "Remaining Monsters on the 36th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 36th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 36th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 36th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("36FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1887,11 +1887,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 37
}
else
- instance_announce 0, "Remaining Monsters on the 37th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 37th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 37th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 37th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("37FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1921,11 +1921,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 38
}
else
- instance_announce 0, "Remaining Monsters on the 38th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 38th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 38th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 38th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("38FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1958,11 +1958,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 39
}
else
- instance_announce 0, "Remaining Monsters on the 39th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 39th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 39th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 39th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("39FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -1996,11 +1996,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 40
}
else
- instance_announce 0, "Remaining Monsters on the 40th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 40th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 40th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 40th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("40FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2029,11 +2029,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 41
}
else
- instance_announce 0, "Remaining Monsters on the 41st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 41st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 41st Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 41st Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("41FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2066,11 +2066,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 42
}
else
- instance_announce 0, "Remaining Monsters on the 42nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 42nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 42nd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 42nd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("42FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2102,11 +2102,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 43
}
else
- instance_announce 0, "Remaining Monsters on the 43rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 43rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 43rd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 43rd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("43FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2139,11 +2139,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 44
}
else
- instance_announce 0, "Remaining Monsters on the 44th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 44th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 44th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 44th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("44FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2175,11 +2175,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 45
}
else
- instance_announce 0, "Remaining Monsters on the 45th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 45th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 45th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 45th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("45FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2209,11 +2209,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 46
}
else
- instance_announce 0, "Remaining Monsters on the 46th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 46th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 46th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 46th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("46FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2245,11 +2245,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 47
}
else
- instance_announce 0, "Remaining Monsters on the 47 Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 47 Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 47th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 47th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("47FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2280,11 +2280,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 48
}
else
- instance_announce 0, "Remaining Monsters on the 48th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 48th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 48th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 48th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("48FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2317,11 +2317,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 49
}
else
- instance_announce 0, "Remaining Monsters on the 49th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 49th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 49th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 49th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("49FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2354,11 +2354,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 50
}
else
- instance_announce 0, "Remaining Monsters on the 50th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 50th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 50th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 50th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("50FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2444,11 +2444,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 51
}
else
- instance_announce 0, "Remaining Monsters on the 51st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 51st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 51st Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 51st Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("51FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2482,11 +2482,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 52
}
else
- instance_announce 0, "Remaining Monsters on the 52nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 52nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 52nd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 52nd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("52FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2516,11 +2516,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 53
}
else
- instance_announce 0, "Remaining Monsters on the 53rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 53rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 53rd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 53rd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("53FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2551,11 +2551,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 54
}
else
- instance_announce 0, "Remaining Monsters on the 54th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 54th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 54th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 54th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("54FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2587,11 +2587,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 55
}
else
- instance_announce 0, "Remaining Monsters on the 55th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 55th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 55th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 55th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("55FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2624,11 +2624,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 56
}
else
- instance_announce 0, "Remaining Monsters on the 56th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 56th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 56th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 56th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("56FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2665,11 +2665,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 57
}
else
- instance_announce 0, "Remaining Monsters on the 57th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 57th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 57th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 57th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("57FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2702,11 +2702,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 58
}
else
- instance_announce 0, "Remaining Monsters on the 58th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 58th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 58th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 58th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("58FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2737,11 +2737,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 59
}
else
- instance_announce 0, "Remaining Monsters on the 59th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 59th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 59th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 59th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("59FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2777,11 +2777,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 60
}
else
- instance_announce 0, "Remaining Monsters on the 60th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 60th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 60th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 60th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("60FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2815,11 +2815,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 61
}
else
- instance_announce 0, "Remaining Monsters on the 61st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 61st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 61st Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 61st Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("61FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2848,11 +2848,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 62
}
else
- instance_announce 0, "Remaining Monsters on the 62nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 62nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 62nd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 62nd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("62FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2885,11 +2885,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 63
}
else
- instance_announce 0, "Remaining Monsters on the 63rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 63rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 63rd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 63rd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("63FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2923,11 +2923,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 64
}
else
- instance_announce 0, "Remaining Monsters on the 64th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 64th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 64th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 64th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("64FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2957,11 +2957,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 65
}
else
- instance_announce 0, "Remaining Monsters on the 65th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 65th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 65th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 65th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("65FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -2992,11 +2992,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 66
}
else
- instance_announce 0, "Remaining Monsters on the 66th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 66th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 66th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 66th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("66FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3029,11 +3029,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 67
}
else
- instance_announce 0, "Remaining Monsters on the 67th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 67th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 67th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 67th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("67FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3066,11 +3066,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 68
}
else
- instance_announce 0, "Remaining Monsters on the 68th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 68th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 68th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 68th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("68FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3103,11 +3103,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 69
}
else
- instance_announce 0, "Remaining Monsters on the 69th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 69th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 69th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 69th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("69FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3138,11 +3138,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 70
}
else
- instance_announce 0, "Remaining Monsters on the 70th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 70th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 70th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 70th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("70FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3174,11 +3174,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 71
}
else
- instance_announce 0, "Remaining Monsters on the 71st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 71st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 71st Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 71st Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("71FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3210,11 +3210,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 72
}
else
- instance_announce 0, "Remaining Monsters on the 72nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 72nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 72nd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 72nd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("72FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3248,11 +3248,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 73
}
else
- instance_announce 0, "Remaining Monsters on the 73rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 73rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 73rd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 73rd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("73FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3289,11 +3289,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 74
}
else
- instance_announce 0, "Remaining Monsters on the 74th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 74th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 74th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 74th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("74FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3325,11 +3325,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 75
}
else
- instance_announce 0, "Remaining Monsters on the 75th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1, "Remaining Monsters on the 75th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0, "All Monsters on the 75th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1, "All Monsters on the 75th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("75FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3415,11 +3415,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 76
}
else
- instance_announce 0,"Remaining Monsters on the 76th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 76th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 76th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 76th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("76FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3452,11 +3452,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 77
}
else
- instance_announce 0,"Remaining Monsters on the 77th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 77th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 77th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 77th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("77FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3489,11 +3489,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 78
}
else
- instance_announce 0,"Remaining Monsters on the 78th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 78th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the Level 78th have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the Level 78th have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("78FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3526,11 +3526,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 79
}
else
- instance_announce 0,"Remaining Monsters on the 79th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 79th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 79th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 79th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("79FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3560,11 +3560,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 80
}
else
- instance_announce 0,"Remaining Monsters on the 80th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 80th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 80th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 80th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("80FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3595,11 +3595,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 81
}
else
- instance_announce 0,"Remaining Monsters on the 81st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 81st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 81st Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 81st Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("81FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3632,11 +3632,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 82
}
else
- instance_announce 0,"Remaining Monsters on the 82nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 82nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 82nd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 82nd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("82FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3668,11 +3668,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 83
}
else
- instance_announce 0,"Remaining Monsters on the 83rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 83rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 83rd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 83rd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("83FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3705,11 +3705,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 84
}
else
- instance_announce 0,"Remaining Monsters on the 84th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 84th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 84th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 84th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("84FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3738,11 +3738,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 85
}
else
- instance_announce 0,"Remaining Monsters on the 85th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 85th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 85th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 85th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("85FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3774,11 +3774,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 86
}
else
- instance_announce 0,"Remaining Monsters on the 86th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 86th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 86th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 86th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("86FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3810,11 +3810,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 87
}
else
- instance_announce 0,"Remaining Monsters on the 87th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 87th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 87th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 87th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("87FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3847,11 +3847,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 88
}
else
- instance_announce 0,"Remaining Monsters on the 88th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 88th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 88th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 88th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("88FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3883,11 +3883,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 89
}
else
- instance_announce 0,"Remaining Monsters on the 89th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 89th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 89th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 89th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("89FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3919,11 +3919,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 90
}
else
- instance_announce 0,"Remaining Monsters on the 90th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 90th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 90th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 90th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("90FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3954,11 +3954,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 91
}
else
- instance_announce 0,"Remaining Monsters on the 91st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 91st Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 91st Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 91st Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("91FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -3991,11 +3991,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 92
}
else
- instance_announce 0,"Remaining Monsters on the 92nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 92nd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 92nd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 92nd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("92FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -4027,11 +4027,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 93
}
else
- instance_announce 0,"Remaining Monsters on the 93rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 93rd Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 93rd Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 93rd Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("93FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -4061,11 +4061,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 94
}
else
- instance_announce 0,"Remaining Monsters on the 94th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 94th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 94th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 94th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("94FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -4098,11 +4098,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 95
}
else
- instance_announce 0,"Remaining Monsters on the 95th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 95th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 95th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 95th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("95FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -4133,11 +4133,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 96
}
else
- instance_announce 0,"Remaining Monsters on the 96th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 96th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 96th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 96th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("96FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -4169,11 +4169,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 97
}
else
- instance_announce 0,"Remaining Monsters on the 97th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 97th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 97th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 97th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("97FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -4207,11 +4207,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 98
}
else
- instance_announce 0,"Remaining Monsters on the 98th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 98th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 98th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 98th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("98FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -4302,11 +4302,11 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 99
}
else
- instance_announce 0,"Remaining Monsters on the 99th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Monsters on the 99th Level - " + .@mob_dead_num,bc_map,"0x00ff99";
end;
OnTimer5000:
- instance_announce 0,"All Monsters on the 99th Level have been defeated.",bc_map,"0xffff00";
+ instance_announce -1,"All Monsters on the 99th Level have been defeated.",bc_map,"0xffff00";
donpcevent instance_npcname("99FGate102tower", instance_id())+"::OnEnable";
stopnpctimer;
end;
@@ -4488,7 +4488,7 @@ OnInstanceInit:
OnMyMobDead:
set .@mob_dead_num,mobcount("5@tower",instance_npcname("#102FShadowDust1", instance_id())+"::OnMyMobDead");
if (.@mob_dead_num < 1) {
- instance_announce 0, "Mysterious Voice: Who are you to dare intrude upon my sanctuary?!",bc_map,"0xffff00";
+ instance_announce -1, "Mysterious Voice: Who are you to dare intrude upon my sanctuary?!",bc_map,"0xffff00";
donpcevent instance_npcname("#102FShadowDust", instance_id())+"::OnDisable";
donpcevent instance_npcname("Lucid Crystal#102", instance_id())+"::OnEnable";
//SetItemPartyInMap in_102floor 100
@@ -4633,23 +4633,23 @@ OnEnable:
end;
OnTimer500:
- instance_announce 0,"Guests, huh? I hope you've come here knowing that you'll be buried in this place. If you didn't know, well... it's too late!",bc_map,"0x00ffcc";
+ instance_announce -1,"Guests, huh? I hope you've come here knowing that you'll be buried in this place. If you didn't know, well... it's too late!",bc_map,"0x00ffcc";
end;
OnTimer5500:
- instance_announce 0,"This is why you adventurers always end up dead.",bc_map,"0x00ffcc";
+ instance_announce -1,"This is why you adventurers always end up dead.",bc_map,"0x00ffcc";
end;
OnTimer10500:
- instance_announce 0,"I may applaud you for your courage... Of course, I intend to play with you a little bit first.",bc_map,"0x00ffcc";
+ instance_announce -1,"I may applaud you for your courage... Of course, I intend to play with you a little bit first.",bc_map,"0x00ffcc";
end;
OnTimer15500:
- instance_announce 0,"You know, I like watching humans running around in fear.",bc_map,"0x00ffcc";
+ instance_announce -1,"You know, I like watching humans running around in fear.",bc_map,"0x00ffcc";
end;
OnTimer20500:
- instance_announce 0,"Let's see who runs fastest. Are you ready?",bc_map,"0x00ffcc";
+ instance_announce -1,"Let's see who runs fastest. Are you ready?",bc_map,"0x00ffcc";
stopnpctimer;
areamonster "6@tower",151,66,153,106,"Bone Guardian",1152,50,instance_npcname("#1st Beeper", instance_id())+"::OnMyMobDead";
areamonster "6@tower",158,66,160,106,"Bone Guardian",1152,50,instance_npcname("#1st Beeper", instance_id())+"::OnMyMobDead";
@@ -4662,7 +4662,7 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 101
}
else
- instance_announce 0,"Remaining Targets " + .@mob_dead_num + "ea",bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Targets " + .@mob_dead_num + "ea",bc_map,"0x00ff99";
end;
}
@@ -4674,15 +4674,15 @@ OnEnable:
end;
OnTimer500:
- instance_announce 0,"Well, I guess they aren't too challenging for you.",bc_map,"0x00ffcc";
+ instance_announce -1,"Well, I guess they aren't too challenging for you.",bc_map,"0x00ffcc";
end;
OnTimer5500:
- instance_announce 0,"Let's speed up a little bit, shall we?",bc_map,"0x00ffcc";
+ instance_announce -1,"Let's speed up a little bit, shall we?",bc_map,"0x00ffcc";
end;
OnTimer10500:
- instance_announce 0,"I demand an encore!",bc_map,"0x00ffcc";
+ instance_announce -1,"I demand an encore!",bc_map,"0x00ffcc";
stopnpctimer;
areamonster "6@tower",151,66,153,106,"Wind Guardian",1263,30,instance_npcname("#2nd Beeper", instance_id())+"::OnMyMobDead";
areamonster "6@tower",158,66,160,106,"Wind Guardian",1263,30,instance_npcname("#2nd Beeper", instance_id())+"::OnMyMobDead";
@@ -4695,7 +4695,7 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 102
}
else
- instance_announce 0,"Remaining Targets " + .@mob_dead_num + "ea",bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Targets " + .@mob_dead_num + "ea",bc_map,"0x00ff99";
end;
}
@@ -4707,15 +4707,15 @@ OnEnable:
end;
OnTimer500:
- instance_announce 0,"Yes, this is getting exciting!",bc_map,"0x00ffcc";
+ instance_announce -1,"Yes, this is getting exciting!",bc_map,"0x00ffcc";
end;
OnTimer5500:
- instance_announce 0,"I'll remember you as one of a few that have managed to entertain me.",bc_map,"0x00ffcc";
+ instance_announce -1,"I'll remember you as one of a few that have managed to entertain me.",bc_map,"0x00ffcc";
end;
OnTimer10500:
- instance_announce 0,"How would you like to play one more round?",bc_map,"0x00ffcc";
+ instance_announce -1,"How would you like to play one more round?",bc_map,"0x00ffcc";
stopnpctimer;
areamonster "6@tower",151,66,153,106,"Sword Edge Guardian",1132,20,instance_npcname("#3rd Beeper", instance_id())+"::OnMyMobDead";
areamonster "6@tower",158,66,160,106,"Sword Edge Guardian",1132,20,instance_npcname("#3rd Beeper", instance_id())+"::OnMyMobDead";
@@ -4728,7 +4728,7 @@ OnMyMobDead:
//SetItemPartyInMap in_102floor 103
}
else
- instance_announce 0,"Remaining Targets " + .@mob_dead_num + "ea",bc_map,"0x00ff99";
+ instance_announce -1,"Remaining Targets " + .@mob_dead_num + "ea",bc_map,"0x00ff99";
end;
}
@@ -4740,15 +4740,15 @@ OnEnable:
end;
OnTimer500:
- instance_announce 0,"Okay, the time has come to make my appearance!",bc_map,"0x00ffcc";
+ instance_announce -1,"Okay, the time has come to make my appearance!",bc_map,"0x00ffcc";
end;
OnTimer5500:
- instance_announce 0,"Do you want to know who I am?",bc_map,"0x00ffcc";
+ instance_announce -1,"Do you want to know who I am?",bc_map,"0x00ffcc";
end;
OnTimer10500:
- instance_announce 0,"You'll soon know. Mine is the face of death!",bc_map,"0x00ffcc";
+ instance_announce -1,"You'll soon know. Mine is the face of death!",bc_map,"0x00ffcc";
stopnpctimer;
monster "6@tower",156,147,"Nacht Sieger",1956,1,instance_npcname("#4th Beeper", instance_id())+"::OnMyMobDead";
end;
@@ -4825,15 +4825,15 @@ OnEnable:
end;
OnTimer500:
- instance_announce 0,"This... This can't be happening! I can't be defeated!",bc_map,"0xffff00";
+ instance_announce -1,"This... This can't be happening! I can't be defeated!",bc_map,"0xffff00";
end;
OnTimer5500:
- instance_announce 0,"Nooo! My soul... My shell...! Nooo~!",bc_map,"0xffff00";
+ instance_announce -1,"Nooo! My soul... My shell...! Nooo~!",bc_map,"0xffff00";
end;
OnTimer10500:
- instance_announce 0,"Nacht Sieger's body has turned into dark ashes that scattered in the wind.",bc_map,"0x00ffcc";
+ instance_announce -1,"Nacht Sieger's body has turned into dark ashes that scattered in the wind.",bc_map,"0x00ffcc";
stopnpctimer;
end;
}
diff --git a/npc/instances/NydhoggsNest.txt b/npc/instances/NydhoggsNest.txt
index fffe47227..2d48d0341 100644
--- a/npc/instances/NydhoggsNest.txt
+++ b/npc/instances/NydhoggsNest.txt
@@ -1811,7 +1811,7 @@ OnEnable:
monster "1@nyd",255,255,"Nidhoggur's Guardian#10",2021,1,instance_npcname("nyd_call_mon_1", instance_id())+"::OnMyMobDead";
monster "1@nyd",225,245,"Nidhoggur's Guardian#11",2021,1,instance_npcname("nyd_call_mon_1", instance_id())+"::OnMyMobDead";
monster "1@nyd",230,280,"Nidhoggur's Guardian#12",2021,1,instance_npcname("nyd_call_mon_1", instance_id())+"::OnMyMobDead";
- instance_announce 0, "Nidhoggur's Guardian : Protect the Guardian's Sanctuary. Get rid of the intruders.",bc_map,"0x00ff99";
+ instance_announce -1, "Nidhoggur's Guardian : Protect the Guardian's Sanctuary. Get rid of the intruders.",bc_map,"0x00ff99";
end;
OnDisable:
@@ -1822,7 +1822,7 @@ OnDisable:
OnMyMobDead:
set .@mob_dead_num,mobcount("1@nyd", instance_npcname("nyd_call_mon_1", instance_id())+"::OnMyMobDead");
if (.@mob_dead_num < 1) {
- instance_announce 0, "All of Nidhoggur's Guardians have been defeated!",bc_map,"0x00ff99";
+ instance_announce -1, "All of Nidhoggur's Guardians have been defeated!",bc_map,"0x00ff99";
donpcevent instance_npcname("ins_nyd_1f_timer", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_to2f_warp", instance_id())+"::OnEnable";
set 'ins_nyd2,2;
@@ -1848,23 +1848,23 @@ OnDisable:
end;
OnTimer900000:
- instance_announce 0, "World Tree Yggdrasil : There's not much time left. Please hurry.",bc_map,"0xFFFF00";
+ instance_announce -1, "World Tree Yggdrasil : There's not much time left. Please hurry.",bc_map,"0xFFFF00";
end;
OnTimer1200000:
- instance_announce 0, "World Tree Yggdrasil : My powers are slowly disappearing. Please hurry.",bc_map,"0xFFFF00";
+ instance_announce -1, "World Tree Yggdrasil : My powers are slowly disappearing. Please hurry.",bc_map,"0xFFFF00";
end;
OnTimer1500000:
- instance_announce 0, "World Tree Yggdrasil : I'm... almost at my limit... please hurry up." ,bc_map,"0xFFFF00";
+ instance_announce -1, "World Tree Yggdrasil : I'm... almost at my limit... please hurry up." ,bc_map,"0xFFFF00";
end;
OnTimer1800000:
- instance_announce 0, "World Tree Yggdrasil : You've failed... but I will use what power I have left... to send you out of here.",bc_map,"0xFFFF00";
+ instance_announce -1, "World Tree Yggdrasil : You've failed... but I will use what power I have left... to send you out of here.",bc_map,"0xFFFF00";
end;
OnTimer1830000:
- instance_announce 0, "Opening of the Gate has failed.",bc_map,"0xFFFF00";
+ instance_announce -1, "Opening of the Gate has failed.",bc_map,"0xFFFF00";
end;
OnTimer1850000:
@@ -1933,15 +1933,15 @@ OnDisable:
end;
OnTimer12000:
- instance_announce 0, "Nidhoggur's Shadow : No more...I can't stand this anymore...",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : No more...I can't stand this anymore...",bc_map,"0xFFFF00";
end;
OnTimer15000:
- instance_announce 0, "Nidhoggur's Shadow : I need...I need the World Tree Yggdrasil's powers...",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I need...I need the World Tree Yggdrasil's powers...",bc_map,"0xFFFF00";
end;
OnTimer18000:
- instance_announce 0, "Nidhoggur's Shadow : Destroy...everything...",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : Destroy...everything...",bc_map,"0xFFFF00";
end;
/*
stopnpctimer;
@@ -1983,7 +1983,7 @@ OnInstanceInit:
OnEnable:
enablenpc instance_npcname("nyd_2f_boss_enter_call", instance_id());
monster "2@nyd",199,327,"Nidhoggur's Shadow#",2022,1,instance_npcname("nyd_2f_boss_enter_call", instance_id())+"::OnMyMobDead";
- instance_announce 0, "Nidhoggur's Shadow : I will devour all of you...you and the World Tree Yggdrasil.",bc_map,"0x00ff99";
+ instance_announce -1, "Nidhoggur's Shadow : I will devour all of you...you and the World Tree Yggdrasil.",bc_map,"0x00ff99";
//donpcevent instance_npcname("nyd_2f_boss_enter_call", instance_id())+"::Ongo";
initnpctimer;
end;
@@ -1996,7 +1996,7 @@ OnDisable:
OnTimer180000:
set .@rullet,rand(1,4);
if (.@rullet == 1) {
- instance_announce 0, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2005,7 +2005,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 2) {
- instance_announce 0, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2014,7 +2014,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 3) {
- instance_announce 0, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2023,7 +2023,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 4) {
- instance_announce 0, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
@@ -2037,7 +2037,7 @@ OnTimer180000:
OnMyMobDead:
set .@mob_dead_num,mobcount("2@nyd",instance_npcname("nyd_2f_boss_enter_call", instance_id())+"::OnMyMobDead");
if (.@mob_dead_num < 1) {
- instance_announce 0, "Nidhoggur's Shadow : World Tree Yggdrasil's guardian... his powers are disappearing...",bc_map,"0x00ff99";
+ instance_announce -1, "Nidhoggur's Shadow : World Tree Yggdrasil's guardian... his powers are disappearing...",bc_map,"0x00ff99";
donpcevent instance_npcname("World Tree Yggdrasil#2F", instance_id())+"::OnEnable";
donpcevent instance_npcname("nyd_2f_boss_enter_call", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_boss_enter_logic", instance_id())+"::OnDisable";
@@ -2070,7 +2070,7 @@ OnDisable:
OnTimer180000:
set .@rullet,rand(1,4);
if (.@rullet == 1) {
- instance_announce 0, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2079,7 +2079,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 2) {
- instance_announce 0, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2088,7 +2088,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 3) {
- instance_announce 0, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2097,7 +2097,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 4) {
- instance_announce 0, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
@@ -2134,6 +2134,7 @@ OnTimer180000:
switch(select("Please let me out.:I want to look around for a while.")) {
case 1:
set 'ins_nyd2,0;
+ set ins_nyd,203;
//setquest 3135;
warp "nyd_dun02",98,196;
end;
@@ -2149,7 +2150,7 @@ OnInstanceInit:
OnEnable:
enablenpc instance_npcname("World Tree Yggdrasil#2F", instance_id());
- instance_announce 0, "World Tree Yggdrasil : You did good. Have everyone go to the Magic Circle in the middle, and get ready for the destruction of the nest.",bc_map,"0x00ff99";
+ instance_announce -1, "World Tree Yggdrasil : You did good. Have everyone go to the Magic Circle in the middle, and get ready for the destruction of the nest.",bc_map,"0x00ff99";
end;
OnDisable:
@@ -2208,7 +2209,7 @@ OnEnable:
OnMyMobDead:
set .@mob_dead_num,mobcount("2@nyd",instance_npcname("nyd_2f_red_c", instance_id())+"::OnMyMobDead");
if (.@mob_dead_num < 1) {
- instance_announce 0, "Nidhoggur's Shadow : You're not bad... but I will be your opponent this time.",bc_map,"0x00ff99";
+ instance_announce -1, "Nidhoggur's Shadow : You're not bad... but I will be your opponent this time.",bc_map,"0x00ff99";
donpcevent instance_npcname("nyd_2f_red_c", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_boss_enter_logic", instance_id())+"::OnEnable";
end;
@@ -2226,7 +2227,7 @@ OnTimer180000:
stopnpctimer;
set .@rullet,rand(1,4);
if (.@rullet == 1) {
- instance_announce 0, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2235,7 +2236,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 2) {
- instance_announce 0, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2244,7 +2245,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 3) {
- instance_announce 0, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2253,7 +2254,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 4) {
- instance_announce 0, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
@@ -2368,7 +2369,7 @@ OnEnable:
OnMyMobDead:
set .@mob_dead_num,mobcount("2@nyd",instance_npcname("nyd_2f_white_c", instance_id())+"::OnMyMobDead");
if (.@mob_dead_num < 1) {
- instance_announce 0, "Nidhoggur's Shadow : You're not bad... but I will be your opponent this time.",bc_map,"0x00ff99";
+ instance_announce -1, "Nidhoggur's Shadow : You're not bad... but I will be your opponent this time.",bc_map,"0x00ff99";
donpcevent instance_npcname("nyd_2f_white_c", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_boss_enter_logic", instance_id())+"::OnEnable";
end;
@@ -2386,7 +2387,7 @@ OnTimer180000:
stopnpctimer;
set .@rullet,rand(1,4);
if (.@rullet == 1) {
- instance_announce 0, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2395,7 +2396,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 2) {
- instance_announce 0, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2404,7 +2405,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 3) {
- instance_announce 0, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2413,7 +2414,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 4) {
- instance_announce 0, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
@@ -2529,7 +2530,7 @@ OnEnable:
OnMyMobDead:
set .@mob_dead_num,mobcount("2@nyd",instance_npcname("nyd_2f_yellow_c", instance_id())+"::OnMyMobDead");
if (.@mob_dead_num < 1) {
- instance_announce 0, "Nidhoggur's Shadow : You're not bad...but I will be your opponent this time.",bc_map,"0x00ff99";
+ instance_announce -1, "Nidhoggur's Shadow : You're not bad...but I will be your opponent this time.",bc_map,"0x00ff99";
donpcevent instance_npcname("nyd_2f_yellow_c", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_boss_enter_logic", instance_id())+"::OnEnable";
end;
@@ -2554,7 +2555,7 @@ OnTimer180000:
stopnpctimer;
set .@rullet,rand(1,4);
if (.@rullet == 1) {
- instance_announce 0, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2563,7 +2564,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 2) {
- instance_announce 0, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2572,7 +2573,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 3) {
- instance_announce 0, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2581,7 +2582,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 4) {
- instance_announce 0, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
@@ -2696,7 +2697,7 @@ OnEnable:
OnMyMobDead:
set .@mob_dead_num,mobcount("2@nyd",instance_npcname("nyd_2f_green_c", instance_id())+"::OnMyMobDead");
if (.@mob_dead_num < 1) {
- instance_announce 0, "Nidhoggur's Shadow : You're not bad... but I will be your opponent this time.",bc_map,"0x00ff99";
+ instance_announce -1, "Nidhoggur's Shadow : You're not bad... but I will be your opponent this time.",bc_map,"0x00ff99";
donpcevent instance_npcname("nyd_2f_green_c", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_boss_enter_logic", instance_id())+"::OnEnable";
end;
@@ -2721,7 +2722,7 @@ OnTimer180000:
stopnpctimer;
set .@rullet,rand(1,4);
if (.@rullet == 1) {
- instance_announce 0, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : In this chaos... your blood is just what I need.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2730,7 +2731,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 2) {
- instance_announce 0, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I will freeze every last drop of your blood.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2739,7 +2740,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 3) {
- instance_announce 0, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : Sleep for eternity in an empty illusion.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_green", instance_id())+"::OnDisable";
@@ -2748,7 +2749,7 @@ OnTimer180000:
end;
}
else if (.@rullet == 4) {
- instance_announce 0, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
+ instance_announce -1, "Nidhoggur's Shadow : I'll let you enjoy the pain of dying slowly.",bc_map,"0xFFFF00";
donpcevent instance_npcname("nyd_2f_red", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_white", instance_id())+"::OnDisable";
donpcevent instance_npcname("nyd_2f_yellow", instance_id())+"::OnDisable";
diff --git a/npc/instances/OrcsMemory.txt b/npc/instances/OrcsMemory.txt
index a23499d7e..325b1a739 100644
--- a/npc/instances/OrcsMemory.txt
+++ b/npc/instances/OrcsMemory.txt
@@ -309,19 +309,19 @@ OnMyMobDead:
else if ((.@mob_ran > 28) && (.@mob_ran < 30)) {
monster "1@orcs",0,0,"High Orc",1213,.@mob_dead_num,instance_npcname("#Resurrect Monsters1", instance_id())+"::OnMyMobDead";
if (rand(1,10) == 9) {
- instance_announce 0, "High Orc: We need more defenses! Get more people here!",bc_map,"0xff4444";
+ instance_announce -1, "High Orc: We need more defenses! Get more people here!",bc_map,"0xff4444";
}
}
else if ((.@mob_ran > 26) && (.@mob_ran < 29)) {
areamonster "1@orcs",41,91,51,81,"High Orc",1213,.@mob_dead_num,instance_npcname("#Resurrect Monsters1", instance_id())+"::OnMyMobDead";
if (rand(1,10) == 9) {
- instance_announce 0, "Where are the High Orcs!? Get them to stop the enemies!",bc_map,"0xff4444";
+ instance_announce -1, "Where are the High Orcs!? Get them to stop the enemies!",bc_map,"0xff4444";
}
}
else {
areamonster "1@orcs",17,187,27,177,"High Orc",1213,.@mob_dead_num,instance_npcname("#Resurrect Monsters1", instance_id())+"::OnMyMobDead";
if (rand(1,5) == 3) {
- instance_announce 0, "Caution: The army's starting to concentrate at Zone No. 4.",bc_map,"0x77ff77";
+ instance_announce -1, "Caution: The army's starting to concentrate at Zone No. 4.",bc_map,"0x77ff77";
}
if (rand(1,100) == 50) {
initnpctimer;
@@ -331,11 +331,11 @@ OnMyMobDead:
end;
OnTimer10:
- instance_announce 0, "Shouts of the Chief Orc of Safeguards: Looks like this will take longer than expected. Summon the Stalactic Golems!",bc_map,"0xff4444";
+ instance_announce -1, "Shouts of the Chief Orc of Safeguards: Looks like this will take longer than expected. Summon the Stalactic Golems!",bc_map,"0xff4444";
end;
OnTimer4010:
- instance_announce 0, "Stalactic Golems are digging out of the deep underground.",bc_map,"0x77ff77";
+ instance_announce -1, "Stalactic Golems are digging out of the deep underground.",bc_map,"0x77ff77";
areamonster "1@orcs",17,187,27,177,"Stalactic Golem",1278,20,instance_npcname("#Resurrect Monsters1", instance_id())+"::OnMyMobDead";
stopnpctimer;
end;
@@ -432,7 +432,7 @@ OnMyMobDead:
if (.@mob_dead_num > 0) {
areamonster "1@orcs",43,155,47,159,"Orc Archer",1189,.@mob_dead_num,instance_npcname("#Resurrect Monsters3", instance_id())+"::OnMyMobDead";
if (rand(1,3) == 3) {
- instance_announce 0, "High Orc: Attack them from behind! Cut off their support!",bc_map,"0xff4444";
+ instance_announce -1, "High Orc: Attack them from behind! Cut off their support!",bc_map,"0xff4444";
}
}
}
@@ -490,39 +490,39 @@ OnEnable:
end;
OnTimer10:
- instance_announce 0, "Kruger: Damn... What took you so long!! I don't have all day!!",bc_map,"0xffff00";
+ instance_announce -1, "Kruger: Damn... What took you so long!! I don't have all day!!",bc_map,"0xffff00";
end;
OnTimer5710:
- instance_announce 0, "Kruger: My plan was to let our comrades open the gate, but it's all ruined since I got busted by the Orc Shaman.",bc_map,"0xffff00";
+ instance_announce -1, "Kruger: My plan was to let our comrades open the gate, but it's all ruined since I got busted by the Orc Shaman.",bc_map,"0xffff00";
end;
OnTimer14610:
- instance_announce 0, "Shouts of the Chief Orc of Safeguards: I smell a rat.. Send some patrols to the entrance!!",bc_map,"0xff4444";
+ instance_announce -1, "Shouts of the Chief Orc of Safeguards: I smell a rat.. Send some patrols to the entrance!!",bc_map,"0xff4444";
end;
OnTimer20210:
- instance_announce 0, "Kruger: Darn it.. They'll be here any minute. Ok. Listen to me now.",bc_map,"0xffff00";
+ instance_announce -1, "Kruger: Darn it.. They'll be here any minute. Ok. Listen to me now.",bc_map,"0xffff00";
end;
OnTimer24910:
- instance_announce 0, "Kruger: The Orc Shaman has sealed the 1st basement by dividing it into 4 zones. Each zone has one Enchanted Orc who has the power to unseal the next zone.",bc_map,"0xffff00";
+ instance_announce -1, "Kruger: The Orc Shaman has sealed the 1st basement by dividing it into 4 zones. Each zone has one Enchanted Orc who has the power to unseal the next zone.",bc_map,"0xffff00";
end;
OnTimer34310:
- instance_announce 0, "Kruger: Find those Enchanted Orcs and get rid of them to move to the next zone.",bc_map,"0xffff00";
+ instance_announce -1, "Kruger: Find those Enchanted Orcs and get rid of them to move to the next zone.",bc_map,"0xffff00";
end;
OnTimer39710:
- instance_announce 0, "Kruger: Try to avoid encountering Orcs other then the Enchanted ones. Everytime you kill a normal Orc, High Orcs will gather at the last path to the 2nd floor.",bc_map,"0xffff00";
+ instance_announce -1, "Kruger: Try to avoid encountering Orcs other then the Enchanted ones. Everytime you kill a normal Orc, High Orcs will gather at the last path to the 2nd floor.",bc_map,"0xffff00";
end;
OnTimer49210:
- instance_announce 0, "Kruger: In the worst case, the path to the 2nd floor could be completely blocked. For your own sake, you should be as sneaky as possible.",bc_map,"0xffff00";
+ instance_announce -1, "Kruger: In the worst case, the path to the 2nd floor could be completely blocked. For your own sake, you should be as sneaky as possible.",bc_map,"0xffff00";
end;
OnTimer56310:
- instance_announce 0, "Mission: Sneak in and get rid of the 'Enchanted Orcs'. Avoiding battles with other Orcs is the best way of getting into the 2nd floor.",bc_map,"0x44ffff";
+ instance_announce -1, "Mission: Sneak in and get rid of the 'Enchanted Orcs'. Avoiding battles with other Orcs is the best way of getting into the 2nd floor.",bc_map,"0x44ffff";
donpcevent instance_npcname("#Resurrect Monsters1", instance_id())+"::OnEnable";
donpcevent instance_npcname("#Resurrect Monsters2", instance_id())+"::OnEnable";
donpcevent instance_npcname("#Resurrect Monsters3", instance_id())+"::OnEnable";
@@ -556,11 +556,11 @@ OnContinue:
end;
OnTimer10300:
- instance_announce 0, "Kruger's Whisper: The Orcs here used to be my companions. They just lost their will ever since the Orc Shaman started to control them with her magic.",bc_map,"0xff4499";
+ instance_announce -1, "Kruger's Whisper: The Orcs here used to be my companions. They just lost their will ever since the Orc Shaman started to control them with her magic.",bc_map,"0xff4499";
end;
OnTimer18700:
- instance_announce 0, "Kruger's Whisper: There's nothing we can do but to defeat the Orc Shaman if we want to save the remaining tribes.",bc_map,"0xff4499";
+ instance_announce -1, "Kruger's Whisper: There's nothing we can do but to defeat the Orc Shaman if we want to save the remaining tribes.",bc_map,"0xff4499";
stopnpctimer;
end;
}
@@ -585,11 +585,11 @@ OnContinue:
end;
OnTimer30300:
- instance_announce 0, "Kruger's Whisper: I saw the bodies of our tribe. It seems that the Orc Shaman used those Orcs for her rituals.",bc_map,"0xff4499";
+ instance_announce -1, "Kruger's Whisper: I saw the bodies of our tribe. It seems that the Orc Shaman used those Orcs for her rituals.",bc_map,"0xff4499";
end;
OnTimer37600:
- instance_announce 0, "Kruger's Whisper: ... It all has to do with me. I am responsible for this evil.",bc_map,"0xff4499";
+ instance_announce -1, "Kruger's Whisper: ... It all has to do with me. I am responsible for this evil.",bc_map,"0xff4499";
stopnpctimer;
end;
}
@@ -614,11 +614,11 @@ OnContinue:
end;
OnTimer30300:
- instance_announce 0, "Please, hang in there!",bc_map,"0xff4499";
+ instance_announce -1, "Please, hang in there!",bc_map,"0xff4499";
end;
OnTimer32700:
- instance_announce 0, "We'll get some rest when we get to the 2nd basement after passing through here.",bc_map,"0xff4499";
+ instance_announce -1, "We'll get some rest when we get to the 2nd basement after passing through here.",bc_map,"0xff4499";
stopnpctimer;
end;
}
@@ -724,13 +724,13 @@ OnMyMobDead:
else if ((.@mob_ran > 26) && (.@mob_ran < 29)) {
areamonster "2@orcs",157,112,167,122,"High Orc",1213,.@mob_dead_num,instance_npcname("#2Resurrect Monsters1", instance_id())+"::OnMyMobDead";
if (rand(1,10) == 9) {
- instance_announce 0, "Warning: High Orcs are gathering near area 3.",bc_map,"0xff4444";
+ instance_announce -1, "Warning: High Orcs are gathering near area 3.",bc_map,"0xff4444";
}
}
else {
areamonster "2@orcs",173,13,183,23,"High Orc",1213,.@mob_dead_num,instance_npcname("#2Resurrect Monsters1", instance_id())+"::OnMyMobDead";
if (rand(1,5) == 3) {
- instance_announce 0, "Caution: The Forces have started to concentrate at the Shaman's Altar.",bc_map,"0x77ff77";
+ instance_announce -1, "Caution: The Forces have started to concentrate at the Shaman's Altar.",bc_map,"0x77ff77";
}
if (rand(1,70) == 50) {
initnpctimer;
@@ -740,11 +740,11 @@ OnMyMobDead:
end;
OnTimer10:
- instance_announce 0, "Voice from somewhere: Foolish... Do you really think the altar would fall like that?",bc_map,"0xff4444";
+ instance_announce -1, "Voice from somewhere: Foolish... Do you really think the altar would fall like that?",bc_map,"0xff4444";
end;
OnTimer4010:
- instance_announce 0, "[ Wraiths were summoned by an unknown power ]",bc_map,"0x77ff77";
+ instance_announce -1, "[ Wraiths were summoned by an unknown power ]",bc_map,"0x77ff77";
areamonster "2@orcs",167,25,177,35,"Wraith",1475,30,instance_npcname("#2Resurrect Monsters1", instance_id())+"::OnMyMobDead";
stopnpctimer;
end;
@@ -790,7 +790,7 @@ OnMyMobDead:
if (.@mob_dead_num > 0) {
areamonster "2@orcs",168,10,184,26,"Orc Archer",1189,.@mob_dead_num,instance_npcname("#2Resurrect Monsters3", instance_id())+"::OnMyMobDead";
if (rand(1,15) == 3) {
- instance_announce 0, "Warning: Orc Archer teams are gathering near the altar.",bc_map,"0xff4444";
+ instance_announce -1, "Warning: Orc Archer teams are gathering near the altar.",bc_map,"0xff4444";
}
}
}
@@ -848,27 +848,27 @@ OnEnable:
end;
OnTimer10:
- instance_announce 0, "Kruger's Whisper: I'll tell you how to get to the Shaman's altar.",bc_map,"0xffff00";
+ instance_announce -1, "Kruger's Whisper: I'll tell you how to get to the Shaman's altar.",bc_map,"0xffff00";
end;
OnTimer3510:
- instance_announce 0, "Kruger's Whisper: Do you see the braziers that light the path? Unseal the next zone by strengthening their flames.",bc_map,"0xffff00";
+ instance_announce -1, "Kruger's Whisper: Do you see the braziers that light the path? Unseal the next zone by strengthening their flames.",bc_map,"0xffff00";
end;
OnTimer10710:
- instance_announce 0, "Kruger's Whisper: Of course those monsters won't let you touch the braziers that easily.",bc_map,"0xffff00";
+ instance_announce -1, "Kruger's Whisper: Of course those monsters won't let you touch the braziers that easily.",bc_map,"0xffff00";
end;
OnTimer16310:
- instance_announce 0, "Kruger's Whisper: But still, try keep the battles not too noticable so the Shaman won't guard the altar with her army squad.",bc_map,"0xffff00";
+ instance_announce -1, "Kruger's Whisper: But still, try keep the battles not too noticable so the Shaman won't guard the altar with her army squad.",bc_map,"0xffff00";
end;
OnTimer21910:
- instance_announce 0, "Kruger's Whisper: Only the Party Leader can strengthen the flames, so protect your leader.",bc_map,"0xffff00";
+ instance_announce -1, "Kruger's Whisper: Only the Party Leader can strengthen the flames, so protect your leader.",bc_map,"0xffff00";
end;
OnTimer23910:
- instance_announce 0, "Mission: Unseal the zone by lighting the braziers. They can only be lit in a certain order, so be careful.",bc_map,"0x4444ff";
+ instance_announce -1, "Mission: Unseal the zone by lighting the braziers. They can only be lit in a certain order, so be careful.",bc_map,"0x4444ff";
donpcevent instance_npcname("#2Resurrect Monsters1", instance_id())+"::OnEnable";
donpcevent instance_npcname("#2Resurrect Monsters3", instance_id())+"::OnEnable";
donpcevent instance_npcname("Torch#1-1", instance_id())+"::OnEnable";
@@ -987,7 +987,7 @@ OnInstanceInit:
OnEnable:
monster "2@orcs",109,156,"Safeguard Chief",1981,1,instance_npcname("#Mobs Control", instance_id())+"::OnMyMobDead1";
- instance_announce 0, "The Chief Orc of Safeguards: Oh!! Looks like I have company. Defeat me if you can!!",bc_map,"0xff8888";
+ instance_announce -1, "The Chief Orc of Safeguards: Oh!! Looks like I have company. Defeat me if you can!!",bc_map,"0xff8888";
end;
OnContinue:
@@ -1108,7 +1108,7 @@ OnInstanceInit:
OnEnable:
monster "2@orcs",67,64,"Orc Sniper",1982,1,instance_npcname("#Mobs Control", instance_id())+"::OnMyMobDead2";
- instance_announce 0, "Orc Sniper: Hah! Pretty impressive that you made it this far, but your foolish little trip ends here...",bc_map,"0xff8888";
+ instance_announce -1, "Orc Sniper: Hah! Pretty impressive that you made it this far, but your foolish little trip ends here...",bc_map,"0xff8888";
end;
OnContinue:
@@ -1229,7 +1229,7 @@ OnInstanceInit:
OnEnable:
monster "2@orcs",152,147,"Depraved Orc Spirit",1983,1,instance_npcname("#Mobs Control", instance_id())+"::OnMyMobDead3";
- instance_announce 0, "Depraved Orc Spirit: I smell flesh! Hungry! Wanna try some human meat!!",bc_map,"0xff8888";
+ instance_announce -1, "Depraved Orc Spirit: I smell flesh! Hungry! Wanna try some human meat!!",bc_map,"0xff8888";
end;
OnContinue:
@@ -1240,19 +1240,19 @@ OnContinue:
end;
OnTimer10:
- instance_announce 0, "Shaman Cargalache: Hahaha!! So, you finally made it here. The assassin you sent was just terrible. That stupid Orc is getting cold under my feet.",bc_map,"0xffff00";
+ instance_announce -1, "Shaman Cargalache: Hahaha!! So, you finally made it here. The assassin you sent was just terrible. That stupid Orc is getting cold under my feet.",bc_map,"0xffff00";
end;
OnTimer6810:
- instance_announce 0, "Shaman Cargalache: My loyal slave, go get those intruders!",bc_map,"0xffff00";
+ instance_announce -1, "Shaman Cargalache: My loyal slave, go get those intruders!",bc_map,"0xffff00";
end;
OnTimer10310:
- instance_announce 0, "Depraved Orc Hero: Whatever you say, my lord.",bc_map,"0xff7777";
+ instance_announce -1, "Depraved Orc Hero: Whatever you say, my lord.",bc_map,"0xff7777";
end;
OnTimer13110:
- instance_announce 0, "Caution: You have been discovered by Shaman Cargalache. Kruger's plan to assassinate the Shaman has failed. You must defeat Cargalache and find traces of Kruger.",bc_map,"0x8888ff";
+ instance_announce -1, "Caution: You have been discovered by Shaman Cargalache. Kruger's plan to assassinate the Shaman has failed. You must defeat Cargalache and find traces of Kruger.",bc_map,"0x8888ff";
stopnpctimer;
end;
@@ -1278,19 +1278,19 @@ OnMyMobDead:
donpcevent instance_npcname("Kruger#", instance_id())+"::OnEnable";
set .@mob_ran,rand(1,5);
if (.@mob_ran == 1) {
- instance_announce 0, "Shaman Cargalache: How... How could this be... How could someone like you...!!",bc_map,"0xffff00";
+ instance_announce -1, "Shaman Cargalache: How... How could this be... How could someone like you...!!",bc_map,"0xffff00";
}
else if (.@mob_ran == 2) {
- instance_announce 0, "Shaman Cargalache: How is it that I've been overpowered by mere humans!",bc_map,"0xffff00";
+ instance_announce -1, "Shaman Cargalache: How is it that I've been overpowered by mere humans!",bc_map,"0xffff00";
}
else if (.@mob_ran == 3) {
- instance_announce 0, "Shaman Cargalache: This... This can't be the end...",bc_map,"0xffff00";
+ instance_announce -1, "Shaman Cargalache: This... This can't be the end...",bc_map,"0xffff00";
}
else if (.@mob_ran == 4) {
- instance_announce 0, "Shaman Cargalache: I... Can't die... Yet...!",bc_map,"0xffff00";
+ instance_announce -1, "Shaman Cargalache: I... Can't die... Yet...!",bc_map,"0xffff00";
}
else {
- instance_announce 0, "Shaman Cargalache: Defeated by these fools... It can't be happening...!",bc_map,"0xffff00";
+ instance_announce -1, "Shaman Cargalache: Defeated by these fools... It can't be happening...!",bc_map,"0xffff00";
}
donpcevent instance_npcname("#2Resurrect Monsters1", instance_id())+"::OnDisable";
donpcevent instance_npcname("#2Resurrect Monsters3", instance_id())+"::OnDisable";
diff --git a/npc/instances/SealedShrine.txt b/npc/instances/SealedShrine.txt
index fe376c688..b893a1816 100644
--- a/npc/instances/SealedShrine.txt
+++ b/npc/instances/SealedShrine.txt
@@ -263,8 +263,6 @@ monk_test,306,151,3 script Grave of Baphomet#edq 111,{
switch(select("Touch the stone.:Step back.")) {
case 1:
set .@party_id,getcharid(1);
- set .@instance, instance_id(1);
- instance_attach(.@instance);
// 12 hour cooldown
set .@ins_bapho_check,checkquest(3040,PLAYTIME);
@@ -726,7 +724,7 @@ OnDisable:
OnMyMobDead:
if (mobcount("1@cata",instance_npcname("ins_baphomet_lotto3", instance_id())+"::OnMyMobDead") < 1) {
- instance_announce 0, "All apostles of Baphomet are dead!",bc_map,"0x00ff99";
+ instance_announce -1, "All apostles of Baphomet are dead!",bc_map,"0x00ff99";
}
getitem 6002,1; //Token_Of_Apostle
end;
@@ -807,7 +805,7 @@ OnMyMobDead:
mes "[Voice of the Gravestone]";
mes "Now I can substantialize my soul. I'll wait for you in front of the altar of fire located at the center of this grave. Let's meet there.";
next;
- instance_announce 0, "Ancient Hero's Soul : I'll wait for you in front of the altar of fire located at the center",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : I'll wait for you in front of the altar of fire located at the center",bc_map,"0xFFFF00";
mes "I can feel the voice becoming faint.";
close;
}
@@ -1023,7 +1021,7 @@ OnTouch:
mes "[Ancient Hero's Soul]";
mes "Go ahead, warriors.";
cutin "",255;
- instance_announce 0, "Ancient Hero's Soul : Now you can go to the Main Altar's gate. It is located in the Southeast",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : Now you can go to the Main Altar's gate. It is located in the Southeast",bc_map,"0xFFFF00";
close;
}
else if ('ins_baphomet == 4) {
@@ -1178,23 +1176,23 @@ OnDisable:;
end;
OnTimer1800000:
- instance_announce 0, "Ancient Hero's Soul : We don't have enough time! Hurry up!",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : We don't have enough time! Hurry up!",bc_map,"0xFFFF00";
end;
OnTimer2400000:
- instance_announce 0, "Ancient Hero's Soul : My body is disappearing... Hurry up!",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : My body is disappearing... Hurry up!",bc_map,"0xFFFF00";
end;
OnTimer3000000:
- instance_announce 0, "Ancient Hero's Soul : Everything is over... There is no other way but to wait for the next chance...",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : Everything is over... There is no other way but to wait for the next chance...",bc_map,"0xFFFF00";
end;
OnTimer3050000:
- instance_announce 0, "Ancient Hero's Soul : We failed... However... We still have a chance. I hope you will train yourselves until the time comes.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : We failed... However... We still have a chance. I hope you will train yourselves until the time comes.",bc_map,"0xFFFF00";
end;
OnTimer3100000:
- instance_announce 0, "You've failed to open the seal of main altar.",bc_map,"0xFFFF00";
+ instance_announce -1, "You've failed to open the seal of main altar.",bc_map,"0xFFFF00";
end;
OnTimer3500000:
@@ -1221,19 +1219,19 @@ OnDisable:
end;
OnTimer10000:
- instance_announce 0, "Baphomet : Humans... interfering again...",bc_map,"0xdb7093";
+ instance_announce -1, "Baphomet : Humans... interfering again...",bc_map,"0xdb7093";
end;
OnTimer13000:
- instance_announce 0, "Apostle of Baphomet : Humans! Humans have invaded our sanctum!",bc_map,"0xFFFF00";
+ instance_announce -1, "Apostle of Baphomet : Humans! Humans have invaded our sanctum!",bc_map,"0xFFFF00";
end;
OnTimer16000:
- instance_announce 0, "Apostle of Baphomet : Kill the humans! Do not stop the revival of our Master!",bc_map,"0xFFFF00";
+ instance_announce -1, "Apostle of Baphomet : Kill the humans! Do not stop the revival of our Master!",bc_map,"0xFFFF00";
end;
OnTimer18000:
- instance_announce 0, "Apostle of Baphomet : Hurry up and release the seals of the altars! Our Master's return is upon us!",bc_map,"0xFFFF00";
+ instance_announce -1, "Apostle of Baphomet : Hurry up and release the seals of the altars! Our Master's return is upon us!",bc_map,"0xFFFF00";
stopnpctimer;
disablenpc instance_npcname("ins_2f_enter_broad", instance_id());
end;
@@ -1242,7 +1240,7 @@ OnTimer18000:
2@cata,50,67,0 script slave_left -1,5,5,{
OnTouch:
disablenpc instance_npcname("slave_left", instance_id());
- instance_announce 0, "Apostle of Baphomet : Kill the humans! Don't let them interrupt the revival of our Master!",bc_map,"0xFFFF00";
+ instance_announce -1, "Apostle of Baphomet : Kill the humans! Don't let them interrupt the revival of our Master!",bc_map,"0xFFFF00";
monster "2@cata",55,67,"Apostle of Baphomet",1869,1;
monster "2@cata",51,67,"Apostle of Baphomet",1291,1;
monster "2@cata",58,67,"Apostle of Baphomet",1292,1;
@@ -1265,7 +1263,7 @@ OnTouch:
2@cata,109,67,0 script slave_right -1,5,5,{
OnTouch:
disablenpc instance_npcname("slave_right", instance_id());
- instance_announce 0, "Apostle of Baphomet : Kill the humans! Don't let them interrupt the revival of our Master!",bc_map,"0xFFFF00";
+ instance_announce -1, "Apostle of Baphomet : Kill the humans! Don't let them interrupt the revival of our Master!",bc_map,"0xFFFF00";
monster "2@cata",105,67,"Apostle of Baphomet",1869,1;
monster "2@cata",104,67,"Apostle of Baphomet",1291,1;
monster "2@cata",107,67,"Apostle of Baphomet",1869,1;
@@ -1288,7 +1286,7 @@ OnTouch:
2@cata,79,39,0 script slave_down -1,5,5,{
OnTouch:
disablenpc instance_npcname("slave_down", instance_id());
- instance_announce 0, "Apostle of Baphomet : Kill the humans! Don't let them interrupt the revival of our Master!",bc_map,"0xFFFF00";
+ instance_announce -1, "Apostle of Baphomet : Kill the humans! Don't let them interrupt the revival of our Master!",bc_map,"0xFFFF00";
monster "2@cata",78,41,"Apostle of Baphomet",1869,1;
monster "2@cata",79,42,"Apostle of Baphomet",1291,1;
monster "2@cata",78,46,"Apostle of Baphomet",1869,1;
@@ -1330,7 +1328,7 @@ OnTouch:
percentheal -50,0;
sc_start Eff_Stone,20000,0;
setquest 3041;
- instance_announce 0, "The seal activated by putting magical power into the altar.",bc_map,"0x87ceeb";
+ instance_announce -1, "The seal activated by putting magical power into the altar.",bc_map,"0x87ceeb";
mes "I can feel the power of the altar came back by adding magical power.";
next;
mes "But you can't use your magic for 3 minutes because you used your SP on the altar.";
@@ -1414,27 +1412,27 @@ OnDisable:
end;
OnTimer3000:
- instance_announce 0, "Ancient Hero's Soul : My God! The seal of the Main Altar is weakening!",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : My God! The seal of the Main Altar is weakening!",bc_map,"0xFFFF00";
end;
OnTimer6000:
- instance_announce 0, "Ancient Hero's Soul : My descendants... Listen carefully to what I'm going to say.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : My descendants... Listen carefully to what I'm going to say.",bc_map,"0xFFFF00";
end;
OnTimer9000:
- instance_announce 0, "Ancient Hero's Soul : The altars that control the Main Altar's power are located in the Northeast, Southeast, Southwest and Northwest corners of this room.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : The altars that control the Main Altar's power are located in the Northeast, Southeast, Southwest and Northwest corners of this room.",bc_map,"0xFFFF00";
end;
OnTimer12000:
- instance_announce 0, "Ancient Hero's Soul : Find these altars and activate their seals before Baphomet revives.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : Find these altars and activate their seals before Baphomet revives.",bc_map,"0xFFFF00";
end;
OnTimer15000:
- instance_announce 0, "Baphomet : It's too late, weaklings... Now, you'll feel the despair of death!",bc_map,"0xdb7093";
+ instance_announce -1, "Baphomet : It's too late, weaklings... Now, you'll feel the despair of death!",bc_map,"0xdb7093";
end;
OnTimer17000:
- instance_announce 0, "Baphomet : No one can harm me here. You will be my first sacrifice.",bc_map,"0xdb7093";
+ instance_announce -1, "Baphomet : No one can harm me here. You will be my first sacrifice.",bc_map,"0xdb7093";
donpcevent instance_npcname("control_baphomet", instance_id())+"::OnEnable";
donpcevent instance_npcname("ins_2f_hero_broad2", instance_id())+"::OnEnable";
stopnpctimer;
@@ -1457,7 +1455,7 @@ OnMyMobDead:
if (mobcount("2@cata",instance_npcname("control_baphomet", instance_id())+"::OnMyMobDead") < 1) {
set 'ins_baphomet,7;
erasequest 3041;
- instance_announce 0, "Baphomet : No! Nonono! How dare these weaklings defeat me!... No!!...",bc_map,"0xdb7093";
+ instance_announce -1, "Baphomet : No! Nonono! How dare these weaklings defeat me!... No!!...",bc_map,"0xdb7093";
enablenpc instance_npcname("Ancient Hero's Soul#2F", instance_id());
disablenpc instance_npcname("slave_down", instance_id());
disablenpc instance_npcname("slave_left", instance_id());
@@ -1486,31 +1484,31 @@ OnDisable:
end;
OnTimer8000:
- instance_announce 0, "Ancient Hero's Soul : Don't be discouraged, Baphomet can still be defeated!",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : Don't be discouraged, Baphomet can still be defeated!",bc_map,"0xFFFF00";
end;
OnTimer11000:
- instance_announce 0, "Ancient Hero's Soul : Go to the altars and activate their seals.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : Go to the altars and activate their seals.",bc_map,"0xFFFF00";
end;
OnTimer13000:
- instance_announce 0, "Ancient Hero's Soul : Once the seals recover their power, Baphomet will be vulnerable.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : Once the seals recover their power, Baphomet will be vulnerable.",bc_map,"0xFFFF00";
end;
OnTimer16000:
- instance_announce 0, "Ancient Hero's Soul : You should lure Baphomet to the unsealed Altars. Otherwise, your efforts will be futile.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : You should lure Baphomet to the unsealed Altars. Otherwise, your efforts will be futile.",bc_map,"0xFFFF00";
end;
OnTimer19000:
- instance_announce 0, "Ancient Hero's Soul : We have only 1 hour to stop Baphomet. If time runs out, the power of the seals will be useless.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : We have only 1 hour to stop Baphomet. If time runs out, the power of the seals will be useless.",bc_map,"0xFFFF00";
end;
OnTimer22000:
- instance_announce 0, "Baphomet : It's useless. Make more seals. I'll crush them all. None of you will survive!",bc_map,"0xdb7093";
+ instance_announce -1, "Baphomet : It's useless. Make more seals. I'll crush them all. None of you will survive!",bc_map,"0xdb7093";
end;
OnTimer26000:
- instance_announce 0, "Ancient Hero's Soul : The magical power of the central seal is running out. Go to the central seal and put the magical power.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : The magical power of the central seal is running out. Go to the central seal and put the magical power.",bc_map,"0xFFFF00";
enablenpc instance_npcname("Magical Seal#0", instance_id());
disablenpc instance_npcname("Magical Seal#2", instance_id());
disablenpc instance_npcname("Magical Seal#4", instance_id());
@@ -1586,11 +1584,11 @@ OnDisable:
end;
OnTimer3600000:
- instance_announce 0, "Baphomet : krrrr... Now you can't stop me with the seals. All you can do is wait for death!",bc_map,"0xdb7093";
+ instance_announce -1, "Baphomet : krrrr... Now you can't stop me with the seals. All you can do is wait for death!",bc_map,"0xdb7093";
end;
OnTimer3605000:
- instance_announce 0, "Ancient Hero's Soul : We can't stop Baphomet with the magical power of the seals anymore. Now everything depends on God...",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : We can't stop Baphomet with the magical power of the seals anymore. Now everything depends on God...",bc_map,"0xFFFF00";
donpcevent instance_npcname("ins_2f_hero_pattern_c", instance_id())+"::OnDisable";
end;
}
@@ -1609,7 +1607,7 @@ OnDisable:
OnTimer70000:
switch(rand(1,5)) {
case 1:
- instance_announce 0, "Ancient Hero's Soul : The seal of the Main Altar is running out. Strengthen the Main Altar's seal!",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : The seal of the Main Altar is running out. Strengthen the Main Altar's seal!",bc_map,"0xFFFF00";
enablenpc instance_npcname("Magical Seal#0", instance_id());
disablenpc instance_npcname("Magical Seal#2", instance_id());
disablenpc instance_npcname("Magical Seal#4", instance_id());
@@ -1617,7 +1615,7 @@ OnTimer70000:
disablenpc instance_npcname("Magical Seal#10", instance_id());
break;
case 2:
- instance_announce 0, "Ancient Hero's Soul : The magical power of the seal at 2 o'clock is running out. Go to 2 o'clock and put the magical power in the seal.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : The magical power of the seal at 2 o'clock is running out. Go to 2 o'clock and put the magical power in the seal.",bc_map,"0xFFFF00";
disablenpc instance_npcname("Magical Seal#0", instance_id());
enablenpc instance_npcname("Magical Seal#2", instance_id());
disablenpc instance_npcname("Magical Seal#4", instance_id());
@@ -1625,7 +1623,7 @@ OnTimer70000:
disablenpc instance_npcname("Magical Seal#10", instance_id());
break;
case 3:
- instance_announce 0, "Ancient Hero's Soul : The magical power of the seal at 4 o'clock is running out. Go to 4 o'clock and put the magical power in the seal.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : The magical power of the seal at 4 o'clock is running out. Go to 4 o'clock and put the magical power in the seal.",bc_map,"0xFFFF00";
disablenpc instance_npcname("Magical Seal#0", instance_id());
disablenpc instance_npcname("Magical Seal#2", instance_id());
enablenpc instance_npcname("Magical Seal#4", instance_id());
@@ -1633,7 +1631,7 @@ OnTimer70000:
disablenpc instance_npcname("Magical Seal#10", instance_id());
break;
case 4:
- instance_announce 0, "Ancient Hero's Soul : The magical power of the seal at 8 o'clock is running out. Go to 8 o'clock and put the magical power in the seal.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : The magical power of the seal at 8 o'clock is running out. Go to 8 o'clock and put the magical power in the seal.",bc_map,"0xFFFF00";
disablenpc instance_npcname("Magical Seal#0", instance_id());
disablenpc instance_npcname("Magical Seal#2", instance_id());
disablenpc instance_npcname("Magical Seal#4", instance_id());
@@ -1641,7 +1639,7 @@ OnTimer70000:
disablenpc instance_npcname("Magical Seal#10", instance_id());
break;
case 5:
- instance_announce 0, "Ancient Hero's Soul : The magical power of the seal at 10 o'clock is running out. Go to 10 o'clock and put the magical power in the seal.",bc_map,"0xFFFF00";
+ instance_announce -1, "Ancient Hero's Soul : The magical power of the seal at 10 o'clock is running out. Go to 10 o'clock and put the magical power in the seal.",bc_map,"0xFFFF00";
disablenpc instance_npcname("Magical Seal#0", instance_id());
disablenpc instance_npcname("Magical Seal#2", instance_id());
disablenpc instance_npcname("Magical Seal#4", instance_id());
diff --git a/conf/mapflag/battleground.txt b/npc/mapflag/battleground.txt
index f7404c139..736ce6215 100644
--- a/conf/mapflag/battleground.txt
+++ b/npc/mapflag/battleground.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Battleground map setting.
//===== By: ==================================================
//= Epoque
diff --git a/conf/mapflag/gvg.txt b/npc/mapflag/gvg.txt
index 055a1d733..0cd7a3219 100644
--- a/conf/mapflag/gvg.txt
+++ b/npc/mapflag/gvg.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Guild versus Guild mode.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/jail.txt b/npc/mapflag/jail.txt
index 0a8b00846..c2dd16688 100644
--- a/conf/mapflag/jail.txt
+++ b/npc/mapflag/jail.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Jail.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/night.txt b/npc/mapflag/night.txt
index c3e8a47fe..aa12815b3 100644
--- a/conf/mapflag/night.txt
+++ b/npc/mapflag/night.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Night mode.
//===== By: ==================================================
//= Skotlex
diff --git a/conf/mapflag/nightmare.txt b/npc/mapflag/nightmare.txt
index 106ee665a..22c08b263 100644
--- a/conf/mapflag/nightmare.txt
+++ b/npc/mapflag/nightmare.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Nightmare mode.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/nobranch.txt b/npc/mapflag/nobranch.txt
index 0c96bf896..5717fb166 100644
--- a/conf/mapflag/nobranch.txt
+++ b/npc/mapflag/nobranch.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable Dead Branch use.
//===== By: ==================================================
//= HerculesDev Team
diff --git a/conf/mapflag/noexp.txt b/npc/mapflag/noexp.txt
index 0b6fe20c6..0cc4279ca 100644
--- a/conf/mapflag/noexp.txt
+++ b/npc/mapflag/noexp.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable EXP gain.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/noicewall.txt b/npc/mapflag/noicewall.txt
index 5b6e6ad12..8711ea45d 100644
--- a/conf/mapflag/noicewall.txt
+++ b/npc/mapflag/noicewall.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable Ice Wall.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/noloot.txt b/npc/mapflag/noloot.txt
index 380dc506c..43089ed31 100644
--- a/conf/mapflag/noloot.txt
+++ b/npc/mapflag/noloot.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable monster drops.
//===== By: ==================================================
//= Epoque
diff --git a/conf/mapflag/nomemo.txt b/npc/mapflag/nomemo.txt
index f6628bf46..158982e2c 100644
--- a/conf/mapflag/nomemo.txt
+++ b/npc/mapflag/nomemo.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable Warp Portal memory.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/nopenalty.txt b/npc/mapflag/nopenalty.txt
index 083d86105..b29d4d4a7 100644
--- a/conf/mapflag/nopenalty.txt
+++ b/npc/mapflag/nopenalty.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable death penalty.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/nopvp.txt b/npc/mapflag/nopvp.txt
index 9f876c49b..4eb4831b8 100644
--- a/conf/mapflag/nopvp.txt
+++ b/npc/mapflag/nopvp.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable Player versus Player mode.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/noreturn.txt b/npc/mapflag/noreturn.txt
index 696d81460..d5b94f458 100644
--- a/conf/mapflag/noreturn.txt
+++ b/npc/mapflag/noreturn.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable return warp.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/nosave.txt b/npc/mapflag/nosave.txt
index 59a59fcae..1035d2a77 100644
--- a/conf/mapflag/nosave.txt
+++ b/npc/mapflag/nosave.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable auto-save.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/noskill.txt b/npc/mapflag/noskill.txt
index 81540b45a..ec66f27d3 100644
--- a/conf/mapflag/noskill.txt
+++ b/npc/mapflag/noskill.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable skill use.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/noteleport.txt b/npc/mapflag/noteleport.txt
index df25145d8..d969c5522 100644
--- a/conf/mapflag/noteleport.txt
+++ b/npc/mapflag/noteleport.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable teleportation.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/novending.txt b/npc/mapflag/novending.txt
index 5f7ef8e82..4205d9d6a 100644
--- a/conf/mapflag/novending.txt
+++ b/npc/mapflag/novending.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable vending.
//===== By: ==================================================
//= Epoque
diff --git a/conf/mapflag/nowarp.txt b/npc/mapflag/nowarp.txt
index cfeb938a2..304cebf2f 100644
--- a/conf/mapflag/nowarp.txt
+++ b/npc/mapflag/nowarp.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable warping.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/nowarpto.txt b/npc/mapflag/nowarpto.txt
index 2490b8e61..f54dc785f 100644
--- a/conf/mapflag/nowarpto.txt
+++ b/npc/mapflag/nowarpto.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Disable warpto.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/partylock.txt b/npc/mapflag/partylock.txt
index e8d7051f2..ba0014026 100644
--- a/conf/mapflag/partylock.txt
+++ b/npc/mapflag/partylock.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Party lock.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/pvp.txt b/npc/mapflag/pvp.txt
index 4e3ca5762..d72e45a98 100644
--- a/conf/mapflag/pvp.txt
+++ b/npc/mapflag/pvp.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Player versus Player mode.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/pvp_noguild.txt b/npc/mapflag/pvp_noguild.txt
index 166b65764..fe61a3097 100644
--- a/conf/mapflag/pvp_noguild.txt
+++ b/npc/mapflag/pvp_noguild.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Ignore guilds.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/pvp_noparty.txt b/npc/mapflag/pvp_noparty.txt
index bd5e866f6..569a46c2d 100644
--- a/conf/mapflag/pvp_noparty.txt
+++ b/npc/mapflag/pvp_noparty.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Ignore parties.
//===== By: ==================================================
//= Hercules Dev Team
diff --git a/conf/mapflag/reset.txt b/npc/mapflag/reset.txt
index 5354580b9..7af002f22 100644
--- a/conf/mapflag/reset.txt
+++ b/npc/mapflag/reset.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Enable Neuralizer use.
//===== By: ==================================================
//= Daegaladh
diff --git a/conf/mapflag/skillduration.txt b/npc/mapflag/skillduration.txt
index ca2f82a40..ca2f82a40 100644
--- a/conf/mapflag/skillduration.txt
+++ b/npc/mapflag/skillduration.txt
diff --git a/conf/mapflag/skillmodifier.txt b/npc/mapflag/skillmodifier.txt
index bd60806f7..bd60806f7 100644
--- a/conf/mapflag/skillmodifier.txt
+++ b/npc/mapflag/skillmodifier.txt
diff --git a/conf/mapflag/town.txt b/npc/mapflag/town.txt
index 319785524..46331818b 100644
--- a/conf/mapflag/town.txt
+++ b/npc/mapflag/town.txt
@@ -1,4 +1,4 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Mapflag: Town.
//===== By: ==================================================
//= Epoque
diff --git a/conf/mapflag/zone.txt b/npc/mapflag/zone.txt
index 62047effa..62047effa 100644
--- a/conf/mapflag/zone.txt
+++ b/npc/mapflag/zone.txt
diff --git a/npc/merchants/hd_refine.txt b/npc/merchants/hd_refine.txt
new file mode 100644
index 000000000..f944d34ba
--- /dev/null
+++ b/npc/merchants/hd_refine.txt
@@ -0,0 +1,318 @@
+//===== Hercules Script ======================================
+//= HD Refiners
+//===== By: ==================================================
+//= Euphy
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
+//= [Official Conversion]
+//= Refiners that use HD ores to refine equipment. Upon
+//= failure, the equipment is not destroyed; rather, its
+//= refine level decreases by 1. The success rate is identical
+//= to that for Enriched ores.
+//= - "Blacksmith Mighty Hammer" only refines from +7~9.
+//= - "Basta" only refines from +10 and up.
+//===== Additional Comments: =================================
+//= 1.0 First version. [Euphy]
+//============================================================
+
+// Blacksmith Mighty Hammer (+7~9)
+//============================================================
+- script ::MightyHammer -1,{
+ disable_items;
+ mes "[Blacksmith Mighty Hammer]";
+ mes "Unlike others, I am a blacksmith who refines a very limited number of items.";
+ mes "I refine only items that are ^CC0000+7 to +9^000000.";
+ next;
+ mes "[Blacksmith Mighty Hammer]";
+ mes "My specialty is that even if my refining fails, the refine level decreases by 1 without losing the gear. Isn't it great?";
+ next;
+ mes "[Blacksmith Mighty Hammer]";
+ mes "So lets kick this into overdrive, what d' ya say? What item do you want to refine?";
+ next;
+ setarray .@position$[1],"Head","Body","Left Hand","Right Hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
+ set .@menu$,"";
+ for(set .@i,1; .@i<=10; set .@i,.@i+1)
+ set .@menu$, .@menu$+((getequipisequiped(.@i))?getequipname(.@i):.@position$[.@i]+"-[Not equipped]")+":";
+ set .@part, select(.@menu$);
+ if (!getequipisequiped(.@part)) {
+ mes "[Blacksmith Mighty Hammer]";
+ switch(.@part) {
+ case 1:
+ mes "I'm a blacksmith, not a hairstylist.";
+ break;
+ case 2:
+ mes "With my hammer, I will make you a star of the sky.";
+ break;
+ case 3:
+ case 4:
+ mes "Making artificial hands is not my specialty.";
+ break;
+ case 5:
+ mes "Bring out the item so I can refine it!";
+ break;
+ case 6:
+ mes "Where is this foot order coming from?";
+ break;
+ case 7:
+ case 8:
+ mes "Where is the accessory?";
+ break;
+ case 9:
+ mes "What do you want me to refine?";
+ break;
+ case 10:
+ mes "Huh? What do you want me to do?";
+ break;
+ }
+ close;
+ }
+ if (!getequipisenableref(.@part)) {
+ mes "[Blacksmith Mighty Hammer]";
+ mes "This item can't be refined.";
+ close;
+ }
+ if (!getequipisidentify(.@part)) {
+ mes "[Blacksmith Mighty Hammer]";
+ mes "This item can't be refined because it has not been identified.";
+ close;
+ }
+ if (getequiprefinerycnt(.@part) < 7 || getequiprefinerycnt(.@part) > 9) {
+ mes "[Blacksmith Mighty Hammer]";
+ mes "I only handle items with refine levels from +7 to +9.";
+ close;
+ }
+ switch(getequipweaponlv(.@part)) {
+ default:
+ case 0:
+ set .@price,20000;
+ set .@material,6241; //HD_Elunium
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ set .@price,20000;
+ set .@material,6240; //HD_Oridecon
+ break;
+ }
+ mes "[Blacksmith Mighty Hammer]";
+ mes "In order to refine the gear you selected you need ^ff9999"+getitemname(.@material)+"^000000 and 20,000 zeny as a fee.";
+ mes "Do you have them ready?";
+ next;
+ if(select("Yes:No") == 2) {
+ mes "[Blacksmith Mighty Hammer]";
+ mes "I will wait until you are ready.";
+ close;
+ }
+ if (getequiprefinerycnt(.@part) < 100) {
+ mes "[Blacksmith Mighty Hammer]";
+ mes "It looks like this item will likely fail to be refined.";
+ mes "Well, even if it fails, it only decreases by 1 refine level.";
+ mes "Would you like to continue refining?";
+ next;
+ if(select("Yes:No") == 2) {
+ mes "[Blacksmith Mighty Hammer]";
+ mes "Only those who overcome fear of failure will obtain a masterpiece.";
+ close;
+ }
+ }
+ if (countitem(.@material) == 0 || Zeny < .@price) {
+ mes "[Blacksmith Mighty Hammer]";
+ mes "Didn't you just say you had everything ready?";
+ close;
+ }
+ delitem .@material,1;
+ set Zeny, Zeny-.@price;
+ mes "[Blacksmith Mighty Hammer]";
+ mes "Tac! Tac! Tac!";
+ if (getequippercentrefinery(.@part) > rand(100) || getequippercentrefinery(.@part) > rand(100)) {
+ successrefitem .@part;
+ next;
+ emotion e_no1;
+ mes "[Blacksmith Mighty Hammer]";
+ mes "The sound refreshes my mind everytime I hear it.";
+ mes "Here, have it. Refine succeeded flawlessly!";
+ close;
+ }
+ downrefitem .@part;
+ next;
+ emotion e_omg;
+ mes "[Blacksmith Mighty Hammer]";
+ mes "Oops!!";
+ next;
+ mes "[Blacksmith Mighty Hammer]";
+ mes "I am sure a person like you would never blame me for a decrease in refine level by 1. Hmm.";
+ close;
+}
+prt_in,59,54,3 duplicate(MightyHammer) Mighty Hammer#prt 826
+morocc_in,65,30,3 duplicate(MightyHammer) Mighty Hammer#morocc 826
+payon,148,176,3 duplicate(MightyHammer) Mighty Hammer#pay 826
+alberta_in,16,56,3 duplicate(MightyHammer) Mighty Hammer#alb 826
+yuno_in01,171,18,3 duplicate(MightyHammer) Mighty Hammer#yuno 826
+ein_in01,22,82,3 duplicate(MightyHammer) Mighty Hammer#ein 826
+lhz_in02,280,19,3 duplicate(MightyHammer) Mighty Hammer#lhz 826
+
+// iRO NPC locations:
+// moc_para01,38,185,4 duplicate(MightyHammer) Mighty Hammer#ed 826
+// payon,174,133,4 duplicate(MightyHammer) Mighty Hammer#im 826
+
+// Basta (+10 and up)
+//============================================================
+- script ::Basta -1,{
+ disable_items;
+ mes "[Basta]";
+ mes "I'm the best Blacksmith in the whole world, Basta.";
+ mes "But I don't provide a normal refine service.";
+ mes "I only refine equipment ^CC0000over +10^000000.";
+ next;
+ mes "[Basta]";
+ mes "Which equipment do you want to refine?";
+ next;
+ setarray .@position$[1],"Head","Body","Left Hand","Right Hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
+ set .@menu$,"";
+ for(set .@i,1; .@i<=10; set .@i,.@i+1)
+ set .@menu$, .@menu$+((getequipisequiped(.@i))?getequipname(.@i):.@position$[.@i]+"-[Unequipped]")+":";
+ set .@part, select(.@menu$);
+ if (!getequipisequiped(.@part)) {
+ mes "[Basta]";
+ switch(.@part) {
+ case 1:
+ mes "Is your head an equipment?";
+ break;
+ case 2:
+ mes "What do you want me to do?";
+ break;
+ case 3:
+ case 4:
+ mes "Making artificial hands is not my specialty.";
+ break;
+ case 5:
+ mes "Do you even know what a robe is?";
+ break;
+ case 6:
+ mes "If you want to refine your feet, don't come to me, try running a marathon.";
+ break;
+ case 7:
+ case 8:
+ mes "Where is the accessory?";
+ break;
+ case 9:
+ mes "Well... I don't see any equipment worth refining.";
+ break;
+ case 10:
+ mes "I can't make you smart. Go see a school teacher for that.";
+ break;
+ }
+ close;
+ }
+ if (!getequipisenableref(.@part)) {
+ mes "[Basta]";
+ mes "Even I cannot refine this item. There's no way.";
+ close;
+ }
+ if (!getequipisidentify(.@part)) {
+ mes "[Basta]";
+ mes "I can't do anything about unidentified items.";
+ close;
+ }
+ if (getequiprefinerycnt(.@part) < 10) {
+ mes "[Basta]";
+ mes "Haven't I told you? I only refine equipments that are +10 and above.";
+ close;
+ }
+ if (getequiprefinerycnt(.@part) == 20) {
+ mes "[Basta]";
+ mes "This weapon is perfect, no need to refine it anymore~";
+ close;
+ }
+ switch(getequipweaponlv(.@part)) {
+ default:
+ case 0:
+ set .@price,100000;
+ set .@material,6225; //HD_Carnium
+ set .@type$,"armor";
+ break;
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ set .@price,100000;
+ set .@material,6226; //HD_Bradium
+ set .@type$,"weapon";
+ break;
+ }
+ mes "[Basta]";
+ mes "Hmm... is this the one you want to refine?";
+ mes "To refine this equipment, I need 1 ^ff9999"+getitemname(.@material)+"^000000 and 100,000 zeny as a fee.";
+ mes "Do you really want to refine this?";
+ next;
+ if(select("Yes:No") == 2) {
+ mes "[Basta]";
+ mes "Okay. If that's what you want...";
+ close;
+ }
+ if (getequiprefinerycnt(.@part) < 100) {
+ mes "[Basta]";
+ mes "This "+.@type$+" has already been refined pretty high.";
+ mes "If you try to refine it more, the refine level could decrease.";
+ next;
+ mes "[Basta]";
+ mes "I am different from the blacksmiths in others places.";
+ mes "It is impossible that the refine level will drop by, say, 3 or 4... that sounds scary.";
+ mes "Here it can only decrease by 1 level.";
+ next;
+ mes "[Basta]";
+ mes "Compared to other blacksmiths, the risk is smaller.";
+ mes "I've given all precautions. Do you want to try it?";
+ next;
+ if(select("Yes:No") == 2) {
+ mes "[Basta]";
+ mes "Well~";
+ mes "Not challenging at all could also be a kind of wisdom in life.";
+ close;
+ }
+ }
+ if (countitem(.@material) == 0 || Zeny < .@price) {
+ mes "[Basta]";
+ mes "Hmm... You didn't bring all the materials needed.";
+ mes "Come back when you have them all.";
+ close;
+ }
+ delitem .@material,1;
+ set Zeny, Zeny-.@price;
+ mes "Pow! Pow! Pow! Pow!";
+ if (getequippercentrefinery(.@part) > rand(100) || getequippercentrefinery(.@part) > rand(100)) {
+ successrefitem .@part;
+ next;
+ emotion e_no1;
+ mes "[Basta]";
+ mes "Great! Nicely done!!";
+ mes "I really am the best blacksmith in the whole wide world!";
+ close;
+ }
+ downrefitem .@part;
+ next;
+ emotion (!rand(5))?e_cash:e_omg;
+ mes "[Basta]";
+ mes "Aaaaaaaaaaak!!!";
+ next;
+ mes "[Basta]";
+ mes "Damn it!";
+ mes "Refining failed and refine level has decreased!";
+ mes "Even the best blacksmith in the world doesn't guarantee 100% success!";
+ mes "Too bad.";
+ next;
+ mes "[Basta]";
+ mes "I'll do better next time! Don't worry!";
+ close;
+}
+prt_in,57,54,3 duplicate(Basta) Basta#prt 826
+morocc_in,68,30,3 duplicate(Basta) Basta#morocc 826
+payon,148,174,3 duplicate(Basta) Basta#payon 826
+alberta_in,18,56,3 duplicate(Basta) Basta#alberta 826
+yuno_in01,173,18,3 duplicate(Basta) Basta#yuno 826
+ein_in01,24,82,3 duplicate(Basta) Basta#einbroch 826
+lhz_in02,280,17,3 duplicate(Basta) Basta#lighthalzen 826 \ No newline at end of file
diff --git a/npc/other/poring_war.txt b/npc/other/poring_war.txt
index f81b54f89..95a17d241 100644
--- a/npc/other/poring_war.txt
+++ b/npc/other/poring_war.txt
@@ -3,7 +3,7 @@
//===== By: ==================================================
//= Kisuka
//===== Current Version: =====================================
-//= 1.1b
+//= 1.2
//===== Description: =========================================
//= [Aegis Conversion]
//= Poring War
@@ -12,6 +12,7 @@
//= 1.1 Fixed some typos/bugs. [CalciumKid]
//= 1.1a Fixed Waiting rooms witht he default MAX_LEVEL [Slim]
//= 1.1b Fixed incorrect label calls. [Euphy]
+//= 1.2 Added missing barrier resets, credits to Zopokx. [Euphy]
//============================================================
// Poring War Recruiter
@@ -929,23 +930,23 @@ OnStop:
end;
OnAngelingWin:
- removemapflag "poring_w02",mf_partylock;
- removemapflag "poring_w02",mf_pvp;
- removemapflag "poring_w02",mf_pvp_noguild;
- removemapflag "poring_w02",mf_pvp_nocalcrank;
- mapannounce "poring_w02","Mr. Doppel: Angeling Team of party " + getpartyname($@wop_team_a) + " won the battle!",0,0xf08080;
- donpcevent "Deviruchi#wop_endmaster::OnEnable";
- stopnpctimer;
- end;
-
+ set .@i,1;
OnDevilingWin:
removemapflag "poring_w02",mf_partylock;
removemapflag "poring_w02",mf_pvp;
removemapflag "poring_w02",mf_pvp_noguild;
removemapflag "poring_w02",mf_pvp_nocalcrank;
- mapannounce "poring_w02","Mr. Doppel: Deviling Team of party " + getpartyname($@wop_team_d) + " won the battle!",0,0xf08080;
+ if (.@i)
+ mapannounce "poring_w02","Mr. Doppel: Angeling Team of party " + getpartyname($@wop_team_a) + " won the battle!",0,0xf08080;
+ else
+ mapannounce "poring_w02","Mr. Doppel: Deviling Team of party " + getpartyname($@wop_team_d) + " won the battle!",0,0xf08080;
donpcevent "Deviruchi#wop_endmaster::OnEnable";
stopnpctimer;
+ // Reset Barriers
+ donpcevent "#aroom_ingate_wop::OnDisable";
+ donpcevent "#aroom_outgate_wop::OnDisable";
+ donpcevent "#droom_ingate_wop::OnDisable";
+ donpcevent "#droom_outgate_wop::OnDisable";
end;
OnTimer5000:
diff --git a/npc/pre-re/scripts_athena.conf b/npc/pre-re/scripts.conf
index 6a69ede0e..6a69ede0e 100644
--- a/npc/pre-re/scripts_athena.conf
+++ b/npc/pre-re/scripts.conf
diff --git a/npc/pre-re/scripts_main.conf b/npc/pre-re/scripts_main.conf
index e029447b5..db7ed1411 100644
--- a/npc/pre-re/scripts_main.conf
+++ b/npc/pre-re/scripts_main.conf
@@ -26,7 +26,7 @@ npc: npc/other/Global_Functions.txt
npc: npc/other/CashShop_Functions.txt
// ------------------- Common Script Files ----------------------
-import: npc/scripts_athena.conf
+import: npc/scripts.conf
import: npc/scripts_guild.conf
import: npc/scripts_jobs.conf
import: npc/scripts_mapflags.conf
@@ -34,7 +34,7 @@ import: npc/scripts_monsters.conf
import: npc/scripts_warps.conf
// ----------------- Pre-Renewal Script Files -------------------
-import: npc/pre-re/scripts_athena.conf
+import: npc/pre-re/scripts.conf
import: npc/pre-re/scripts_jobs.conf
import: npc/pre-re/scripts_monsters.conf
import: npc/pre-re/scripts_warps.conf
diff --git a/npc/quests/cooking_quest.txt b/npc/quests/cooking_quest.txt
index df99f2c38..4a5cfcd67 100644
--- a/npc/quests/cooking_quest.txt
+++ b/npc/quests/cooking_quest.txt
@@ -1,15 +1,15 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Cooking Quest
-//===== By: ==================================================
+//===== By: ==================================================
//= Reddozen; L0ne_W0lf
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.8a
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= [Aegis Conversion]
//= Official Cooking Quest (10.3)
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.1 Fixed wrong item ID, added missing ";, optimized [Lupus]
//= 1.1a minor bugfix, thx 2 Irmin [Lupus]
//= 1.2 Fixed exploit, some typos [Lupus]
@@ -27,7 +27,7 @@
//= 1.7 Replaced effect numerics with constants. [L0ne_W0lf]
//= 1.8 Renamed the variable cooking to cooking_q [ultramage]
//= 1.8a Minor cleaning. [Euphy]
-//============================================================
+//============================================================
prt_castle,43,30,3 script Charles Orleans#cook 878,{
set .@now_weight,MaxWeight-Weight;
diff --git a/npc/quests/doomed_swords.txt b/npc/quests/doomed_swords.txt
index e911abf20..2c443076f 100644
--- a/npc/quests/doomed_swords.txt
+++ b/npc/quests/doomed_swords.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Doomed Swords Quest
//===== By: ==================================================
//= kobra_k88; L0ne_W0lf
//===== Current Version: =====================================
//= 1.6
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Aegis Conversion]
//= Doomed Swords Quest:
diff --git a/npc/quests/doomed_swords_quest.txt b/npc/quests/doomed_swords_quest.txt
index 1fa85fed4..6c723d8aa 100644
--- a/npc/quests/doomed_swords_quest.txt
+++ b/npc/quests/doomed_swords_quest.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Doomed Swords Quest Part 3
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Aegis Conversion]
//= - Creation of Doomed Swords: Grimtooth, Mysteltain, and
diff --git a/npc/quests/first_class/tu_acolyte.txt b/npc/quests/first_class/tu_acolyte.txt
index 017acc7aa..edd9b05c5 100644
--- a/npc/quests/first_class/tu_acolyte.txt
+++ b/npc/quests/first_class/tu_acolyte.txt
@@ -1,13 +1,13 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Acolyte Class Tutorial and Job Specific Quest
//===== By: ==================================================
//= Fix up by Jukka
//===== Current Version: =====================================
//= 1.6a
//===== Compatible With: =====================================
-//= rAthena SVN (Testet in Trunk 88xx)
+//= Hercules
//===== Description: =========================================
-//=
+//= Tutorial for Acolyte Class
//===== Additional Comments: =================================
//= 1.0 Fully working
//= 1.1 optimized [Lupus]
diff --git a/npc/quests/first_class/tu_merchant.txt b/npc/quests/first_class/tu_merchant.txt
index 95810e2c9..c947d0342 100644
--- a/npc/quests/first_class/tu_merchant.txt
+++ b/npc/quests/first_class/tu_merchant.txt
@@ -1,13 +1,13 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Merchant Class Tutorial and Job Specific Quest
//===== By: ==================================================
//= Fix up by Jukka
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= rAthena SVN (Testet in Trunk 88xx)
+//= Hercules
//===== Description: =========================================
-//=
+//= Tutorial for Merchant Class
//===== Additional Comments: =================================
//= 1.0 Fully working
//= 1.1 Fixed bugs, optimized [Lupus] 1.2 fixed Weight check
diff --git a/npc/quests/gunslinger_quests.txt b/npc/quests/gunslinger_quests.txt
index d45a09c20..f51dc225c 100644
--- a/npc/quests/gunslinger_quests.txt
+++ b/npc/quests/gunslinger_quests.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Gunslinger quests
//===== By: ==================================================
//= Playtester
//===== Current Version: =====================================
//= 1.6c
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Gunslinger guns and bullet quests
//===== Additional Comments: =================================
diff --git a/npc/quests/juice_maker.txt b/npc/quests/juice_maker.txt
index 1a84a377e..5f92a4829 100644
--- a/npc/quests/juice_maker.txt
+++ b/npc/quests/juice_maker.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Juice Maker Quest
//===== By: ==================================================
//= kobra_k88
//===== Current Version: =====================================
//= 2.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Aegis COnversion]
//= Learn where to turn apples, bananas, carrots, and grapes
diff --git a/npc/quests/kiel_hyre_quest.txt b/npc/quests/kiel_hyre_quest.txt
index 4535892c7..3f5a3ddf5 100644
--- a/npc/quests/kiel_hyre_quest.txt
+++ b/npc/quests/kiel_hyre_quest.txt
@@ -1,80 +1,14 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Kiel Hyre Quest
-//===== By: ==================================================
+//===== By: ==================================================
//= L0ne_W0lf (Script), DZeroX (Timer)
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 4.6
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= Quest for opening Robot Factory first and second floors.
//===== Comments: ============================================
-//= See below
-//===== Additional Comments: =================================
-//= 1.0 First version, needs testing [Playtester]
-//= 1.1 Copied over some changes made by -Tsuyuki- [L0ne_W0lf]
-//= Reworked variables slightly so that the permenents ones aside from the
-//= main tracking variable, are deleted when no longer needed. Renamed
-//= several variables that handle strings to @KHInput$. [L0ne_W0lf]
-//= 1.2 Removed duplicate NPCs. [Toms]
-//= 1.3 More Bug fixes, fixed typo. Updated Additional comments. [L0ne_W0lf]
-//= 1.4 Fixed doors not resetting in kh_kiehl01 after 30 second timer is up. [L0ne_W0lf]
-//= 1.5 Another bug fixed (&& instead of ||). [L0ne_W0lf]
-//= 1.6 More squashed bugs with if checking. [L0ne_W0lf]
-//= 1.7 Corrected some spelling mistakes. [Balish]
-// Corrected Exploit with the pub man, giving infinite wine and money.
-// Corrected pool and map not showing text for some states of the quest.
-// Corrected Elly showing cutin but not text for some states of the quest (causing players to log off to continue).
-// Let fisherman talk to you when you have 10 fishes OR MORE.
-// Corrected not letting you enter the tombstone after finishing the quest.
-//= 1.8 Elly now deletes the Iron_Box, and Kiel Hyre deletes the Pin. [L0ne_W0lf]
-//= More security on the 5th Big Door, now makes sure no one outside of who-
-//= acticated it initially can use it. Resets after 10 minutes to make it.
-//= Made it so that you need to be at least step 84 to activate the final door.
-//= Corrected not deleting Allysia's Ring from inventory.
-//= 1.9 Exit will now enable if you are just retrieving the Ring, keeps you from getting stuck. [L0ne_W0lf]
-//= Corrected "KH_Kielh02", was setting off a debug, invalid map index. Should have been "kh_Kiehl02"
-//= Made .KHQuestBusy$ into a temp global variable. $@KHQuestBusy$.
-//= 2.0 Changed the labels on the "Big Doors" to "Identifier Names" to prevent an error with using getvariableofnpc [L0ne_W0lf]
-//= 2.1 Fifth door now checks for a variable HIGHER or EQUAL to 74 not 84, as pointed out by Stollen. [L0ne_W0lf]
-//= 2.2 Another fix for Elly, no longer RESETS to 26 when you talk to her. [L0ne_W0lf]
-//= 2.3 Should NOT have been setting .KHQuestBusy at all. It's not used or accessed anymore. Removed. [L0ne_W0lf]
-//= 2.4 Lots of fixes (4ish) from Valandi. [L0ne_W0lf]
-//= Added a getmapuser check to the mapwarp in KHTimerEnd so it's not trying to warp out 0 users. [L0ne_W0lf]
-//= 2.5 Fixed several small issues (and large one) such as typos in cutins, typos in dialog, etc. [L0ne_W0lf]
-//= Added some of the missing dialogs for several NPCs, and fixed a few NPC locations.
-//= ALL books can now trigger the wall.
-//= Allysia will now summon 4 (was 2) G_CONSTANTS instead of REGULAR constants.
-//= Fixed where Golden_Key and Kiel_Button are deleted.
-//= Removed KHTimerEnd, and instead use OnReset.
-//= Fixed typo in the second NPC that gives Black Keycards.
-//= Added Monster Warps. (Keeps monsters from being in dungeon quest area.) [Non-functional]
-//= 2.6 Stupid mistake, accidentally had 4 copies of the same script in 1... [L0ne_W0lf the bonehead]
-//= 2.7 Fixed the wrong name being displayed for Kiel Hyre in one dialog.
-//= Removed $@KH_DoorInvoker entirely. The quest is now working like it should according to iRO.
-//= Fixed up a few more NPC headers. Facing direction fixes mostly this time.
-//= More progression changes to Kiehl Hyre. He no longer stops dialog after the agents appear.
-//= 2.8 Fixed the weight checking in Vandt, and added official dialog. [L0ne_W0lf]
-//= Added weight checks for all NPCs that give items. Semi-official dialog.
-//= Got the missing portion of dialog for Mills'.
-//= Will add further proper dialogs as I get to them on the second runthrough of the quest.
-//= 2.8a minor optimization with extra goto, else or empty switch [Lupus]
-//= 2.9 Fixed the "enablenpc" problem with the missing spaces. No idea how it happened. [L0ne_W0lf]
-//= 3.0 Fixed a typo in Elly, in her room. (was <= should have been <) [L0ne_W0lf]
-//= Added an 'end;' to the cookie basket. Kiel Hyre's final dialog will now delete all quest-related items.
-//= 3.1 Moved the "delitem" for all related quest items to the proper NPC. [L0ne_W0lf]
-//= 3.2 Fixed error with Allysia teling you to "Go away." maybe. [L0ne_W0lf]
-//= 3.2b Fixed some typos and grammar mistakes. [SinSloth]
-//= 3.3 Fixed the receiver log out bugs. [L0ne_W0lf]
-//= 3.4 Fixed bug when u can't get a Yellow Keycard if u got the Blue one at first [Lupus]
-//= Note: There are many condition checks that should be omitted in the future fixed item names in item_db.txt / txt resources according the quest
-//= for items, should be used bitwise methods in a single variable. So let's fix the rest possible bugs (if they exist) and then optimize ^_-
-//= 3.5 Changed the way the Black Keycard distibuting NPCs work slighty. [L0ne_W0lf]
-//= 3.6 Keil Hyre removes ALL outstanding quest items when he is talked [L0ne_W0lf]
-//= to after finishing the quest.
-//= 3.7 Corrected NPC names to fall within proper restrictions. [L0ne_W0lf]
-//= 3.8 Corrected some delitems. (bugreport:690) [Samuray22]
-//= 3.9 Fixed a cutin not being erased. (bugreport:1539) [L0ne_W0lf]
//= 4.0 A whole bunch-a-updates to various npcs. [L0ne_W0lf]
//= Corrected condition checks throughout the quest.
//= Npcs no longer make use of the goto command.
@@ -7233,3 +7167,68 @@ OnInit:
}
//============================================================================
+//===== Additional Comments: ============================================
+//= 1.0 First version, needs testing [Playtester]
+//= 1.1 Copied over some changes made by -Tsuyuki- [L0ne_W0lf]
+//= Reworked variables slightly so that the permenents ones aside from the
+//= main tracking variable, are deleted when no longer needed. Renamed
+//= several variables that handle strings to @KHInput$. [L0ne_W0lf]
+//= 1.2 Removed duplicate NPCs. [Toms]
+//= 1.3 More Bug fixes, fixed typo. Updated Additional comments. [L0ne_W0lf]
+//= 1.4 Fixed doors not resetting in kh_kiehl01 after 30 second timer is up. [L0ne_W0lf]
+//= 1.5 Another bug fixed (&& instead of ||). [L0ne_W0lf]
+//= 1.6 More squashed bugs with if checking. [L0ne_W0lf]
+//= 1.7 Corrected some spelling mistakes. [Balish]
+// Corrected Exploit with the pub man, giving infinite wine and money.
+// Corrected pool and map not showing text for some states of the quest.
+// Corrected Elly showing cutin but not text for some states of the quest (causing players to log off to continue).
+// Let fisherman talk to you when you have 10 fishes OR MORE.
+// Corrected not letting you enter the tombstone after finishing the quest.
+//= 1.8 Elly now deletes the Iron_Box, and Kiel Hyre deletes the Pin. [L0ne_W0lf]
+//= More security on the 5th Big Door, now makes sure no one outside of who-
+//= acticated it initially can use it. Resets after 10 minutes to make it.
+//= Made it so that you need to be at least step 84 to activate the final door.
+//= Corrected not deleting Allysia's Ring from inventory.
+//= 1.9 Exit will now enable if you are just retrieving the Ring, keeps you from getting stuck. [L0ne_W0lf]
+//= Corrected "KH_Kielh02", was setting off a debug, invalid map index. Should have been "kh_Kiehl02"
+//= Made .KHQuestBusy$ into a temp global variable. $@KHQuestBusy$.
+//= 2.0 Changed the labels on the "Big Doors" to "Identifier Names" to prevent an error with using getvariableofnpc [L0ne_W0lf]
+//= 2.1 Fifth door now checks for a variable HIGHER or EQUAL to 74 not 84, as pointed out by Stollen. [L0ne_W0lf]
+//= 2.2 Another fix for Elly, no longer RESETS to 26 when you talk to her. [L0ne_W0lf]
+//= 2.3 Should NOT have been setting .KHQuestBusy at all. It's not used or accessed anymore. Removed. [L0ne_W0lf]
+//= 2.4 Lots of fixes (4ish) from Valandi. [L0ne_W0lf]
+//= Added a getmapuser check to the mapwarp in KHTimerEnd so it's not trying to warp out 0 users. [L0ne_W0lf]
+//= 2.5 Fixed several small issues (and large one) such as typos in cutins, typos in dialog, etc. [L0ne_W0lf]
+//= Added some of the missing dialogs for several NPCs, and fixed a few NPC locations.
+//= ALL books can now trigger the wall.
+//= Allysia will now summon 4 (was 2) G_CONSTANTS instead of REGULAR constants.
+//= Fixed where Golden_Key and Kiel_Button are deleted.
+//= Removed KHTimerEnd, and instead use OnReset.
+//= Fixed typo in the second NPC that gives Black Keycards.
+//= Added Monster Warps. (Keeps monsters from being in dungeon quest area.) [Non-functional]
+//= 2.6 Stupid mistake, accidentally had 4 copies of the same script in 1... [L0ne_W0lf the bonehead]
+//= 2.7 Fixed the wrong name being displayed for Kiel Hyre in one dialog.
+//= Removed $@KH_DoorInvoker entirely. The quest is now working like it should according to iRO.
+//= Fixed up a few more NPC headers. Facing direction fixes mostly this time.
+//= More progression changes to Kiehl Hyre. He no longer stops dialog after the agents appear.
+//= 2.8 Fixed the weight checking in Vandt, and added official dialog. [L0ne_W0lf]
+//= Added weight checks for all NPCs that give items. Semi-official dialog.
+//= Got the missing portion of dialog for Mills'.
+//= Will add further proper dialogs as I get to them on the second runthrough of the quest.
+//= 2.8a minor optimization with extra goto, else or empty switch [Lupus]
+//= 2.9 Fixed the "enablenpc" problem with the missing spaces. No idea how it happened. [L0ne_W0lf]
+//= 3.0 Fixed a typo in Elly, in her room. (was <= should have been <) [L0ne_W0lf]
+//= Added an 'end;' to the cookie basket. Kiel Hyre's final dialog will now delete all quest-related items.
+//= 3.1 Moved the "delitem" for all related quest items to the proper NPC. [L0ne_W0lf]
+//= 3.2 Fixed error with Allysia teling you to "Go away." maybe. [L0ne_W0lf]
+//= 3.2b Fixed some typos and grammar mistakes. [SinSloth]
+//= 3.3 Fixed the receiver log out bugs. [L0ne_W0lf]
+//= 3.4 Fixed bug when u can't get a Yellow Keycard if u got the Blue one at first [Lupus]
+//= Note: There are many condition checks that should be omitted in the future fixed item names in item_db.txt / txt resources according the quest
+//= for items, should be used bitwise methods in a single variable. So let's fix the rest possible bugs (if they exist) and then optimize ^_-
+//= 3.5 Changed the way the Black Keycard distibuting NPCs work slighty. [L0ne_W0lf]
+//= 3.6 Keil Hyre removes ALL outstanding quest items when he is talked [L0ne_W0lf]
+//= to after finishing the quest.
+//= 3.7 Corrected NPC names to fall within proper restrictions. [L0ne_W0lf]
+//= 3.8 Corrected some delitems. (bugreport:690) [Samuray22]
+//= 3.9 Fixed a cutin not being erased. (bugreport:1539) [L0ne_W0lf] \ No newline at end of file
diff --git a/npc/quests/lvl4_weapon_quest.txt b/npc/quests/lvl4_weapon_quest.txt
index 58945768a..cfb7e50ac 100644
--- a/npc/quests/lvl4_weapon_quest.txt
+++ b/npc/quests/lvl4_weapon_quest.txt
@@ -1,15 +1,15 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Grade A and Grade S weapon quests
-//===== By: ==================================================
+//===== By: ==================================================
//= Vicious_Pucca, Reddozen & MasterOfMuppets
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.6
-//===== Compatible With: =====================================
-//= rAthena SVN 3422+(Requires jA Script System)
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= [Aegis Conversion]
//= Grade A and Grade S weapon quests
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.0 First Version, Credits goes to Vicious_Pucca for converting [MasterOfMuppets]
//= the quest from aegis format to eA format. Also thanks to
//= reddozen for fixing bugs.
@@ -20,7 +20,7 @@
//= 1.4 Fixed bad NPC header data to comply with rev. 11603. [L0ne_W0lf]
//= 1.5 Rescripted to Aegis 10.3 standards. [L0ne_W0lf]
//= 1.6 Was using the wrong IDs for the ores needed. [L0ne_W0lf]
-//============================================================
+//============================================================
umbala,117,285,3 script Bazo#lv4 85,{
if (checkweight(908,300) == 0) {
diff --git a/npc/quests/quests_13_1.txt b/npc/quests/quests_13_1.txt
index d585fc6ca..78c843ae5 100644
--- a/npc/quests/quests_13_1.txt
+++ b/npc/quests/quests_13_1.txt
@@ -4783,7 +4783,7 @@ mid_camp,240,270,3 script Botanist#ep13 750,{
mid_camp,336,171,1 script Camp Guard#man1 852,{
if (ep13_animal == 0) {
- if (ep13_newbs == 6 || ep13_newbs == 19) goto OnHalt;
+ if (ep13_newbs == 6 || ep13_newbs == 19 || ep13_start == 100) goto OnHalt;
else {
mes "[Camp Guard]";
mes "Stop!";
@@ -4877,7 +4877,7 @@ OnHalt:
mid_camp,13,143,5 script Camp Guard#man2 852,{
if (ep13_animal == 0) {
- if (ep13_newbs == 6 || ep13_newbs == 19) goto OnHalt;
+ if (ep13_newbs == 6 || ep13_newbs == 19 || ep13_start == 100) goto OnHalt;
else {
mes "[Camp Guard]";
mes "Stop!";
@@ -4939,7 +4939,7 @@ OnHalt:
mid_camp,9,215,5 script Camp Guard#man3 852,{
if (ep13_animal == 0) {
- if (ep13_newbs == 6 || ep13_newbs == 19) goto OnHalt;
+ if (ep13_newbs == 6 || ep13_newbs == 19 || ep13_start == 100) goto OnHalt;
else {
mes "[Camp Guard]";
mes "Stop!";
diff --git a/npc/quests/quests_13_2.txt b/npc/quests/quests_13_2.txt
index 1da301ac9..de8f86970 100644
--- a/npc/quests/quests_13_2.txt
+++ b/npc/quests/quests_13_2.txt
@@ -3324,23 +3324,23 @@ mid_camp,192,239,4 script Wanted Sign#ep13_2ect01 857,{
if ((ep13_2_dayegg == 1) && (countitem(6093) < 10)) {
mes "We just got fresh eggs from the dragon nest.";
getitem 6093,1; //Egg_Of_Draco
- disablenpc strnpcinfo(1);
+ disablenpc strnpcinfo(0);
initnpctimer;
close;
}
end;
OnTimer420000:
- enablenpc strnpcinfo(1);
+ enablenpc strnpcinfo(0);
stopnpctimer;
end;
OnEnable:
- enablenpc strnpcinfo(1);
+ enablenpc strnpcinfo(0);
end;
OnDisable:
- disablenpc strnpcinfo(1);
+ disablenpc strnpcinfo(0);
end;
}
@@ -3560,7 +3560,7 @@ OnTimer300000:
// Otherworld language
//============================================================
mid_camp,197,237,3 script Schwartzvalt Mechanic#1 869,{
- if (ep13_1_edq > 2) {
+ if (ep13_1_edq > 2 || ep13_start == 100) {
if (ep13_2_rhea < 1) {
mes "[Mechanic Engineer Dorance]";
mes "Do you know about the Ring of the Ancient Wise King? If you wear that Ring, you can talk to animals.";
diff --git a/npc/quests/seals/god_global.txt b/npc/quests/seals/god_global.txt
index c08ccb6f2..817255060 100644
--- a/npc/quests/seals/god_global.txt
+++ b/npc/quests/seals/god_global.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Variable Management NPC for the god item quest
//===== By: ==================================================
//= MasterOfMuppets
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena
+//= Hercules
//===== Description: =========================================
//= Use this NPC if the seals quest variables get messed up.
//===== Additional Comments: =================================
diff --git a/npc/quests/seals/god_weapon_creation.txt b/npc/quests/seals/god_weapon_creation.txt
index 3f7cb40ea..e0e5845d5 100644
--- a/npc/quests/seals/god_weapon_creation.txt
+++ b/npc/quests/seals/god_weapon_creation.txt
@@ -1,13 +1,13 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= God items creation NPCs
-//===== By: ==================================================
+//===== By: ==================================================
//= SinSloth
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.2
-//===== Compatible With: =====================================
-//= rAthena
-//===== Description: =========================================
-//=
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
+//= NPC that creates God Items
//===== Additional Comments: =================================
//= 1.0 First version. Thanks to SinSloth for scripting it. [MasterOfMuppets]
//= 1.1 Updated several aspects of the script. [L0ne_W0lf]
diff --git a/npc/quests/skills/archer_skills.txt b/npc/quests/skills/archer_skills.txt
index 4b140e7fb..763ffff06 100644
--- a/npc/quests/skills/archer_skills.txt
+++ b/npc/quests/skills/archer_skills.txt
@@ -1,7 +1,7 @@
//===== Hercules Script ======================================
//= Archer Skill Quest
//===== By: ==================================================
-//= rAthena Dev Team
+//= Hercules Dev Team
//===== Current Version: =====================================
//= 1.7
//===== Description: =========================================
diff --git a/npc/quests/skills/knight_skills.txt b/npc/quests/skills/knight_skills.txt
index 07bcfb03d..83574900a 100644
--- a/npc/quests/skills/knight_skills.txt
+++ b/npc/quests/skills/knight_skills.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Knight Skills Quests
//===== By: ==================================================
//= Lupus, Reddozen, Samuray22
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Aegis Conversion]
//= Quests for skills: Charge Attack
diff --git a/npc/quests/skills/novice_skills.txt b/npc/quests/skills/novice_skills.txt
index 92cc797e6..17a670eed 100644
--- a/npc/quests/skills/novice_skills.txt
+++ b/npc/quests/skills/novice_skills.txt
@@ -15,7 +15,7 @@
//============================================================
prt_in,234,133,4 script Nami 66,{
- if ((Class == Job_Novice) && (JobLevel > 3 || BaseLevel > 11) && (skill_nov < 3)) {
+ if ((Class == Job_Novice || Class == Job_Baby) && (JobLevel > 3 || BaseLevel > 11) && (skill_nov < 3)) {
mes "[Nami]";
mes "Hello!";
mes "I want to be a nurse so bad!";
@@ -189,7 +189,7 @@ prt_in,234,133,4 script Nami 66,{
}
prt_in,73,87,4 script Chivalry Member 65,{
- if ((Class == Job_Novice) && (JobLevel > 6) && ((skill_nov >= 3) && (skill_nov <= 5))) {
+ if ((Class == Job_Novice || Class == Job_Baby) && (JobLevel > 6) && ((skill_nov >= 3) && (skill_nov <= 5))) {
mes "[Bulma]";
mes "Yeah. . . I look great. . .";
mes "I am a knight in the knight's";
diff --git a/npc/quests/skills/wizard_skills.txt b/npc/quests/skills/wizard_skills.txt
index 070c024bd..1d7093a03 100644
--- a/npc/quests/skills/wizard_skills.txt
+++ b/npc/quests/skills/wizard_skills.txt
@@ -1,15 +1,15 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Wizard Skills Quests
-//===== By: ==================================================
+//===== By: ==================================================
//= Lupus, Reddozen
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.5
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= [Aegis Conversion]
//= Quests for skills: Sight Blaster
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.4 Rescripted to Aegis 10.3 stadards. [L0ne_W0lf]
//= 1.5 Replaced effect numerics with constants. [L0ne_W0lf]
//============================================================
diff --git a/npc/re/airports/izlude.txt b/npc/re/airports/izlude.txt
index bf5cabdf3..67b9e988d 100644
--- a/npc/re/airports/izlude.txt
+++ b/npc/re/airports/izlude.txt
@@ -1,7 +1,7 @@
//===== Hercules Script ======================================
//= Izlude Airport NPCs
//===== By: ==================================================
-//= rAthena Dev Team
+//= Hercules Dev Team
//===== Description: =========================================
//= Izlude Airport NPCs
//===== Additional Comments: =================================
diff --git a/npc/re/cities/dewata.txt b/npc/re/cities/dewata.txt
index 88b7f6a4e..6bbbfeb4e 100644
--- a/npc/re/cities/dewata.txt
+++ b/npc/re/cities/dewata.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Dewata Town
//===== By: ==================================================
//= Gennosuke Kouga, Muad_Dib
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Dewata Town Script
//===== Additional Comments: =================================
diff --git a/npc/re/cities/dicastes.txt b/npc/re/cities/dicastes.txt
index 6bab75559..5fd555b8f 100644
--- a/npc/re/cities/dicastes.txt
+++ b/npc/re/cities/dicastes.txt
@@ -1,14 +1,14 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= El Dicastes Town
-//===== By: ==================================================
+//===== By: ==================================================
//= Gennosuke Kouga, Muad_Dib
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.2a
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= El Dicastes Town Script
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.0 First version.
//= 1.1 Standardized. [Euphy]
//= 1.2 Updated to match the official script. [Joseph]
diff --git a/npc/re/cities/izlude.txt b/npc/re/cities/izlude.txt
index e5b3d1df0..24390f070 100644
--- a/npc/re/cities/izlude.txt
+++ b/npc/re/cities/izlude.txt
@@ -1,30 +1,33 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Izlude Town Renewal
//===== By: ==================================================
//= Masao
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Izlude town NPCs.
//===== Additional Comments: =================================
//= 1.0 First Version. Still missing many new NPCs and their dialogues. [Masao]
//= 1.1 Added bullet NPC duplicates. [Euphy]
+//= 1.2 Added new NPCs, Captain Carew & coordinates [Streusel]
+//= 1.3 Added some NPC locations [Streusel]
//============================================================
izlude,197,205,1 duplicate(Sailor_izlude) Sailor#izlude 100
izlude,71,92,2 duplicate(Bonne_izlude) Bonne#izlude 90
izlude,172,215,4 duplicate(Charfri_izlude) Charfri#izlude 91
-izlude,127,175,4 duplicate(Cuskoal_izlude) Cuskoal#izlude 124
+izlude,174,164,3 duplicate(Cuskoal_izlude) Cuskoal#izlude 124
izlude,85,103,4 duplicate(Dega_izlude) Dega#izlude 84
-izlude,141,185,4 duplicate(Kylick_izlude) Kylick#izlude 97
+izlude,140,186,4 duplicate(Kylick_izlude) Kylick#izlude 97
izlude,56,156,2 duplicate(Red_izlude) Red#izlude 85
izlude,58,156,2 duplicate(Cebalis_izlude) Cebalis#izlude 98
izlude,165,156,2 duplicate(Soldier_izlude) Soldier#izlude 105
izlude,158,130,3 duplicate(bdt) Bullet Dealer Tony#iz 86
izlude,155,132,3 duplicate(mdk) Magazine Dealer Kenny 83
-
+//izlude,198,213,4 duplicate(Captain_Carew) Captain Carew#izlude 873
+izlude_in,57,92,3 duplicate(Dorian) Dorian#izlude 878
izlude,147,131,6 script Blacksmith#izlude 726,{
end;
}
@@ -34,3 +37,62 @@ prt_fild08,350,219,4 script Guard#izlude 105,{
mes "Welcome to Izlude.";
close;
}
+
+izlude,136,160,0 script Traces of Fish#izlude 111,{
+ mes "There are signs of someone digging.";
+ close;
+}
+
+izlude,207,167,3 script Arena#izlude 858,{
+ mes "";
+ close;
+}
+
+izlude,45,94,3 script Milestone#izlude 858,{
+ mes "==== Information ====";
+ mes "";
+ mes "Access to Prontera Field.";
+ mes "Prontera in the North.";
+ mes "If you wish got to Prontera.";
+ close;
+}
+
+izlude,179,75,3 script Non-Process#izlude 858,{
+ mes "====End of Path====";
+ mes "";
+ mes "Airshop to Rachel";
+ mes "";
+ mes "Feel free to explore, however be reminded that you are a guest.";
+ mes "";
+ close;
+}
+
+izlude,141,251,1 script Full-Grown Red Plant#iz 1078,{
+ end;
+}
+
+izlude,102,150,1 script Sinchon Helper#izlude 71,{
+ end;
+}
+
+izlude,205,155,2 script Nain#izlude 102,{
+ mes "[Nine]";
+ mes "Swords, no matter how strong";
+ mes "they are once they strike you're";
+ mes "a dead man. And though that's creepy,";
+ mes "I just can't throw them away.";
+ close;
+}
+
+izlude,143,205,7 script Magpies Adventurer#iz-01 703,{
+ end;
+}
+
+
+izlude,146,205,7 script Magpies Adventurer#iz-02 706,{
+ end;
+}
+
+izlude,120,254,0 script Siege Monument#izlude 111,{
+ end;
+}
diff --git a/npc/re/cities/malangdo.txt b/npc/re/cities/malangdo.txt
index f6fd3f14d..0ee7ca8be 100644
--- a/npc/re/cities/malangdo.txt
+++ b/npc/re/cities/malangdo.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Malangdo Town
//===== By: ==================================================
//= Muad_Dib
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Malangdo Town Script
//===== Additional Comments: =================================
diff --git a/npc/re/cities/malaya.txt b/npc/re/cities/malaya.txt
new file mode 100644
index 000000000..3daff8526
--- /dev/null
+++ b/npc/re/cities/malaya.txt
@@ -0,0 +1,1520 @@
+//===== Hercules Script =======================================
+//= Port Malaya NPC's
+//===== By: ==================================================
+//= Masao
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
+//= Many Port Malaya NPC's & Quests.
+//===== Additional Comments: =================================
+//= 1.0 First Version.
+//============================================================
+
+malaya,276,55,4 script Optamara Crew#malaya 100,{
+
+ if (malaya_hi < 10) {
+ mes "[Optamara Crew]";
+ mes "I think the village is still busy. Done with your visit? There is always a ship heading for Alberta.";
+ next;
+ }
+ else if ((malaya_hi > 9) && (malaya_hi < 20)) {
+ mes "[Optamara Crew]";
+ mes "I think a nameless adventurer helped take a load off the villagers mind. Yahoo! Would you like to go back to Alberta?";
+ next;
+ }
+ else {
+ mes "[Optamara Crew]";
+ mes "Would you like to go back to Alberta with me?";
+ next;
+ }
+ switch (select("Return.:Do not return.")) {
+ case 1:
+ mes "[Optamara Crew]";
+ mes "Great! Lets leave now for Alberta!!";
+ close2;
+ warp "alberta",239,68;
+ end;
+ case 2:
+ mes "[Optamara Crew]";
+ mes "Thats okay. Come here if you ever want to go back to Alberta.";
+ close;
+ }
+}
+
+alberta,237,71,3 script Optamara Crew#alberta 100,{
+
+ mes "[Optamara Crew]";
+ mes "Hey, there!";
+ mes "Its 10,000 Zeny to go to Port Malaya. Interested?";
+ next;
+ switch (select("About Port Malaya:Go to Port Malaya.:Cancel.")) {
+ case 1:
+ mes "[Optamara Crew]";
+ mes "Port Malaya is a small village you could reach by sailing southwest from Alberta.";
+ next;
+ mes "[Optamara Crew]";
+ mes "I couldnt visit the village because they had some issues there but now it seems all is clear!";
+ next;
+ mes "[Optamara Crew]";
+ mes "I dont know for sure but it was a village that's like a comfortable and cozy park.";
+ next;
+ mes "[Optamara Crew]";
+ mes "I was this close to not coming back to cozy Alberta again.";
+ next;
+ mes "[Optamara Crew]";
+ mes "Im sure youll feel the same once you reach Port Malaya.";
+ close;
+ case 2:
+ if (Zeny > 9999) {
+ set Zeny, Zeny - 10000;
+ mes "[Optamara Crew]";
+ mes "Great!";
+ mes "Heading for Port Malaya!!";
+ close2;
+ warp "Malaya",271,55;
+ end;
+ }
+ mes "[Optamara Crew]";
+ mes "Oh God!!";
+ mes "You dont know how far it is from here. Of course its not free. Please come back with 10,000 Zeny. Sorry!";
+ close;
+ case 3:
+ mes "[Optamara Crew]";
+ mes "Adventurers these days act like they are busy. Come back when you have the time and we could go visit Port Malaya together.";
+ close;
+ }
+}
+
+ma_in01,30,94,4 script Inn Keeper#ma 583,{
+
+ if (malaya_hi < 10) {
+ mes "[Inn Keeper]";
+ mes "Oh my! Visiting?";
+ mes "What bad timing. The village is a bit unorganized at the moment so Im actually closed. Sorry.";
+ close;
+ }
+ else if ((malaya_hi > 9) && (malaya_hi < 20)) {
+ mes "[Inn Keeper]";
+ mes "So you are the adventurer villagers are talking about? I reopened my inn thanks to you. Thank you.";
+ next;
+ }
+ else {
+ mes "[Inn Keeper]";
+ mes "Welcome.";
+ mes "This is Port Malaya's best inn, 'Cabin in the City'.";
+ next;
+ }
+ mes "[Inn Keeper]";
+ mes "Come for a rest? Lodging will be 5,000 Zeny.";
+ next;
+ switch (select("Store.:Lodge. - 5,000z:Cancel.")) {
+ case 1:
+ mes "[Inn Keeper]";
+ mes "Successfully stored. See you next time.";
+ savepoint "ma_in01",43,98;
+ close;
+ case 2:
+ if (Zeny < 5000) {
+ mes "[Inn Keeper]";
+ mes "Sorry. I think you are a bit short.";
+ close;
+ }
+ mes "[Inn Keeper]";
+ mes "Hope you enjoy your stay.";
+ close2;
+ set Zeny, Zeny - 5000;
+ percentheal 100,100;
+ warp "ma_in01",43,98;
+ end;
+ case 3:
+ close;
+ }
+}
+
+ma_fild01,166,214,6 script Old Man in Dilemma#GA 575,{
+
+ if (MaxWeight - Weight < 600 || checkweight(1201,1) == 0) {
+ mes "Cannot proceed because you have too many items in your possession.";
+ close;
+ }
+ mes "[Old Man in Dilemma]";
+ mes "Oh! Demons are gaining more and more power in this world.";
+ next;
+ switch (select("We need to gather items to fight them off.:Ignore.")) {
+ case 1:
+ if ((countitem(6497) > 2) && (Zeny > 999)) {
+ mes "[Old Man in Dilemma]";
+ mes "You dont seem to be strong enough to fight off demons.";
+ next;
+ mes "[Old Man in Dilemma]";
+ mes "Will you create a Greater Agimat of Ancient Spirit with 3 Lesser Agimats and 1,000 Zeny?";
+ next;
+ switch (select("Create.:No, thank you.")) {
+ case 1:
+ if ((countitem(6497) > 2) && (Zeny > 999)) {
+ specialeffect2 EF_CONE;
+ specialeffect EF_FORESTLIGHT2;
+ set Zeny, Zeny - 1000;
+ getitem 12775,1; //Ancient_Spirit_Amulet
+ mes "[Old Man in Dilemma]";
+ mes "Hope you win the fight with the demon.";
+ close;
+ }
+ mes "[Old Man in Dilemma]";
+ mes "Short on materials.";
+ close;
+ case 2:
+ mes "[Old Man in Dilemma]";
+ mes "Hope you win the fight with the demon.";
+ close;
+ }
+ }
+ mes "[Old Man in Dilemma]";
+ mes "Cant make it now but there is an old way of making it handed down by generations.";
+ next;
+ mes "[Old Man in Dilemma]";
+ mes "You need to call upon the power of Ancient Spirits. But youll need several important materials first.";
+ next;
+ select("What are they?");
+ mes "[Old Man in Dilemma]";
+ mes "3 Lesser Agimats to hold the power of Ancient Spirits here and another special material handed down for generations.";
+ next;
+ mes "[Old Man in Dilemma]";
+ mes "But nobody can get this special item anymore.";
+ next;
+ select("Something money cannot buy?");
+ mes "[Old Man in Dilemma]";
+ mes "No, no... It's this round little thing, you see?";
+ next;
+ select("Are you talking about Zeny?");
+ mes "[Old Man in Dilemma]";
+ mes "Looks similar to the special items handed down from generations.";
+ next;
+ mes "[Old Man in Dilemma]";
+ mes "As long as we have enough of that, we could make the Greater Agimat of Ancient Spirit to fight against the demons.";
+ next;
+ select("Sounds good.");
+ mes "[Old Man in Dilemma]";
+ mes "In case you are too weary to take on the demons";
+ next;
+ mes "[Old Man in Dilemma]";
+ mes "come by with 3 Lesser Agimats and 1,000 of those so called Zeny.";
+ next;
+ mes "[Old Man in Dilemma]";
+ mes "I will make a Greater Agimat of Ancient Spirit that will increase your attacks against demons by 10% for 20 min.";
+ close;
+ case 2:
+ mes "[Old Man in Dilemma]";
+ mes "Hope you win the fight with the demon.";
+ close;
+ }
+}
+
+ma_fild01,238,198,4 script Tikbalang Expert#malaya 582,{
+
+ if (MaxWeight - Weight < 50 || checkweight(1201,1) == 0) {
+ mes "Cannot proceed because you have too many items in your possession.";
+ close;
+ }
+ mes "[Tikbalang Expert]";
+ mes "Ive spent 90% of my life studying Tikbalang.";
+ next;
+ switch (select("But you look young?:What is Tikbalang?:Teach me how to catch a Tikbalang.")) {
+ case 1:
+ mes "[Tikbalang Expert]";
+ mes "What! I might be imagining things.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "I look younger than I am because of my baby face. Ha ha ha";
+ next;
+ select("... ... ...");
+ mes "[Tikbalang Expert]";
+ mes "Trust!! They say faith will bring you luck.";
+ close;
+ case 2:
+ mes "[Tikbalang Expert]";
+ mes "Ha ha... You ask the right question.";
+ mes "Im a specialist in that field. Ask me anything.";
+ next;
+ select("Why wont you answer me?");
+ mes "[Tikbalang Expert]";
+ mes "Have you... ever been fooled by anyone around you? Why cant you believe someones word for it? Really, ask me anything.";
+ next;
+ while (.@loop != 1) {
+ switch (select("I don't have any questions.:Characteristics?:Features?:Rumors?:Habitat?")) {
+ case 1:
+ set .@loop,1;
+ break;
+ case 2:
+ mes "[Tikbalang Expert]";
+ mes "Tikbalangs have a way to confuse travelers when they meet them by making them turn in circles regardless of wherever and how far they travel.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "They are mischievous creatures.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "But of course there is a way to stop their pranks. You know about the Inside-out Shirt? You can either wear your top inside-out.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Or go on your way quietly without disrupting the Tikbalangs.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Ha ha ha ha But everyone knows adventurers are never quiet while they travel, right?";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Never...";
+ set .@loop,2;
+ next;
+ break;
+ case 3:
+ mes "[Tikbalang Expert]";
+ mes "They say Tikbalangs have several distinctions.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "First, they are very tall ^AAAAAA(tsk.. wish I were tall)^000000 and have skinny, imbalanced legs and arms. Looks almost like a human but their knees are higher than their upper body when they sit down,";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Second, is the standard characteristics acknowledged by the association. They have heads and foot like a horse.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "So with all these appearance treats, Tikbalang is sometimes called the creature from hell.";
+ set .@loop,3;
+ next;
+ break;
+ case 4:
+ mes "[Tikbalang Expert]";
+ mes "There are several fun rumors about Tikbalangs.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "One of them is about Tikbalangs being the guardians of some kingdom that worships nature.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "So the Tikbalangs will trick travelers who come with bad intentions to the kingdom by making them travel in circles.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Another rumor is that people around here say that 'if it rains on a clear day, then it must be Tikbalang's wedding day'.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "The association speculates that sayings like 'it rains on Bathorys wedding day' or 'it rains on Moonlight Flowers wedding day' might have derived from the Tikbalangs saying.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Lastly, ancient fairy tales say that Tikbalangs can transform into human form or even make themselves transparent but nobody has verified this yet.";
+ set .@loop,4;
+ next;
+ break;
+ case 5:
+ mes "[Tikbalang Expert]";
+ mes "Tikbalangs usually live in dark, busy places where there arent many people around.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Hmm... For example, they are known to live beneath bridges, in banana and bamboo forests and beneath large trees.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "And this is just my opinion but wouldnt you agree that they are living in dark places because it is easier to play pranks on people?";
+ set .@loop,5;
+ next;
+ break;
+ }
+ }
+ mes "[Tikbalang Expert]";
+ mes "I think this is enough explanation for now. You wouldnt understand other highly sophisticated topics with specific terminology and all anyway.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Oh! Do you have any other questions?";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "What do you think? Impressed at how much I know? Come by anytime when you have any more questions.";
+ close;
+ case 3:
+ mes "[Tikbalang Expert]";
+ mes "Ha ha ha. Do you now know how great I am?";
+ next;
+ if ((countitem(6496) > 2) && (countitem(6497) > 4)) {
+ mes "[Tikbalang Expert]";
+ mes "Oh! Isnt this material to make 'Tikbalang Belt' used to tame Tikbalangs?";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "The '^F80835Tikbalang Belt ^000000' is used to capture Tikbalangs without the hassle. But that doesnt mean its 100% successful. Interested? Do you want me to make one for you?";
+ next;
+ switch (select("Yes, Im interested.:No, I can capture one myself.")) {
+ case 1:
+ delitem 6496,3; //Tikbalang_Thick_Spine
+ getitem 12699,1; //Tikbalang_Belt
+ mes "[Tikbalang Expert]";
+ mes "Yiiiiiiiiiiii! Yap!";
+ next;
+ specialeffect EF_SONICBLOW2;
+ select("Huh?");
+ mes "[Tikbalang Expert]";
+ mes "The '^F80835Tikbalang Belt ^000000' is already created";
+ close;
+ case 2:
+ mes "[Tikbalang Expert]";
+ mes "You? Ha... You can try if you want to.";
+ close;
+ }
+ }
+ mes "[Tikbalang Expert]";
+ mes "There is the easy way and the hard way to capture Tikbalangs. Which one do you prefer?";
+ next;
+ switch (select("Easy way.:Hard way.")) {
+ case 1:
+ mes "[Tikbalang Expert]";
+ mes "Ha ha. Ive come up with the easy way myself.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Bring me 3 Tikbalang's Thick Spines and 5 Lesser Agimats to make";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "a '^F80835Tikbalang Belt^000000' to help you easily capture Tikbalangs.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Ha ha ha ha ha!";
+ mes "I will say it again.";
+ mes "Its 3 Tikbalang's Thick Spines and 5 Lesser Agimats. Understood?";
+ close;
+ case 2:
+ mes "[Tikbalang Expert]";
+ mes "Its easy for me but I dont know about you.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Tikbalangs have a sharp, pointy mane behind their neck.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Of course! There are several of them but you must get the three thickest ones.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "These three manes are the weak point. You can tame a Tikbalang by pulling the manes out.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Now let me explain how to pull these manes out.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "You must fly like a butterfly and land like a bee on the back of a Tikbalang.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Of course! The Tikbalang will get mad and try to shake you off with all its might.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "All you have to do is hold on until the Tikbalang gets exhausted.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Then again, itll take 4 days and 3 nights for Tikbalangs to get tired since they are strong creatures. But lets not focus on too much details.";
+ next;
+ mes "[Tikbalang Expert]";
+ mes "Which means!! The Tikbalang is already tamed.";
+ close;
+ }
+ }
+}
+
+ma_fild01,74,367,6 script Unidentified Creature#01 572,2,2,{
+ end;
+
+OnInit:
+ set .@kafre_who, rand(1,4);
+ if (.@kafre_who == 1) {
+ donpcevent "Unidentified Creature#02::OnDisable";
+ donpcevent "Unidentified Creature#04::OnDisable";
+ } else if (.@kafre_who == 2) {
+ donpcevent "Unidentified Creature#01::OnDisable";
+ donpcevent "Unidentified Creature#02::OnEnable";
+ donpcevent "Unidentified Creature#04::OnDisable";
+ } else if (.@kafre_who == 3) {
+ donpcevent "Unidentified Creature#02::OnDisable";
+ donpcevent "Unidentified Creature#03::OnEnable";
+ donpcevent "Unidentified Creature#04::OnDisable";
+ } else {
+ donpcevent "Unidentified Creature#01::OnDisable";
+ donpcevent "Unidentified Creature#02::OnDisable";
+ donpcevent "Unidentified Creature#04::OnEnable";
+ }
+ end;
+
+OnEnable:
+ hideoffnpc "Unidentified Creature#01";
+ end;
+
+OnDisable:
+ hideonnpc "Unidentified Creature#01";
+ end;
+
+OnBingx2:
+ set .@kafre_who, rand(1,3);
+ if (.@kafre_who == 2) {
+ donpcevent "Unidentified Creature#01::OnDisable";
+ donpcevent "Unidentified Creature#02::OnEnable";
+ donpcevent "Unidentified Creature#04::OnDisable";
+ } else if (.@kafre_who == 3) {
+ donpcevent "Unidentified Creature#01::OnDisable";
+ donpcevent "Unidentified Creature#02::OnDisable";
+ donpcevent "Unidentified Creature#03::OnEnable";
+ donpcevent "Unidentified Creature#04::OnDisable";
+ } else {
+ donpcevent "Unidentified Creature#01::OnDisable";
+ donpcevent "Unidentified Creature#02::OnDisable";
+ donpcevent "Unidentified Creature#04::OnEnable";
+ }
+ end;
+
+OnTouch:
+ if (getcharid(1) != 0) {
+ if ($ma_name04$ == strcharinfo(0) || $ma_name05$ == strcharinfo(0) || $ma_name06$ == strcharinfo(0)) {
+ donpcevent "Unidentified Creature#01::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you, blushes and then disappears.";
+ close;
+ }
+ set .@slot_name, rand(1,5);
+ if (.@slot_name == 1 || .@slot_name == 3 || .@slot_name == 5) {
+ set $ma_name04$,strcharinfo(0);
+ }
+ donpcevent "Unidentified Creature#01::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you and disappears.";
+ close;
+ }
+ donpcevent "Unidentified Creature#01::OnBingx2";
+ mes "The unidentified creature looks at you and runs away.";
+ close;
+}
+
+ma_fild01,109,116,4 script Unidentified Creature#02 572,2,2,{
+ end;
+
+OnEnable:
+ hideoffnpc "Unidentified Creature#02";
+ end;
+
+OnDisable:
+ hideonnpc "Unidentified Creature#02";
+ end;
+
+OnBingx2:
+ set .@kafre_who, rand(1,3);
+ if (.@kafre_who == 1) {
+ donpcevent "Unidentified Creature#04::OnDisable";
+ } else if (.@kafre_who == 3) {
+ donpcevent "Unidentified Creature#01::OnDisable";
+ donpcevent "Unidentified Creature#02::OnDisable";
+ donpcevent "Unidentified Creature#03::OnEnable";
+ donpcevent "Unidentified Creature#04::OnDisable";
+ }
+ else {
+ donpcevent "Unidentified Creature#01::OnDisable";
+ donpcevent "Unidentified Creature#02::OnDisable";
+ donpcevent "Unidentified Creature#04::OnEnable";
+ }
+ end;
+
+OnTouch:
+ if (getpartyleader(getcharid(1),1) == getcharid(3)) {
+ if ($ma_name04$ == strcharinfo(0) || $ma_name05$ == strcharinfo(0) || $ma_name06$ == strcharinfo(0)) {
+ donpcevent "Unidentified Creature#02::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you, blushes and then disappears.";
+ close;
+ }
+ set .@slot_name, rand(1,5);
+ if (.@slot_name == 1 || .@slot_name == 3 || .@slot_name == 5) {
+ set $ma_name04$,strcharinfo(0);
+ }
+ donpcevent "Unidentified Creature#02::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you and disappears.";
+ close;
+ }
+ donpcevent "Unidentified Creature#02::OnBingx2";
+ mes "The unidentified creature looks at you and runs away.";
+ close;
+}
+
+ma_fild01,280,150,6 script Unidentified Creature#03 572,2,2,{
+ end;
+
+OnEnable:
+ hideoffnpc "Unidentified Creature#03";
+ end;
+
+OnDisable:
+ hideonnpc "Unidentified Creature#03";
+ end;
+
+OnBingx2:
+ set .@kafre_who, rand(1,3);
+ if (.@kafre_who == 1) {
+ donpcevent "Unidentified Creature#02::OnDisable";
+ donpcevent "Unidentified Creature#04::OnDisable";
+ } else if (.@kafre_who == 2) {
+ donpcevent "Unidentified Creature#01::OnDisable";
+ donpcevent "Unidentified Creature#02::OnEnable";
+ donpcevent "Unidentified Creature#04::OnDisable";
+ } else {
+ donpcevent "Unidentified Creature#01::OnDisable";
+ donpcevent "Unidentified Creature#02::OnDisable";
+ donpcevent "Unidentified Creature#04::OnEnable";
+ }
+ end;
+
+OnTouch:
+ if ((checkquest(4229,PLAYTIME) > 0) && (checkquest(9223,PLAYTIME) > 0) && (checkquest(12278,PLAYTIME) > 0)) {
+ if ($ma_name04$ == strcharinfo(0) || $ma_name05$ == strcharinfo(0) || $ma_name06$ == strcharinfo(0)) {
+ donpcevent "Unidentified Creature#03::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you, blushes and then disappears.";
+ close;
+ }
+ set .@slot_name, rand(1,5);
+ if (.@slot_name == 1 || .@slot_name == 3 || .@slot_name == 5) {
+ set $ma_name04$,strcharinfo(0);
+ }
+ donpcevent "Unidentified Creature#03::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you and disappears.";
+ close;
+ }
+ donpcevent "Unidentified Creature#03::OnBingx2";
+ mes "The unidentified creature looks at you and runs away.";
+ close;
+}
+
+ma_fild01,309,221,6 script Unidentified Creature#04 572,2,2,{
+ end;
+
+OnEnable:
+ hideoffnpc "Unidentified Creature#04";
+ end;
+
+OnDisable:
+ hideonnpc "Unidentified Creature#04";
+ end;
+
+OnBingx2:
+ set .@kafre_who, rand(1,3);
+ if (.@kafre_who == 1) {
+ donpcevent "Unidentified Creature#02::OnDisable";
+ donpcevent "Unidentified Creature#04::OnDisable";
+ } else if (.@kafre_who == 2) {
+ donpcevent "Unidentified Creature#01::OnDisable";
+ donpcevent "Unidentified Creature#02::OnEnable";
+ donpcevent "Unidentified Creature#04::OnDisable";
+ } else {
+ donpcevent "Unidentified Creature#01::OnDisable";
+ donpcevent "Unidentified Creature#02::OnDisable";
+ donpcevent "Unidentified Creature#03::OnEnable";
+ donpcevent "Unidentified Creature#04::OnDisable";
+ }
+ end;
+
+OnTouch:
+ set .@kafre_tok, rand(1,100);
+ if (.@kafre_tok == 7 || .@kafre_tok == 17 || .@kafre_tok == 27 || .@kafre_tok == 37 || .@kafre_tok == 47 || .@kafre_tok == 57 || .@kafre_tok == 67 || .@kafre_tok == 77 || .@kafre_tok == 87 || .@kafre_tok == 97) {
+ if ($ma_name04$ == strcharinfo(0) || $ma_name05$ == strcharinfo(0) || $ma_name06$ == strcharinfo(0)) {
+ donpcevent "Unidentified Creature#04::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you, blushes and then disappears.";
+ close;
+ }
+ set .@slot_name, rand(1,5);
+ if (.@slot_name == 1 || .@slot_name == 3 || .@slot_name == 5) {
+ set $ma_name04$,strcharinfo(0);
+ }
+ donpcevent "Unidentified Creature#04::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you and disappears.";
+ close;
+ }
+ donpcevent "Unidentified Creature#04::OnBingx2";
+ mes "The unidentified creature looks at you and runs away.";
+ close;
+}
+
+ma_fild02,282,41,4 script Unidentified Creature#05 572,2,2,{
+ end;
+
+OnInit:
+ set .@kafre_who, rand(1,4);
+ if (.@kafre_who == 1) {
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ } else if (.@kafre_who == 2) {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnEnable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ } else if (.@kafre_who == 3) {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnEnable";
+ } else {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ donpcevent "Unidentified Creature#08::OnEnable";
+ }
+ end;
+
+OnEnable:
+ hideoffnpc "Unidentified Creature#05";
+ end;
+
+OnDisable:
+ hideonnpc "Unidentified Creature#05";
+ end;
+
+OnBingx2:
+ set .@kafre_who, rand(1,3);
+ if (.@kafre_who == 2) {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnEnable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ } else if (.@kafre_who == 3) {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnEnable";
+ } else {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ donpcevent "Unidentified Creature#08::OnEnable";
+ }
+ end;
+
+OnTouch:
+ if (getcharid(1) != 0) {
+ if ($ma_name04$ == strcharinfo(0) || $ma_name05$ == strcharinfo(0) || $ma_name06$ == strcharinfo(0)) {
+ donpcevent "Unidentified Creature#05::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you, blushes and then disappears.";
+ close;
+ }
+ set .@slot_name, rand(1,5);
+ if (.@slot_name == 1 || .@slot_name == 3 || .@slot_name == 5) {
+ set $ma_name05$,strcharinfo(0);
+ }
+ donpcevent "Unidentified Creature#05::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you and disappears.";
+ close;
+ }
+ donpcevent "Unidentified Creature#05::OnBingx2";
+ mes "The unidentified creature looks at you and runs away.";
+ close;
+}
+
+ma_fild02,246,324,4 script Unidentified Creature#06 572,2,2,{
+ end;
+
+OnEnable:
+ hideoffnpc "Unidentified Creature#06";
+ end;
+
+OnDisable:
+ hideonnpc "Unidentified Creature#06";
+ end;
+
+OnBingx2:
+ set .@kafre_who, rand(1,3);
+ if (.@kafre_who == 1) {
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ } else if (.@kafre_who == 3) {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnEnable";
+ } else {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ donpcevent "Unidentified Creature#08::OnEnable";
+ }
+ end;
+
+OnTouch:
+ if (getpartyleader(getcharid(1),1) == getcharid(3)) {
+ if ($ma_name04$ == strcharinfo(0) || $ma_name05$ == strcharinfo(0) || $ma_name06$ == strcharinfo(0)) {
+ donpcevent "Unidentified Creature#06::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you, blushes and then disappears.";
+ close;
+ }
+ set .@slot_name, rand(1,5);
+ if (.@slot_name == 1 || .@slot_name == 3 || .@slot_name == 5) {
+ set $ma_name05$,strcharinfo(0);
+ }
+ donpcevent "Unidentified Creature#06::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you and disappears.";
+ close;
+ }
+ donpcevent "Unidentified Creature#06::OnBingx2";
+ mes "The unidentified creature looks at you and runs away.";
+ close;
+}
+
+ma_fild02,71,296,6 script Unidentified Creature#07 572,2,2,{
+ end;
+
+OnEnable:
+ hideoffnpc "Unidentified Creature#07";
+ end;
+
+OnDisable:
+ hideonnpc "Unidentified Creature#07";
+ end;
+
+OnBingx2:
+ set .@kafre_who, rand(1,3);
+ if (.@kafre_who == 1) {
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ donpcevent "Unidentified Creature#08::OnDisable";
+ } else if (.@kafre_who == 2) {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnEnable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ } else {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ donpcevent "Unidentified Creature#08::OnEnable";
+ }
+ end;
+
+OnTouch:
+ if ((checkquest(4229,PLAYTIME) > 0) && (checkquest(9223,PLAYTIME) > 0) && (checkquest(12278,PLAYTIME) > 0)) {
+ if ($ma_name04$ == strcharinfo(0) || $ma_name05$ == strcharinfo(0) || $ma_name06$ == strcharinfo(0)) {
+ donpcevent "Unidentified Creature#07::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you, blushes and then disappears.";
+ close;
+ }
+ set .@slot_name, rand(1,5);
+ if (.@slot_name == 1 || .@slot_name == 3 || .@slot_name == 5) {
+ set $ma_name05$,strcharinfo(0);
+ }
+ donpcevent "Unidentified Creature#07::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you and disappears.";
+ close;
+ }
+ donpcevent "Unidentified Creature#07::OnBingx2";
+ mes "The unidentified creature looks at you and runs away.";
+ close;
+}
+
+ma_fild02,32,263,4 script Unidentified Creature#08 572,2,2,{
+ end;
+
+OnEnable:
+ hideoffnpc "Unidentified Creature#08";
+ end;
+
+OnDisable:
+ hideonnpc "Unidentified Creature#08";
+ end;
+
+OnBingx2:
+ set .@kafre_who, rand(1,3);
+ if (.@kafre_who == 1) {
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ } else if (.@kafre_who == 2) {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnEnable";
+ donpcevent "Unidentified Creature#07::OnDisable";
+ } else {
+ donpcevent "Unidentified Creature#05::OnDisable";
+ donpcevent "Unidentified Creature#06::OnDisable";
+ donpcevent "Unidentified Creature#07::OnEnable";
+ }
+ end;
+
+OnTouch:
+ set .@kafre_tok, rand(1,100);
+ if (.@kafre_tok == 7 || .@kafre_tok == 17 || .@kafre_tok == 27 || .@kafre_tok == 37 || .@kafre_tok == 47 || .@kafre_tok == 57 || .@kafre_tok == 67 || .@kafre_tok == 77 || .@kafre_tok == 87 || .@kafre_tok == 97) {
+ if ($ma_name04$ == strcharinfo(0) || $ma_name05$ == strcharinfo(0) || $ma_name06$ == strcharinfo(0)) {
+ donpcevent "Unidentified Creature#08::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you, blushes and then disappears.";
+ close;
+ }
+ set .@slot_name, rand(1,5);
+ if (.@slot_name == 1 || .@slot_name == 3 || .@slot_name == 5) {
+ set $ma_name05$,strcharinfo(0);
+ }
+ donpcevent "Unidentified Creature#08::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you and disappears.";
+ close;
+ }
+ donpcevent "Unidentified Creature#08::OnBingx2";
+ mes "The unidentified creature looks at you and runs away.";
+ close;
+}
+
+ma_scene01,195,92,4 script Unidentified Creature#09 572,2,2,{
+ end;
+
+OnInit:
+ set .@kafre_who, rand(1,3);
+ if (.@kafre_who == 1) {
+ donpcevent "Unidentified Creature#09::OnEnable";
+ donpcevent "Unidentified Creature#10::OnDisable";
+ donpcevent "Unidentified Creature#11::OnDisable";
+ } else if (.@kafre_who == 2) {
+ donpcevent "Unidentified Creature#09::OnDisable";
+ donpcevent "Unidentified Creature#10::OnEnable";
+ donpcevent "Unidentified Creature#11::OnDisable";
+ } else {
+ donpcevent "Unidentified Creature#09::OnDisable";
+ donpcevent "Unidentified Creature#10::OnDisable";
+ donpcevent "Unidentified Creature#11::OnEnable";
+ }
+ end;
+
+OnEnable:
+ hideoffnpc "Unidentified Creature#09";
+ end;
+
+OnDisable:
+ hideonnpc "Unidentified Creature#09";
+ end;
+
+OnBingx2:
+ set .@kafre_who, rand(1,2);
+ if (.@kafre_who == 2) {
+ donpcevent "Unidentified Creature#09::OnDisable";
+ donpcevent "Unidentified Creature#10::OnEnable";
+ donpcevent "Unidentified Creature#11::OnDisable";
+ } else {
+ donpcevent "Unidentified Creature#09::OnDisable";
+ donpcevent "Unidentified Creature#10::OnDisable";
+ donpcevent "Unidentified Creature#11::OnEnable";
+ }
+ end;
+
+OnTouch:
+ if (getcharid(1) != 0) {
+ if ($ma_name04$ == strcharinfo(0) || $ma_name05$ == strcharinfo(0) || $ma_name06$ == strcharinfo(0)) {
+ donpcevent "Unidentified Creature#09::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you, blushes and then disappears.";
+ close;
+ }
+ set .@slot_name, rand(1,5);
+ if (.@slot_name == 1 || .@slot_name == 3 || .@slot_name == 5) {
+ set $ma_name06$,strcharinfo(0);
+ }
+ donpcevent "Unidentified Creature#09::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you and disappears.";
+ close;
+ }
+ donpcevent "Unidentified Creature#09::OnBingx2";
+ mes "The unidentified creature looks at you and runs away.";
+ close;
+}
+
+ma_scene01,158,139,4 script Unidentified Creature#10 572,2,2,{
+ end;
+
+OnEnable:
+ hideoffnpc "Unidentified Creature#10";
+ end;
+
+OnDisable:
+ hideonnpc "Unidentified Creature#10";
+ end;
+
+OnBingx2:
+ set .@kafre_who, rand(1,2);
+ if (.@kafre_who == 1) {
+ donpcevent "Unidentified Creature#09::OnEnable";
+ donpcevent "Unidentified Creature#10::OnDisable";
+ donpcevent "Unidentified Creature#11::OnDisable";
+ } else {
+ donpcevent "Unidentified Creature#09::OnDisable";
+ donpcevent "Unidentified Creature#10::OnDisable";
+ donpcevent "Unidentified Creature#11::OnEnable";
+ }
+ end;
+
+OnTouch:
+ if (getpartyleader(getcharid(1),1) == getcharid(3)) {
+ if ($ma_name04$ == strcharinfo(0) || $ma_name05$ == strcharinfo(0) || $ma_name06$ == strcharinfo(0)) {
+ donpcevent "Unidentified Creature#10::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you, blushes and then disappears.";
+ close;
+ }
+ set .@slot_name, rand(1,5);
+ if (.@slot_name == 1 || .@slot_name == 3 || .@slot_name == 5) {
+ set $ma_name06$,strcharinfo(0);
+ }
+ donpcevent "Unidentified Creature#10::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you and disappears.";
+ close;
+ }
+ donpcevent "Unidentified Creature#10::OnBingx2";
+ mes "The unidentified creature looks at you and runs away.";
+ close;
+}
+
+ma_scene01,167,112,6 script Unidentified Creature#11 572,2,2,{
+ end;
+
+OnEnable:
+ hideoffnpc "Unidentified Creature#11";
+ end;
+
+OnDisable:
+ hideonnpc "Unidentified Creature#11";
+ end;
+
+OnBingx2:
+ set .@kafre_who, rand(1,2);
+ if (.@kafre_who == 1) {
+ donpcevent "Unidentified Creature#09::OnEnable";
+ donpcevent "Unidentified Creature#10::OnDisable";
+ } else {
+ donpcevent "Unidentified Creature#10::OnEnable";
+ }
+ end;
+
+OnTouch:
+ if ((checkquest(4229,PLAYTIME) > 0) && (checkquest(9223,PLAYTIME) > 0) && (checkquest(12278,PLAYTIME) > 0)) {
+ if ($ma_name04$ == strcharinfo(0) || $ma_name05$ == strcharinfo(0) || $ma_name06$ == strcharinfo(0)) {
+ donpcevent "Unidentified Creature#11::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you, blushes and then disappears.";
+ close;
+ }
+ set .@slot_name, rand(1,5);
+ if (.@slot_name == 1 || .@slot_name == 3 || .@slot_name == 5) {
+ set $ma_name06$,strcharinfo(0);
+ }
+ donpcevent "Unidentified Creature#11::OnBingx2";
+ mes "The unidentified creature gets a glimpse of you and disappears.";
+ close;
+ }
+ donpcevent "Unidentified Creature#11::OnBingx2";
+ mes "The unidentified creature looks at you and runs away.";
+ close;
+}
+
+malaya,227,311,4 script Grandma#ma01 575,{
+
+ if (malaya_hi < 10) {
+ mes "[Grandma]";
+ mes "Youre not from around here? Take care of yourself.";
+ next;
+ mes "[Grandma]";
+ mes "Im worried because my daughter-in-law is pregnant. I hope nothing goes wrong.";
+ close;
+ } else if ((malaya_hi > 9) && (malaya_hi < 20)) {
+ mes "[Grandma]";
+ mes "I heard there is an outsider that is helping the village.";
+ next;
+ mes "[Grandma]";
+ mes "Then my daughter-in-law will be safe.";
+ close;
+ }
+ set .@name_tak01, rand(1,6);
+ if (.@name_tak01 == 1){
+ set .@name$,$ma_name01$;
+ }else if (.@name_tak01 == 2){
+ set .@name$,$ma_name02$;
+ }else if (.@name_tak01 == 3){
+ set .@name$,$ma_name03$;
+ }else if (.@name_tak01 == 4){
+ set .@name$,$ma_name04$;
+ }else if (.@name_tak01 == 5){
+ set .@name$,$ma_name05$;
+ }else{
+ set .@name$,$ma_name06$;
+ }
+ set .@name_tak02, rand(1,3);
+ if (.@name_tak02 == 2) {
+ mes "[Grandma]";
+ mes "Heard there is this" + .@name$ + "that follows Meoneonuncle around.";
+ next;
+ mes "[Grandma]";
+ mes "I will cheer for their forbidden love.";
+ close;
+ }
+ mes "[Grandma]";
+ mes "Im worried about my pregnant daughter-in-law. Hope Meoneonuncle wont bother her.";
+ next;
+ select("Meoneonuncle?");
+ mes "[Grandma]";
+ mes "Not from around here? Let me tell you why even a foreigner like you should be careful.";
+ next;
+ mes "[Grandma]";
+ mes "Meoneonuncle was a woman who lived in Port Malaya long ago. She married a decent man and also had a baby.";
+ next;
+ mes "[Grandma]";
+ mes "But happiness never lasts forever, right? The baby was miscarried from an accident,";
+ next;
+ mes "[Grandma]";
+ mes "She eventually passed away after grieving over her lost baby for days.";
+ next;
+ select("That is a sad story.");
+ mes "[Grandma]";
+ mes "Meoneonuncle then started to appear in spirit and take away babies from pregnant women in the village.";
+ next;
+ mes "[Grandma]";
+ mes "If you ever walk around Port Malaya at night.";
+ next;
+ mes "[Grandma]";
+ mes "and hear either tik-tik or wak-wak, be cautious because that is the sound of Meoneonuncles wings flapping.";
+ close;
+}
+
+malaya,189,263,4 script Drumming Young Man #ma02 578,{
+
+ if (malaya_hi < 10) {
+ emotion e_omg;
+ mes "[Drumming Young Man]";
+ mes "Ugh... its just like that time before";
+ next;
+ emotion e_omg;
+ mes "[Drumming Young Man]";
+ mes "when the moon was swallowed. Argh!";
+ close;
+ } else if ((malaya_hi > 9) && (malaya_hi < 20)) {
+ mes "[Drumming Young Man]";
+ mes "I think the village was saved by a nameless adventurer.";
+ next;
+ emotion e_sigh;
+ mes "[Drumming Young Man]";
+ mes "Phew... I thought Bakonawa appeared again.";
+ close;
+ }
+ set .@name_tak01, rand(1,6);
+ if (.@name_tak01 == 1){
+ set .@name$,$ma_name01$;
+ }else if (.@name_tak01 == 2){
+ set .@name$,$ma_name02$;
+ }else if (.@name_tak01 == 3){
+ set .@name$,$ma_name03$;
+ }else if (.@name_tak01 == 4){
+ set .@name$,$ma_name04$;
+ }else if (.@name_tak01 == 5){
+ set .@name$,$ma_name05$;
+ }else{
+ set .@name$,$ma_name06$;
+ }
+ set .@name_tak02, rand(1,3);
+ if (.@name_tak02 == 2) {
+ mes "[Drumming Young Man]";
+ mes "" + .@name$ + "is said to have stopped Bakonawa from swallowing the moon. Isnt it awesome? I'm so relieved.";
+ close;
+ }
+ mes "[Drumming Young Man]";
+ mes "Bakonawa is also known as the 'monster that swallows the moon' in Port Malaya.";
+ next;
+ mes "[Drumming Young Man]";
+ mes "But I know that Bakonawa could also 'swallow people', too.";
+ next;
+ select("Huk! Then isn't it dangerous?");
+ emotion e_gg;
+ mes "[Drumming Young Man]";
+ mes "Ha ha ha. There is a way to stop Bakonawa from swallowing a person.";
+ next;
+ mes "[Drumming Young Man]";
+ mes "Yes, there is a weakness to even the worst monster that swallowed 6 moons already.";
+ next;
+ select("Wow. What is it?");
+ mes "[Drumming Young Man]";
+ mes "He is sensitive to noise so when hes about to swallow the moon!!";
+ next;
+ mes "[Drumming Young Man]";
+ mes "Thats your chance!! It doesnt matter what kind of noise!! Whether its a caldron, symbol, drum, pot or fry pan, just keep on making noise.";
+ next;
+ mes "[Drumming Young Man]";
+ mes "Then Bakonawa will get surprised, spit out the moon and run away!";
+ next;
+ mes "[Drumming Young Man]";
+ mes "Carry a drum around with you. Youll find it handy.";
+ close;
+}
+
+malaya,270,59,4 script Port Guard#ma03 570,{
+
+ if (malaya_hi < 10) {
+ emotion e_swt2;
+ mes "[Port Guard]";
+ mes "The village is chaotic these days. Is it okay for me to be off like this?";
+ close;
+ } else if ((malaya_hi > 9) && (malaya_hi < 20)) {
+ emotion e_no;
+ mes "[Port Guard]";
+ mes "The village is somewhat stable now but you should still be careful walking around at night.";
+ close;
+ }
+ set .@name_tak01, rand(1,6);
+ if (.@name_tak01 == 1){
+ set .@name$,$ma_name01$;
+ }else if (.@name_tak01 == 2){
+ set .@name$,$ma_name02$;
+ }else if (.@name_tak01 == 3){
+ set .@name$,$ma_name03$;
+ }else if (.@name_tak01 == 4){
+ set .@name$,$ma_name04$;
+ }else if (.@name_tak01 == 5){
+ set .@name$,$ma_name05$;
+ }else{
+ set .@name$,$ma_name06$;
+ }
+ set .@name_tak02, rand(1,3);
+ if (.@name_tak02 == 2) {
+ mes "[Port Guard]";
+ mes "" + .@name$ + "is said to escape from Bu waya alive after being captured. This person must be powerful.";
+ close;
+ }
+ emotion e_omg;
+ mes "[Port Guard]";
+ mes "What!! Port all clear!!";
+ next;
+ mes "[Port Guard]";
+ mes "Huh? Youre not the captain? You scared me. Shoot! Ah, right! I received an official document for travelers.";
+ next;
+ select("What document?");
+ mes "[Port Guard]";
+ mes "It says that travelers should be careful of monsters when walking in the village at night.";
+ next;
+ mes "[Port Guard]";
+ mes "Buwaya dont come to the village often but there are cases when they snatch people in the boxes they carry at night.";
+ next;
+ mes "[Port Guard]";
+ mes "Huh?! And it says here that a monster named Wokwok especially visits the village often at night and should be avoided.";
+ next;
+ if (select("I see.:Is there any way to prevent them from coming?") == 1) {
+ mes "[Port Guard]";
+ mes "Be careful at night!";
+ close;
+ }
+ mes "[Port Guard]";
+ mes "They say you can attack Buwayas weak point inside the box they carry if you ever get caught in one.";
+ next;
+ mes "[Port Guard]";
+ mes "And you should run into the nearest building when you hear Wokwoks wings fluttering from afar.";
+ next;
+ emotion e_hmm;
+ mes "[Port Guard]";
+ mes "But if the fluttering sound is small or if you dont hear anything, lets just say you should prepare for attack and with for luck.";
+ close;
+}
+
+malaya,88,252,4 script Little Girl #ma04 576,{
+
+ if (malaya_hi < 10) {
+ mes "[Little Girl]";
+ mes "Im scared but I have to visit the fairy in the forest.";
+ close;
+ } else if ((malaya_hi > 9) && (malaya_hi < 20)) {
+ mes "[Little Girl]";
+ mes "He he. Father said I can visit the fairy in the forest when the village calms down.";
+ close;
+ }
+ set .@name_tak01, rand(1,6);
+ if (.@name_tak01 == 1){
+ set .@name$,$ma_name01$;
+ }else if (.@name_tak01 == 2){
+ set .@name$,$ma_name02$;
+ }else if (.@name_tak01 == 3){
+ set .@name$,$ma_name03$;
+ }else if (.@name_tak01 == 4){
+ set .@name$,$ma_name04$;
+ }else if (.@name_tak01 == 5){
+ set .@name$,$ma_name05$;
+ }else{
+ set .@name$,$ma_name06$;
+ }
+ set .@name_tak02, rand(1,3);
+ if (.@name_tak02 == 2) {
+ mes "[Little Girl]";
+ mes "A little while ago" + .@name$ + "came and told me a fun story.";
+ next;
+ mes "[Little Girl]";
+ mes "'I planted a pair of pear trees in the yard.'";
+ mes "He he. Isnt it fun?" + .@name$ + "seems like a fun person.";
+ close;
+ }
+ mes "[Little Girl]";
+ mes "Father said I wont catch skin diseases once Im friends with the fairy from the forest.";
+ next;
+ select("What is this fairy?");
+ mes "[Little Girl]";
+ mes "Encanto! Encanto fairies live in big trees or rocks in the forest. There are boy fairies and girl fairies,";
+ next;
+ mes "[Little Girl]";
+ mes "but boy fairies are prettier. Why is that?";
+ close;
+}
+
+malaya,219,92,6 script Little Kid#ma05 577,{
+
+ if (malaya_hi < 10) {
+ mes "[Little Kid]";
+ mes "My mom told me not to play outside because its dangerous. Why?";
+ close;
+ } else if ((malaya_hi > 9) && (malaya_hi < 20)) {
+ mes "[Little Kid]";
+ mes "My mom told me I can play but only in Port Malaya.";
+ next;
+ mes "[Little Kid]";
+ mes "He he. But I never thought of going outside of Port Malaya.";
+ close;
+ }
+ set .@name_tak01, rand(1,6);
+ if (.@name_tak01 == 1){
+ set .@name$,$ma_name01$;
+ }else if (.@name_tak01 == 2){
+ set .@name$,$ma_name02$;
+ }else if (.@name_tak01 == 3){
+ set .@name$,$ma_name03$;
+ }else if (.@name_tak01 == 4){
+ set .@name$,$ma_name04$;
+ }else if (.@name_tak01 == 5){
+ set .@name$,$ma_name05$;
+ }else{
+ set .@name$,$ma_name06$;
+ }
+ set .@name_tak02, rand(1,3);
+ if (.@name_tak02 == 2) {
+ mes "[Little Kid]";
+ mes "I heard someone took Jejelings hat in Baryo Mahiwaga.";
+ next;
+ mes "[Little Kid]";
+ mes "Why would someone steal a monsters hat?" + .@name$ + "must be desperate.";
+ next;
+ mes "[Little Kid]";
+ mes "Oh wait! This was suppose to be a secret. Shsh! Please pretend you didnt hear me.";
+ close;
+ }
+ mes "[Little Kid]";
+ mes "I think someone is stealing all the hats in the village.";
+ next;
+ mes "[Little Kid]";
+ mes "The hat my mom washed yesterday disappeared. Our neighbor's hat also disappeared a few days ago.";
+ next;
+ mes "[Little Kid]";
+ mes "Hmm... do you think Jejeling took it?";
+ next;
+ mes "[Little Kid]";
+ mes "I visited a friend in Baryo Mahiwaga and he said he saw Jejeling wearing the missing hat...";
+ close;
+}
+
+malaya,363,283,4 script Local#ma06 582,{
+
+ if (malaya_hi < 10) {
+ mes "[Local]";
+ mes "Hmm... is it time to be careful of the witches' curse?";
+ next;
+ mes "[Local]";
+ mes "Beware of Mongkukurums needle, foreigner.";
+ close;
+ } else if ((malaya_hi > 9) && (malaya_hi < 20)) {
+ mes "[Local]";
+ mes "Welcome to Port Malaya, foreigner..";
+ next;
+ mes "[Local]";
+ mes "The village is chaotic these days. If you see someone with red eyes, try not to stare at their eyes.";
+ close;
+ }
+ set .@name_tak01, rand(1,6);
+ if (.@name_tak01 == 1){
+ set .@name$,$ma_name01$;
+ }else if (.@name_tak01 == 2){
+ set .@name$,$ma_name02$;
+ }else if (.@name_tak01 == 3){
+ set .@name$,$ma_name03$;
+ }else if (.@name_tak01 == 4){
+ set .@name$,$ma_name04$;
+ }else if (.@name_tak01 == 5){
+ set .@name$,$ma_name05$;
+ }else{
+ set .@name$,$ma_name06$;
+ }
+ set .@name_tak02, rand(1,6);
+ if (.@name_tak02 == 1) {
+ mes "[Local]";
+ mes "Be careful walking around the village at night." + .@name$ + "was taken down by Wokwok.";
+ close;
+ } else if (.@name_tak02 == 2) {
+ mes "[Local]";
+ mes "" + .@name$ + "is said to successfully tame a Tikbalang. This person must be courageous. Wonder if Ill get to see this tamed Tikbalang? Çѹø º¸°í ½ÍÀºµ¥..";
+ close;
+ } else if (.@name_tak02 == 3) {
+ mes "[Local]";
+ mes "Have you ever seen Bongisungisu? I heard" + .@name$ + "is hunting down Bongisungisus.";
+ close;
+ } else if (.@name_tak02 == 4) {
+ mes "[Local]";
+ mes "If you plan to go out of the village, be careful of Tiucknuc" + .@name$ + "is said to be tricked by Tiucknuc and had to go to the to the hospital.";
+ close;
+ }
+ mes "[Local]";
+ mes "The village is chaotic these days. Looks like Mongkukurum is back in the village.";
+ next;
+ select("Mongkukurum?");
+ mes "[Local]";
+ mes "A monster that is also called witch. Looks like a person and also wears clothes.";
+ next;
+ mes "[Local]";
+ mes "Mongkukurum makes a doll out of the people it sees and curses it with needles.";
+ next;
+ select("Is there a way to recognize this monster?");
+ mes "[Local]";
+ mes "There is one way. All Mongkukurum have red eyes.";
+ next;
+ mes "[Local]";
+ mes "You can recognize them by their eyes but! You must remember one thing.";
+ next;
+ mes "[Local]";
+ mes "You will be captivated by Mongkukurum if you stare at their eyes too long.";
+ next;
+ mes "[Local]";
+ mes "Never ever stare into their eyes for too long.";
+ close;
+}
+
+malaya,41,127,6 script Old Man #ma07 574,{
+
+ if (malaya_hi < 10) {
+ mes "[Old Man]";
+ mes "Foreigners are not welcomed that much when our village is chaotic like these days.";
+ close;
+ } else if ((malaya_hi > 9) && (malaya_hi < 20)) {
+ mes "[Old Man]";
+ mes "You are out of luck visiting the village at a time like this and not being welcomed.";
+ close;
+ }
+ set .@name_tak01, rand(1,6);
+ if (.@name_tak01 == 1){
+ set .@name$,$ma_name01$;
+ }else if (.@name_tak01 == 2){
+ set .@name$,$ma_name02$;
+ }else if (.@name_tak01 == 3){
+ set .@name$,$ma_name03$;
+ }else if (.@name_tak01 == 4){
+ set .@name$,$ma_name04$;
+ }else if (.@name_tak01 == 5){
+ set .@name$,$ma_name05$;
+ }else{
+ set .@name$,$ma_name06$;
+ }
+ set .@name_tak02, rand(1,3);
+ if (.@name_tak02 == 2) {
+ mes "[Old Man]";
+ mes "" + .@name$ + "is said to throw out Jellopy in this village.";
+ next;
+ mes "[Old Man]";
+ mes "Tsk, tsk... Must be a person that isnt worthy of a Jellopy.";
+ close;
+ }
+ mes "[Old Man]";
+ mes "You must also look out to see if Bangungot lives in a tree you are about to cut down.";
+ next;
+ mes "[Old Man]";
+ mes "Because strange things happen if logs from trees that Bangungot lived in are used as building pillars.";
+ next;
+ select("What happens?");
+ mes "[Old Man]";
+ mes "Well, for a Bangungot, it means losing its home so they get revengeful.";
+ next;
+ mes "[Old Man]";
+ mes "When you try to sleep near the pillar, it will keep awake by playing pranks at first.";
+ next;
+ mes "[Old Man]";
+ mes "But as time goes by and their vengeance grow, they sit on top of you until you suffocate.";
+ next;
+ select("Oh, gosh...");
+ mes "[Old Man]";
+ mes "Ha ha ha. There are no Bangungots in normal pillars, so don't lose sleep on it.";
+ close;
+}
+
+malaya,63,185,4 script Woman#ma08 583,{
+
+ if (malaya_hi < 10) {
+ mes "[Woman]";
+ mes "I dont have anything to share with you.";
+ close;
+ } else if ((malaya_hi > 9) && (malaya_hi < 20)) {
+ mes "[Woman]";
+ mes "Im worried about the children. I hope they arent terrified from whats going on in the village.";
+ close;
+ }
+ set .@name_tak01, rand(1,6);
+ if (.@name_tak01 == 1){
+ set .@name$,$ma_name01$;
+ }else if (.@name_tak01 == 2){
+ set .@name$,$ma_name02$;
+ }else if (.@name_tak01 == 3){
+ set .@name$,$ma_name03$;
+ }else if (.@name_tak01 == 4){
+ set .@name$,$ma_name04$;
+ }else if (.@name_tak01 == 5){
+ set .@name$,$ma_name05$;
+ }else{
+ set .@name$,$ma_name06$;
+ }
+ set .@name_tak02, rand(1,3);
+ if (.@name_tak02 == 2) {
+ set .@nongdum, rand(1,10);
+ if (.@nongdum == 1) {
+ mes "[Woman]";
+ mes "I like fun stories. Not so long ago," + .@name$ + "came and told me a funny story.";
+ next;
+ mes "[Woman]";
+ mes "'My aunt stepped on an ant.'";
+ next;
+ } else if (.@nongdum == 2) {
+ mes "[Woman]";
+ mes "I like fun stories. Not so long ago" + .@name$ + "came and told me a funny story.";
+ next;
+ mes "[Woman]";
+ mes "'You eat chili on a chilly day.'";
+ next;
+ } else if (.@nongdum == 3) {
+ mes "[Woman]";
+ mes "I like fun stories. Not so long ago" + .@name$ + "came and told me a funny story.";
+ next;
+ mes "[Woman]";
+ mes "'Why are you putting flour on that flower?'";
+ next;
+ } else if (.@nongdum == 4) {
+ mes "[Woman]";
+ mes "I like fun stories. Not so long ago" + .@name$ + "came and told me a funny story.";
+ next;
+ mes "[Woman]";
+ mes "At the Tool Store, 'Ill buy the needle and thread! You buy the hay to lose the needle in.'";
+ next;
+ mes "[Woman]";
+ mes "said that and was kicked out of the Tool Store.";
+ next;
+ } else if (.@nongdum == 5) {
+ mes "[Woman]";
+ mes "A Kafra Employee Im friends with told me a story about a customer.";
+ next;
+ mes "[Woman]";
+ mes "'Kafra, the wise never marry and when they marry, they become otherwise.'";
+ next;
+ mes "[Woman]";
+ mes "He he... I do like funny stories but a bit difficult for my taste.";
+ close;
+ } else {
+ mes "[Woman]";
+ mes "I like fun stories. Oh by the way!" + .@name$ + ", love is photogenic. Dont you agree?";
+ next;
+ mes "[Woman]";
+ mes "It needs darkness to develop.";
+ next;
+ }
+ mes "[Woman]";
+ mes "He he. Isnt it fun?";
+ close;
+ }
+ mes "[Woman]";
+ mes "If you hear a baby crying from the forest outside of the village, never go near it.";
+ next;
+ select("Why?");
+ mes "[Woman]";
+ mes "There is a monster named Tiucknuc that roams around outside of the village and cries after transforming himself into a baby.";
+ next;
+ mes "[Woman]";
+ mes "But when kind travelers pick up the baby, it turns back into its original form and attacks.";
+ next;
+ select("Sounds like a sneaky monster.");
+ mes "[Woman]";
+ mes "Yes, this monster is bad to trick the kindness of travelers but,";
+ next;
+ mes "[Woman]";
+ mes "there is rumor that the monster came from the soul of a baby that never been born. So sad.";
+ close;
+} \ No newline at end of file
diff --git a/npc/re/cities/mora.txt b/npc/re/cities/mora.txt
index 5c2a93aee..80c1af43c 100644
--- a/npc/re/cities/mora.txt
+++ b/npc/re/cities/mora.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Mora Village
//===== By: ==================================================
//= SuperHulk
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Mora Town Script
//===== Additional Comments: =================================
diff --git a/npc/re/guides/guides_alberta.txt b/npc/re/guides/guides_alberta.txt
index 6c773c535..9b1b86a92 100644
--- a/npc/re/guides/guides_alberta.txt
+++ b/npc/re/guides/guides_alberta.txt
@@ -1,17 +1,17 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Alberta Guides
-//===== By: ==================================================
+//===== By: ==================================================
//= L0ne_W0lf
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.0
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Alberta
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.0 First version, Renewal guides.
-//============================================================
+//============================================================
alberta,23,238,4 script Guide#01alberta::AlbertaGuide 105,{
cutin "prt_soldier",2;
diff --git a/npc/re/guides/guides_aldebaran.txt b/npc/re/guides/guides_aldebaran.txt
index f74714fd5..9593e0b2e 100644
--- a/npc/re/guides/guides_aldebaran.txt
+++ b/npc/re/guides/guides_aldebaran.txt
@@ -1,17 +1,17 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Al De Baran Guides
-//===== By: ==================================================
+//===== By: ==================================================
//= L0ne_W0lf
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.0
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Al De baran
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.0 First version, Renewal guide.
-//============================================================
+//============================================================
aldebaran,139,63,4 script Guide#01aldebaran::GuideAldearan 105,{
cutin "prt_soldier",2;
diff --git a/npc/re/guides/guides_amatsu.txt b/npc/re/guides/guides_amatsu.txt
index 431707526..4ab124e27 100644
--- a/npc/re/guides/guides_amatsu.txt
+++ b/npc/re/guides/guides_amatsu.txt
@@ -1,18 +1,18 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Amatsu Guide
-//===== By: ==================================================
+//===== By: ==================================================
//= L0ne_W0lf
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.1
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= [Official Conversion]
//= Guide for the city of Amatsu.
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.0 First version, Renewal guide.
//= 1.1 Optimized. [Euphy]
-//============================================================
+//============================================================
amatsu,202,91,3 script Amatsu Guide#amatsu 758,{
mes "[Amachang]";
diff --git a/npc/re/guides/guides_ayothaya.txt b/npc/re/guides/guides_ayothaya.txt
index b6da9cba5..135e34671 100644
--- a/npc/re/guides/guides_ayothaya.txt
+++ b/npc/re/guides/guides_ayothaya.txt
@@ -1,18 +1,18 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Ayothaya Guide
-//===== By: ==================================================
+//===== By: ==================================================
//= L0ne_W0lf
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.1
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= [Official Conversion]
//= Guide for the city of Ayothaya
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.0 First version, Renewal guide.
//= 1.1 Added missing case. [Joseph]
-//============================================================
+//============================================================
ayothaya,203,169,4 script Ayothaya Guide Noi#01ay 839,{
mes "[Noi]";
diff --git a/npc/re/guides/guides_brasilis.txt b/npc/re/guides/guides_brasilis.txt
index 6e219b582..b94dc87f0 100644
--- a/npc/re/guides/guides_brasilis.txt
+++ b/npc/re/guides/guides_brasilis.txt
@@ -1,18 +1,18 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Brasilis Guide
-//===== By: ==================================================
+//===== By: ==================================================
//= L0ne_W0lf
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.1
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= [Official Conversion]
//= Guide for the city of Brasilis
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.0 First Version, Renewal guide.
//= 1.1 Added a missing close.
-//============================================================
+//============================================================
brasilis,219,97,3 script Brasilis Guide 478,{
mes "[Brasilis Guide]";
diff --git a/npc/re/guides/guides_comodo.txt b/npc/re/guides/guides_comodo.txt
index 2bea02527..59988459e 100644
--- a/npc/re/guides/guides_comodo.txt
+++ b/npc/re/guides/guides_comodo.txt
@@ -1,18 +1,18 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Comodo Guides
-//===== By: ==================================================
+//===== By: ==================================================
//= L0ne_W0lf
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.1
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Comodo.
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.0 First version, Renewal guide.
//= 1.1 Fixed and optimized. [Euphy]
-//============================================================
+//============================================================
comodo,322,178,4 script Comodo Guide#01comodo::GuideComodo 700,{
mes "[Comodo Guide]";
diff --git a/npc/re/guides/guides_dewata.txt b/npc/re/guides/guides_dewata.txt
index f554186a4..28b8696c8 100644
--- a/npc/re/guides/guides_dewata.txt
+++ b/npc/re/guides/guides_dewata.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Dewata Guide
//===== By: ==================================================
//= Muad_Dib
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guide for the city of Dewata.
diff --git a/npc/re/guides/guides_dicastes.txt b/npc/re/guides/guides_dicastes.txt
index 99beb318d..d2e079da8 100644
--- a/npc/re/guides/guides_dicastes.txt
+++ b/npc/re/guides/guides_dicastes.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= El Dicastes Guide
//===== By: ==================================================
//= Muad_Dib
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guide for the city of El Dicastes.
diff --git a/npc/re/guides/guides_einbroch.txt b/npc/re/guides/guides_einbroch.txt
index 13dba9c9b..6d28cffef 100644
--- a/npc/re/guides/guides_einbroch.txt
+++ b/npc/re/guides/guides_einbroch.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Einbroch, and Einbech Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Einbroch, and Einbech
diff --git a/npc/re/guides/guides_geffen.txt b/npc/re/guides/guides_geffen.txt
index 64ed199d0..de32bf185 100644
--- a/npc/re/guides/guides_geffen.txt
+++ b/npc/re/guides/guides_geffen.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Geffen Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Geffen.
diff --git a/npc/re/guides/guides_gonryun.txt b/npc/re/guides/guides_gonryun.txt
index 1dcf03e1b..9aa3e2371 100644
--- a/npc/re/guides/guides_gonryun.txt
+++ b/npc/re/guides/guides_gonryun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Kunlun Guide
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guide for the city of Kunlun.
diff --git a/npc/re/guides/guides_hugel.txt b/npc/re/guides/guides_hugel.txt
index f64e9b456..e80146ff3 100644
--- a/npc/re/guides/guides_hugel.txt
+++ b/npc/re/guides/guides_hugel.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Hugel Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Hugel.
diff --git a/npc/re/guides/guides_izlude.txt b/npc/re/guides/guides_izlude.txt
index 4824ffdc8..6f460ebcc 100644
--- a/npc/re/guides/guides_izlude.txt
+++ b/npc/re/guides/guides_izlude.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Izlude Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Izlude
diff --git a/npc/re/guides/guides_juno.txt b/npc/re/guides/guides_juno.txt
index 5f0a7f471..8af05d5ae 100644
--- a/npc/re/guides/guides_juno.txt
+++ b/npc/re/guides/guides_juno.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Juno Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Juno.
diff --git a/npc/re/guides/guides_lighthalzen.txt b/npc/re/guides/guides_lighthalzen.txt
index 6fa474421..fcfd1cca8 100644
--- a/npc/re/guides/guides_lighthalzen.txt
+++ b/npc/re/guides/guides_lighthalzen.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Lighthalzen Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Lighthalzen.
diff --git a/npc/re/guides/guides_louyang.txt b/npc/re/guides/guides_louyang.txt
index 9246c26c5..e5ff1d4c6 100644
--- a/npc/re/guides/guides_louyang.txt
+++ b/npc/re/guides/guides_louyang.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Louyang Guide
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guide for the city of Louyang
diff --git a/npc/re/guides/guides_lutie.txt b/npc/re/guides/guides_lutie.txt
index a95027688..121744a24 100644
--- a/npc/re/guides/guides_lutie.txt
+++ b/npc/re/guides/guides_lutie.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Lutie Guide
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guide for the city of Lutie.
diff --git a/npc/re/guides/guides_mora.txt b/npc/re/guides/guides_mora.txt
new file mode 100644
index 000000000..0cb0db35d
--- /dev/null
+++ b/npc/re/guides/guides_mora.txt
@@ -0,0 +1,215 @@
+//===== rAthena Script =======================================
+//= Mora Guides
+//===== By: ==================================================
+//= Euphy
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= rAthena SVN
+//===== Description: =========================================
+//= Guides for the city of Mora.
+//===== Additional Comments: =================================
+//= 1.0 First version. [Euphy]
+//============================================================
+
+mora,25,158,5 script Raffle Guide#north 516,{
+ mes "[Raffoh]";
+ mes "Laoh~!";
+ mes "Welcome to the Village of Mora.";
+ mes "I can tell you whatever you want to know about the village~!";
+ next;
+ switch(select("[ Inn ]:[ Residences ]:[ Stores ]:[ Warehouse ]:Remove markers from the mini-map:Quit")) {
+ case 1:
+ mes "[Raffoh]";
+ mes "Laoh~!";
+ mes "We have an inn but we can't make travelers sleep like Raffles...";
+ mes "Get some rest!";
+ viewpoint 1,44,134,0,0x0A82FF;
+ close;
+ case 2:
+ mes "[Raffoh]";
+ mes "Laoh~!";
+ mes "This is where Raffles' houses are...";
+ mes "But keep the noise down because people are asleep~!";
+ viewpoint 1,119,170,1,0xAAFF00;
+ close;
+ case 3:
+ mes "[Raffoh]";
+ mes "Laoh~!";
+ mes "If you are looking for souvenirs, you can buy some in this district.";
+ viewpoint 1,112,110,2,0xDA70D6;
+ close;
+ case 4:
+ mes "[Raffoh]";
+ mes "Laoh~!";
+ mes "This is where they keep all kinds of packages and groceries.";
+ mes "There are many things that don't belong to the Raffles, so be careful!";
+ viewpoint 1,182,161,3,0xFF1493;
+ close;
+ case 5:
+ mes "[Raffoh]";
+ mes "Laoh~! I'm removing them all~!";
+ viewpoint 2,1,1,0,0xFFFF00;
+ viewpoint 2,1,1,1,0xFFFF00;
+ viewpoint 2,1,1,2,0xFFFF00;
+ viewpoint 2,1,1,3,0xFFFF00;
+ close;
+ case 6:
+ mes "[Raffoh]";
+ mes "Laoh~!";
+ mes "What kinds of sports are popular in your homeland?";
+ close;
+ }
+}
+
+mora,167,76,3 script Raffle Guide#east 522,{
+ mes "[Raffuh]";
+ mes "Uh...";
+ mes "This, this is the Village of Mora.";
+ mes "Uh... which place do you want to know about?";
+ next;
+ switch(select("[ Inn ]:[ Residences ]:[ Stores ]:[ Warehouse ]:Remove markers from the mini-map:Quit")) {
+ case 1:
+ mes "[Raffuh]";
+ mes "Uh...";
+ mes "Are, are you sleepy?";
+ mes "You can sleep here uh!! Put your stuff down uh! And-- and---";
+ viewpoint 1,44,134,0,0x0A82FF;
+ close;
+ case 2:
+ mes "[Raffuh]";
+ mes "Uh...";
+ mes "Why are you trying to find out where I live--?";
+ mes "Uh, no... I'd like to live with my friends--";
+ viewpoint 1,119,170,1,0xAAFF00;
+ close;
+ case 3:
+ mes "[Raffuh]";
+ mes "Uh...";
+ mes "There are a lot of things in those stores-- oh, there is a hot spring also uh!";
+ viewpoint 1,112,110,2,0xDA70D6;
+ close;
+ case 4:
+ mes "[Raffuh]";
+ mes "Uh...";
+ mes "You can't just march into the warehouse, or you'll be in trouble--";
+ mes "Many of the things there are from outside the village-- Raffuh has been in trouble several times--";
+ viewpoint 1,182,161,3,0xFF1493;
+ close;
+ case 5:
+ mes "[Raffuh]";
+ mes "Are you sure you want them removed?";
+ viewpoint 2,1,1,0,0xFFFF00;
+ viewpoint 2,1,1,1,0xFFFF00;
+ viewpoint 2,1,1,2,0xFFFF00;
+ viewpoint 2,1,1,3,0xFFFF00;
+ close;
+ case 6:
+ mes "[Raffuh]";
+ mes "Uh...";
+ mes "Being a guide doesn't help much with my social phobia--";
+ close;
+ }
+}
+
+mora,115,138,5 script Raffle Guide#center 524,{
+ mes "[Raffla]";
+ mes "Lala!";
+ mes "Welcome to the Village of Mora la!";
+ mes "If you need to know anything about the village, just ask me la!";
+ next;
+ switch(select("[ Inn ]:[ Residences ]:[ Stores ]:[ Warehouse ]:Remove markers from the mini-map:Quit.")) {
+ case 1:
+ mes "[Raffla]";
+ mes "Lala!";
+ mes "This is where travelers can rest la!";
+ mes "The innkeeper is very kind, so try to talk to him a lot la!";
+ viewpoint 1,44,134,0,0x0A82FF;
+ close;
+ case 2:
+ mes "[Raffla]";
+ mes "Lala!";
+ mes "This is where Raffles live la!";
+ mes "Head over there la!";
+ viewpoint 1,119,170,1,0xAAFF00;
+ close;
+ case 3:
+ mes "[Raffla]";
+ mes "Lala!";
+ mes "So you want to buy something la?";
+ mes "There are a lot of stores and cafes, so check them out la!";
+ viewpoint 1,112,110,2,0xDA70D6;
+ close;
+ case 4:
+ mes "[Raffla]";
+ mes "Lala!";
+ mes "The warehouse is where you keep your valuables la!";
+ mes "Be careful so you don't get robbed la!";
+ viewpoint 1,182,161,3,0xFF1493;
+ close;
+ case 5:
+ mes "[Raffla]";
+ mes "Okay, I'll remove all the markers from the map la!";
+ viewpoint 2,1,1,0,0xFFFF00;
+ viewpoint 2,1,1,1,0xFFFF00;
+ viewpoint 2,1,1,2,0xFFFF00;
+ viewpoint 2,1,1,3,0xFFFF00;
+ close;
+ case 6:
+ mes "[Raffla]";
+ mes "Lala!";
+ mes "I really don't know how my family ends up doing these things la!";
+ close;
+ }
+}
+
+mora,72,51,3 script Raffle Guide#south 518,{
+ mes "[Raffli]";
+ mes "Lali?";
+ mes "Welcome to the Village of Mora.";
+ mes "If you need to know anything about the village, just ask me.";
+ next;
+ switch(select("[ Inn ]:[ Residences ]:[ Stores ]:[ Warehouse ]:Remove markers from the mini-map:Quit")) {
+ case 1:
+ mes "[Raffli]";
+ mes "Lali?";
+ mes "This is where travelers can rest.";
+ mes "The innkeeper is very kind, so get to know him.";
+ viewpoint 1,44,134,0,0x0A82FF;
+ close;
+ case 2:
+ mes "[Raffli]";
+ mes "Lali?";
+ mes "This is where Raffles live.";
+ mes "Are you coming to Raffli's house li? I'm so happy.";
+ viewpoint 1,119,170,1,0xAAFF00;
+ close;
+ case 3:
+ mes "[Raffli]";
+ mes "Lali?";
+ mes "There are a lot of things I want to buy.";
+ mes "You can find tons of places to eat and shop, and tons of things to buy.";
+ viewpoint 1,112,110,2,0xDA70D6;
+ close;
+ case 4:
+ mes "[Raffli]";
+ mes "Lali?";
+ mes "The warehouse is where you keep your valuables.";
+ mes "But don't get robbed.";
+ viewpoint 1,182,161,3,0xFF1493;
+ close;
+ case 5:
+ mes "[Raffli]";
+ mes "I'll remove all the markers.";
+ viewpoint 2,1,1,0,0xFFFF00;
+ viewpoint 2,1,1,1,0xFFFF00;
+ viewpoint 2,1,1,2,0xFFFF00;
+ viewpoint 2,1,1,3,0xFFFF00;
+ close;
+ case 6:
+ mes "[Raffli]";
+ mes "Lali?";
+ mes "Brother seems to be upset today li. Did I do anything wrong?";
+ close;
+ }
+}
diff --git a/npc/re/guides/guides_morroc.txt b/npc/re/guides/guides_morroc.txt
index 302fbf7e3..e9e662ecd 100644
--- a/npc/re/guides/guides_morroc.txt
+++ b/npc/re/guides/guides_morroc.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Morroc Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Morroc and Morroc Ruins.
diff --git a/npc/re/guides/guides_moscovia.txt b/npc/re/guides/guides_moscovia.txt
index abee9c46f..6627021f3 100644
--- a/npc/re/guides/guides_moscovia.txt
+++ b/npc/re/guides/guides_moscovia.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Moscovia Guide
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guide for the city of Moscovia.
diff --git a/npc/re/guides/guides_niflheim.txt b/npc/re/guides/guides_niflheim.txt
index 647166c02..32790bd44 100644
--- a/npc/re/guides/guides_niflheim.txt
+++ b/npc/re/guides/guides_niflheim.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Niflheim Guide
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guide for the city of Niflehim.
diff --git a/npc/re/guides/guides_payon.txt b/npc/re/guides/guides_payon.txt
index 1bda6c6dd..e07ff5bfe 100644
--- a/npc/re/guides/guides_payon.txt
+++ b/npc/re/guides/guides_payon.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Payon Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Payon.
diff --git a/npc/re/guides/guides_prontera.txt b/npc/re/guides/guides_prontera.txt
index 717672555..f744a7a8c 100644
--- a/npc/re/guides/guides_prontera.txt
+++ b/npc/re/guides/guides_prontera.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Prontera Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Prontera
diff --git a/npc/re/guides/guides_rachel.txt b/npc/re/guides/guides_rachel.txt
index 9cae73a57..e0aac2b8f 100644
--- a/npc/re/guides/guides_rachel.txt
+++ b/npc/re/guides/guides_rachel.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Rachel Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guide for the city of Rachel
diff --git a/npc/re/guides/guides_umbala.txt b/npc/re/guides/guides_umbala.txt
index ef4d2bc4a..defb6e714 100644
--- a/npc/re/guides/guides_umbala.txt
+++ b/npc/re/guides/guides_umbala.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Umbala Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Umbala
diff --git a/npc/re/guides/guides_veins.txt b/npc/re/guides/guides_veins.txt
index c01c880af..745872235 100644
--- a/npc/re/guides/guides_veins.txt
+++ b/npc/re/guides/guides_veins.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Veins Guides
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Guides for the city of Veins
diff --git a/npc/re/instances/HazyForest.txt b/npc/re/instances/HazyForest.txt
new file mode 100644
index 000000000..cb65f11d7
--- /dev/null
+++ b/npc/re/instances/HazyForest.txt
@@ -0,0 +1,1193 @@
+//===== rAthena Script =======================================
+//= Hazy Forest
+//===== By: ==================================================
+//= Euphy
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= rAthena SVN
+//===== Description: =========================================
+//= [Official Conversion]
+//= Cross through the Hazy Forest to reach the Bifrost.
+//= Contains the Wandering Guardian quest.
+//===== Additional Comments: =================================
+//= 1.0 First version. [Euphy]
+//============================================================
+
+// Instance Creation
+//============================================================
+bif_fild01,158,340,5 script Laphine Soldier#mist 447,{
+
+ set .@party_id,getcharid(1);
+ set .@md_name$,"Mistwood Maze";
+
+ mes "[Laphine Soldier]";
+ mes "Are you going into the forest?";
+ next;
+ if (!.@party_id) {
+ mes "[Laphine Soldier]";
+ mes "Well, well, well, aren't you being too rash?";
+ mes "Why don't you at least organize a party?";
+ close;
+ }
+ set .@playtime, checkquest(7211,PLAYTIME);
+ if (getcharid(0) == getpartyleader(.@party_id,2)) {
+ if (.@playtime == 0 || .@playtime == 1) {
+ mes "[Laphine Soldier]";
+ mes "...Are you sure you're not doing too much?";
+ mes "I think you'd better get some rest.";
+ mes "You'll only wear yourself out by trying to do too much";
+ next;
+ mes "[Laphine Soldier]";
+ mes "I don't think the authority will give you permission, either.";
+ mes "...Even a Sapha would be stopped from entering the forest.";
+ next;
+ select("You speak our language quite well, don't you?");
+ mes "[Laphine Soldier]";
+ mes "...Do I?";
+ mes "Actually I'm not speaking your language.";
+ mes "I'm speaking Laphine language.";
+ next;
+ mes "[Laphine Soldier]";
+ mes "But it's one of the mysteries of Bifrost.";
+ mes "That we can understand each other even if we speak different languages.";
+ next;
+ mes "[Laphine Soldier]";
+ mes "To be able to talk with everybody...";
+ mes "Perhaps that's the power of Bifrost.";
+ close;
+ } else if (.@playtime == 2) {
+ mes "[Laphine Soldier]";
+ mes "Great, great.";
+ mes "Now the forest won't reject you.";
+ mes "What are you going to do now?";
+ erasequest 7211;
+ } else {
+ mes "[Laphine Soldier]";
+ mes "You human adventurers are incredible.";
+ mes "You're always going into the forest, where no one else dares to go.";
+ next;
+ mes "[Laphine Soldier]";
+ mes "Phew. But I have to report to the authority";
+ mes "everyone who goes into the forest, just in case.";
+ next;
+ mes "[Laphine Soldier]";
+ mes "You'll get permission";
+ mes "after you register.";
+ mes "Are you going to venture into the Hazy Forest?";
+ }
+ next;
+ switch(select("Venture into the Hazy Forest.:Give up.")) {
+ case 1:
+ set .@instance, instance_create(.@md_name$,.@party_id);
+ if (.@instance >= 0) {
+ if (instance_attachmap("1@mist",.@instance) != "") {
+
+ instance_attach(.@instance);
+ instance_set_timeout 7200,300,.@instance;
+ instance_init(.@instance);
+
+ donpcevent instance_npcname("#Whisper_mist", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Tom's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Tomba's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Remi's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Tired Rem's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Ron's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Rover's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Mona's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Namon's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Sad Neoron's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Spyder's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Tito's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Pumba's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Tete's Garden Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("The Gardeners' Tree", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("#Dragon Herder", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Mysterious Young Man#mis", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Loki#mist", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("Collapsed Girl#mist", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("#Mist Mobs Respawn1", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("#Mist Mobs Respawn2", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("#Mist Mobs Respawn3", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("#Mist Mobs Respawn4", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("#Mist Mobs Respawn5", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("#Fragments of Memory", instance_id())+"::OnInstanceInit";
+ donpcevent instance_npcname("#mist_warp_init", instance_id())+"::OnInstanceInit";
+
+ mes "[Laphine Soldier]";
+ mes "Party Name "+getpartyname(.@party_id)+"...";
+ mes "Party Leader "+strcharinfo(0)+"...";
+ mes "I've got it. I've written them down on the report here.";
+ next;
+ mes "[Laphine Soldier]";
+ mes "You'll get permission soon.";
+ mes "Now go to the log tunnel, the only way to get into the Hazy Forest.";
+ mes "You understand?";
+ next;
+ mes "[Laphine Soldier]";
+ mes "We can't go against the forest,";
+ mes "but maybe you humans can.";
+ mes "Good luck!";
+ close;
+ } else
+ instance_destroy(.@instance);
+ }
+ mes "[Laphine Soldier]";
+ mes "Party Name "+getpartyname(.@party_id)+"...";
+ mes "Party Leader "+strcharinfo(0)+"...";
+ mes "Hmm...";
+ next;
+ mes "[Laphine Soldier]";
+ if (.@playtime == -1)
+ mes "It's dangerous in the forest.";
+ else
+ mes "The atmosphere is somewhat tense in the forest.";
+ mes "...Why don't you just go back today?";
+ close;
+ case 2:
+ mes "[Laphine Soldier]";
+ mes "Well, you've made the right decision.";
+ if (.@playtime == -1)
+ mes "That's what's good for you.";
+ close;
+ }
+ } else {
+ mes "[Laphine Soldier]";
+ mes "Where's your party leader?";
+ mes "It's dangerous in there.";
+ next;
+ if (.@playtime == 2) {
+ mes "[Laphine Soldier]";
+ mes "I see you've been into the forest before.";
+ mes "Okay, at least the forest won't reject you.";
+ mes "However...";
+ erasequest 7211;
+ next;
+ }
+ mes "[Laphine Soldier]";
+ mes "Put yourself in my shoes, the entrance guard, and let me meet the representative of your party.";
+ mes "I have to discuss some things with him/her.";
+ close;
+ }
+}
+
+bif_fild01,161,355,0 script Log Tunnel 844,{
+ mes "I see the forest through the log tunnel.";
+ mes "It looks like I can enter the forest through the log tunnel.";
+ next;
+ if(select("Enter the tunnel.:Give up.") == 2)
+ close;
+ // TODO: Add official MD_Enter cases.
+ if (!getcharid(1)) {
+ mes "[Laphine Soldier]";
+ mes "Hey, look!";
+ mes "Are you going alone?";
+ mes "That's impossible. Too rash.";
+ mes "Team up with some friends and go together!";
+ close;
+ }
+ set .@playtime, checkquest(7211,PLAYTIME);
+ if (has_instance("1@mist") == "") {
+ if (.@playtime == 0 || .@playtime == 1) {
+ mes "You try to crawl into the log, but some mysterious power pushes you back with a gush of wind.";
+ mes "It seems like you can't force your way into the forest.";
+ close;
+ }
+ mes "The world beyond the log tunnel looks dark and suffocating.";
+ mes "Your instinct is screaming that this forest is dangerous.";
+ close;
+ }
+ if (.@playtime == 2) erasequest 7211;
+ if (checkquest(7211,PLAYTIME) == -1) setquest 7211;
+ mapannounce "bif_fild01",getpartyname(getcharid(1))+" party's "+strcharinfo(0)+" member is entering the Mistwood Maze.",bc_map,"0x00ff99"; //FW_NORMAL 12 0 0
+ warp "1@mist",89,29;
+ close;
+}
+
+// Instance Scripts
+//============================================================
+1@mist,89,29,0 script #Whisper_mist 844,1,1,{
+ end;
+OnInstanceInit:
+ enablenpc instance_npcname("#Whisper_mist", instance_id());
+ end;
+OnTouch:
+ disablenpc instance_npcname("#Whisper_mist", instance_id());
+ initnpctimer;
+ end;
+OnTimer10000:
+OnTimer20000:
+ instance_announce 0,"Whisper: Who's this? Who's this!? The forest is open! Tom, Tomba, Tired Rem, Remi! Wake up!",bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ end;
+OnTimer60000:
+ instance_announce 0,"Loud Whisper: What are the forest keepers doing? What are the gardeners doing??",bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ end;
+OnTimer120000:
+ instance_announce 0,"Loud Whisper: Don't go out, wander around forever, and play with us!",bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ end;
+OnTimer180000:
+ instance_announce 0,"Loud Whisper: Useless, useless. Wandering around and around, you'll meet your end!",bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ stopnpctimer;
+ end;
+}
+
+// callfunc "F_Mora_Mist",<warp to enable>,<success message>,<fail message>{,<end flag>}
+function script F_Mora_Mist {
+ if (mobcount("1@mist",instance_npcname(strnpcinfo(0), instance_id())+"::OnMyMobDead") == 0) {
+ mes "Obviously no one is taking care of it.";
+ mes "It seems like you can chop down the garden tree.";
+ next;
+ if(select("Chop down the garden tree.:Give up.") == 2)
+ close;
+ mes "You chop down the tree, which was blocking the path of the maze, "+((getarg(3,0))?"clearing the way out of the forest.":"so now you can continue.");
+ instance_announce 0,getarg(1),bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ enablenpc instance_npcname(getarg(0), instance_id());
+ disablenpc instance_npcname(strnpcinfo(0), instance_id());
+ close;
+ } else
+ instance_announce 0,((getarg(3,0))?getarg(2):getarg(2)+"'s Cry: Huh? Who's doing bad things to my tree?!"),bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ end;
+}
+
+1@mist,251,121,3 script Tom's Garden 858,{ end; }
+1@mist,247,123,0 script Tom's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "a25_a18-1",
+ "Roaring Cry: Tom's bolt is broken! Watch out, Tomba! Watch out, Tomba!",
+ "Tom";
+ end;
+OnInstanceInit:
+ monster "1@mist",249,120,"Tom",2136,1,instance_npcname("Tom's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,226,95,3 script Tomba's Garden 858,{ end; }
+1@mist,225,98,0 script Tomba's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "a27-2_af1-2",
+ "Roaring Cry: Tomba's Garden Tree is gone with Tomba. Remi, what are you going to do now?",
+ "Tomba";
+ end;
+OnInstanceInit:
+ monster "1@mist",200,64,"Tomba",2136,1,instance_npcname("Tomba's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,157,183,3 script Remi's Garden 858,{ end; }
+1@mist,159,184,0 script Remi's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "a15-2_a4-1",
+ "Roaring Cry: Remi, Remi's Garden Tree was chopped down- Rem, it's your turn next. Poor Rem!",
+ "Remi";
+ end;
+OnInstanceInit:
+ monster "1@mist",154,184,"Remi the Tired",2137,1,instance_npcname("Remi's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,58,39,3 script Tired Rem's Garden 858,{ end; }
+1@mist,61,39,0 script Tired Rem's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "a4-2_a11",
+ "Rem's Desperate Cry: Argh... Rem will sleep. Rem will sleep now, and won't wake up forever!",
+ "Rem";
+ end;
+OnInstanceInit:
+ monster "1@mist",101,107,"Rem the Gardener",2136,1,instance_npcname("Tired Rem's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnTimer10000:
+ instance_announce 0,"Whisper of the Forest: So Tom's, Tomba's, Remi's, and Rem's garden trees were all chopped down?",bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ end;
+OnTimer15000:
+ instance_announce 0,"Whisper of the Forest: Trouble, trouble, we're in big trouble.",bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ end;
+OnTimer20000:
+ instance_announce 0,"Loud Whisper: They've come to the second deepest forest. Gardeners of the deep forest, watch out!",bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ stopnpctimer;
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,227,179,3 script Ron's Garden 858,{ end; }
+1@mist,230,179,0 script Ron's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "b4-2_b2",
+ "Ron the Gardener's Cry: I'm getting off work! Don't look for Ron, the second gardener, any more!!",
+ "Ron";
+ end;
+OnInstanceInit:
+ monster "1@mist",227,178,"Ron the Gardener",2134,1,instance_npcname("Ron's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,288,226,3 script Rover's Garden 858,{ end; }
+1@mist,285,225,0 script Rover's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "b7_bf1-2",
+ "Roaring Whisper: Ron's, and Rover's trees were chopped down as well. Who is forcing his way into the forest? Who is it?",
+ "Rover";
+ end;
+OnInstanceInit:
+ monster "1@mist",304,237,"Rover the Strutter",2134,1,instance_npcname("Rover's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,159,318,3 script Mona's Garden 858,{ end; }
+1@mist,161,316,0 script Mona's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "b31_b16",
+ "Clamoring Whisper: Mona the Seedseeker's garden tree is gone! Mona is gone too! Namon will be okay, because he is brave, right? Namon, are you okay?",
+ "Mona";
+ end;
+OnInstanceInit:
+ monster "1@mist",239,253,"Mona the Seedseeker",2133,1,instance_npcname("Mona's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,205,300,3 script Namon's Garden 858,{ end; }
+1@mist,204,299,0 script Namon's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "b27-3_bN-1",
+ "Clamoring Whisper: Brave Namon met his fate not so bravely... *giggle*",
+ "Namon";
+ end;
+OnInstanceInit:
+ monster "1@mist",89,173,"Brave Namon",2134,1,instance_npcname("Namon's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,219,232,3 script Sad Neoron's Garden 858,{ end; }
+1@mist,221,236,0 script Sad Neoron's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "b6-1_b33",
+ "Lamenting Whisper: Sad Neoron has become cheerful! Spyder the Superior Spider, what are you going to do? What are you going to do now?",
+ "Neoron";
+ end;
+OnInstanceInit:
+ monster "1@mist",143,265,"Sad Neoron",2137,1,instance_npcname("Sad Neoron's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,206,202,3 script Spyder's Garden 858,{ end; }
+1@mist,206,200,0 script Spyder's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "b5_b14",
+ "Depressed Whisper: Now it's all over with the second deepest forest. Gardeners are dying out-",
+ "Spyder";
+ end;
+OnInstanceInit:
+ monster "1@mist",209,200,"Spyder the Eight-Legged",2132,1,instance_npcname("Spyder's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnTimer5000:
+ instance_announce 0,"Roaring Whisper: The path is about to open. The tight bolts have been removed!",bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ end;
+OnTimer9000:
+ instance_announce 0,"Roaring Whisper: A forest opened, another opened, and the other is going to open as well. Tito and Pumba, they are heading your way!",bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ end;
+OnTimer13000:
+ instance_announce 0,"Roaring Whisper: Where you get after wandering around, around and around, everybody you've met while wandering around, around and around,",bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ end;
+OnTimer17000:
+ instance_announce 0,"Roaring Whisper: all the gardeners will be waiting for you, with their clippers in their hands-!",bc_map,"0xccffcc"; //FW_NORMAL 12 0 0
+ stopnpctimer;
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,96,288,3 script Tito's Garden 858,{ end; }
+1@mist,95,287,0 script Tito's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "c1_c13-1",
+ "Tito's Cry: *sob* *sob* Tito's gone now! Tito's done for! Boo hoo!!",
+ "Tito";
+ end;
+OnInstanceInit:
+ monster "1@mist",264,291,"Tito the Flipper",2133,1,instance_npcname("Tito's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,326,325,3 script Pumba's Garden 858,{ end; }
+1@mist,324,325,0 script Pumba's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "c13-3_c4",
+ "Roaring Whisper: Tito the Hard Worker was defeated! Stop playing and go to work, Tete! Start working!",
+ "Pumba";
+ end;
+OnInstanceInit:
+ monster "1@mist",309,165,"Diligent Pumba",2134,1,instance_npcname("Pumba's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,278,345,3 script Tete's Garden 858,{ end; }
+1@mist,280,344,0 script Tete's Garden Tree 527,{
+ callfunc "F_Mora_Mist",
+ "c19_c4",
+ "Whisper: They are strong, strong indeed. What are we going to do now? Are there any gardeners left? Are there any?",
+ "Tete";
+ end;
+OnInstanceInit:
+ monster "1@mist",277,343,"Carefree Tete",2136,1,instance_npcname("Tete's Garden Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,345,186,0 script The Gardeners' Tree 527,{
+ callfunc "F_Mora_Mist",
+ "#to_bif02",
+ "Roaring Whisper: The forest will remember you! It will remember you, the one who broke the clippers of all the gardeners!",
+ "Gardeners: We're not dead, yet!!!!",1;
+ end;
+OnInstanceInit:
+ monster "1@mist",318,137,"Baby Tom",2136,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",321,137,"Tomba the Baby",2136,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",324,137,"Exhausted Remi",2137,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",319,135,"Rem the Exhausted",2136,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",323,135,"Ron the Ex-Gardener",2134,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",320,133,"Rover the Strutter",2134,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",323,133,"Mona the Seedpicker",2133,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",317,132,"Timid Namon",2134,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",326,132,"Indifferent Neoron",2137,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",317,129,"Spyder the Seven-Legged",2132,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",320,129,"Tito the Flapper",2133,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",324,129,"Lazy Pumba",2134,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ monster "1@mist",327,129,"Careless Tete",2136,1,instance_npcname("The Gardeners' Tree", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ end;
+}
+
+1@mist,73,290,0 script Mysterious Flower#1 844,{
+ specialeffect EF_LEVEL99_4;
+ disablenpc instance_npcname(strnpcinfo(0), instance_id());
+ getitem 12561,1; //Mysterious_Seed
+ end;
+}
+1@mist,69,295,0 duplicate(Mysterious Flower#1) Mysterious Flower#2 844
+1@mist,62,291,0 duplicate(Mysterious Flower#1) Mysterious Flower#3 844
+1@mist,54,293,0 duplicate(Mysterious Flower#1) Mysterious Flower#4 844
+1@mist,48,286,0 duplicate(Mysterious Flower#1) Mysterious Flower#5 844
+1@mist,54,277,0 duplicate(Mysterious Flower#1) Mysterious Flower#6 844
+1@mist,52,270,0 duplicate(Mysterious Flower#1) Mysterious Flower#7 844
+1@mist,62,268,0 duplicate(Mysterious Flower#1) Mysterious Flower#8 844
+1@mist,72,271,0 duplicate(Mysterious Flower#1) Mysterious Flower#9 844
+1@mist,72,276,0 duplicate(Mysterious Flower#1) Mysterious Flower#10 844
+1@mist,118,194,0 duplicate(Mysterious Flower#1) Mysterious Flower#11 844
+1@mist,122,204,0 duplicate(Mysterious Flower#1) Mysterious Flower#12 844
+1@mist,137,209,0 duplicate(Mysterious Flower#1) Mysterious Flower#13 844
+1@mist,144,203,0 duplicate(Mysterious Flower#1) Mysterious Flower#14 844
+1@mist,146,186,0 duplicate(Mysterious Flower#1) Mysterious Flower#15 844
+1@mist,142,182,0 duplicate(Mysterious Flower#1) Mysterious Flower#16 844
+1@mist,132,179,0 duplicate(Mysterious Flower#1) Mysterious Flower#17 844
+1@mist,123,184,0 duplicate(Mysterious Flower#1) Mysterious Flower#18 844
+1@mist,194,118,0 duplicate(Mysterious Flower#1) Mysterious Flower#19 844
+1@mist,188,109,0 duplicate(Mysterious Flower#1) Mysterious Flower#20 844
+1@mist,193,94,0 duplicate(Mysterious Flower#1) Mysterious Flower#21 844
+1@mist,205,92,0 duplicate(Mysterious Flower#1) Mysterious Flower#22 844
+1@mist,213,96,0 duplicate(Mysterious Flower#1) Mysterious Flower#23 844
+1@mist,216,103,0 duplicate(Mysterious Flower#1) Mysterious Flower#24 844
+1@mist,212,116,0 duplicate(Mysterious Flower#1) Mysterious Flower#25 844
+1@mist,207,120,0 duplicate(Mysterious Flower#1) Mysterious Flower#26 844
+1@mist,169,310,0 duplicate(Mysterious Flower#1) Mysterious Flower#27 844
+1@mist,172,296,0 duplicate(Mysterious Flower#1) Mysterious Flower#28 844
+1@mist,191,301,0 duplicate(Mysterious Flower#1) Mysterious Flower#30 844
+1@mist,195,301,0 duplicate(Mysterious Flower#1) Mysterious Flower#31 844
+1@mist,192,316,0 duplicate(Mysterious Flower#1) Mysterious Flower#32 844
+1@mist,187,320,0 duplicate(Mysterious Flower#1) Mysterious Flower#33 844
+1@mist,174,318,0 duplicate(Mysterious Flower#1) Mysterious Flower#34 844
+1@mist,308,136,0 duplicate(Mysterious Flower#1) Mysterious Flower#35 844
+1@mist,314,122,0 duplicate(Mysterious Flower#1) Mysterious Flower#36 844
+1@mist,321,118,0 duplicate(Mysterious Flower#1) Mysterious Flower#37 844
+1@mist,331,123,0 duplicate(Mysterious Flower#1) Mysterious Flower#38 844
+1@mist,335,126,0 duplicate(Mysterious Flower#1) Mysterious Flower#39 844
+1@mist,332,141,0 duplicate(Mysterious Flower#1) Mysterious Flower#40 844
+1@mist,328,144,0 duplicate(Mysterious Flower#1) Mysterious Flower#41 844
+1@mist,314,144,0 duplicate(Mysterious Flower#1) Mysterious Flower#42 844
+1@mist,238,224,0 duplicate(Mysterious Flower#1) Mysterious Flower#43 844
+1@mist,244,231,0 duplicate(Mysterious Flower#1) Mysterious Flower#44 844
+1@mist,257,232,0 duplicate(Mysterious Flower#1) Mysterious Flower#45 844
+1@mist,262,229,0 duplicate(Mysterious Flower#1) Mysterious Flower#46 844
+1@mist,265,216,0 duplicate(Mysterious Flower#1) Mysterious Flower#47 844
+1@mist,260,214,0 duplicate(Mysterious Flower#1) Mysterious Flower#48 844
+1@mist,252,206,0 duplicate(Mysterious Flower#1) Mysterious Flower#49 844
+1@mist,244,211,0 duplicate(Mysterious Flower#1) Mysterious Flower#50 844
+
+// Wandering Guardian Quest
+//============================================================
+1@mist,2,2,0 script #Dragon Herder 844,{
+ end;
+OnInstanceInit:
+ switch(rand(1,6)) {
+ case 1: setarray .@c[0],77,240; break;
+ case 2: setarray .@c[0],147,261; break;
+ case 3: setarray .@c[0],182,263; break;
+ case 4: setarray .@c[0],194,350; break;
+ case 5: setarray .@c[0],268,183; break;
+ case 6: setarray .@c[0],65,278; break;
+ }
+ monster "1@mist",.@c[0],.@c[1],"Wandering Purple Dragon",2131,1,instance_npcname("#Dragon Herder", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ if (mobcount("1@mist",instance_npcname("#Dragon Herder", instance_id())+"::OnMyMobDead") == 0) {
+ donpcevent instance_npcname("Collapsed Girl#mist", instance_id())+"::OnEnable";
+ donpcevent instance_npcname("Mysterious Young Man#mis", instance_id())+"::OnEnable";
+ donpcevent instance_npcname("Loki#mist", instance_id())+"::OnEnable";
+ instance_announce 0,"The Dragon's Cry: Am I being punished... for abandoning the way... of the guardian...?",bc_map,"0xffff00"; //FW_NORMAL 12 0 0
+ disablenpc instance_npcname("#Dragon Herder", instance_id());
+ initnpctimer;
+ }
+ end;
+OnTimer3000:
+ stopnpctimer;
+ instance_announce 0,"Voice in your head: ...Will you... save... me... please......?",bc_map,"0xffff00"; //FW_NORMAL 12 0 0
+ end;
+}
+
+1@mist,97,30,3 script Mysterious Young Man#mis 512,{
+ if (BaseLevel < 98) {
+ mes "[Mysterious Young Man]";
+ mes "Huh? Do you plan to pass through here?";
+ mes ".....I'm afraid it's beyond your ability, but I won't meddle in your affairs.";
+ mes "We'll meet again, if you survive.";
+ close;
+ }
+ if (ep14_1_mistwoods == 0) {
+ if (ep13_3_secret > 23) {
+ mes "[Mysterious Young Man]";
+ mes "You... I remember seeing you at the camp.";
+ mes "The information you gave on Ahat was useful.";
+ mes "Thanks!";
+ next;
+ mes "[Mysterious Young Man]";
+ mes "But do you plan to pass through here?";
+ mes "What good is it to go across Bifrost?";
+ next;
+ } else {
+ mes "[Mysterious Young Man]";
+ mes "Do you plan to pass through here?";
+ mes "I will advise against it if you're just curious.";
+ mes "It will only bring about your untimely death...";
+ next;
+ }
+ mes "[Mysterious Young Man]";
+ mes "If you are determined to pass through here,";
+ mes "I will ask for your help with something.";
+ next;
+ select("Who are you?");
+ mes "[Loki]";
+ mes "Loki... from the Assassin's Guild.";
+ mes "That's my name.";
+ mes "And yours?";
+ next;
+ mes "["+strcharinfo(0)+"]";
+ mes "....";
+ mes "...."+strcharinfo(0)+" sir.";
+ next;
+ mes "[Loki]";
+ mes "I see. "+strcharinfo(0)+".";
+ mes "I'm asking you again.";
+ mes "Do you plan to pass through this forest?";
+ next;
+ switch(select("Yes, I do.:No, I don't.")) {
+ case 1:
+ mes "[Loki]";
+ mes "Then I'll ask you a question.";
+ mes "Have you ever seen a guard... a girl with purple hair?";
+ next;
+ switch(select("No, I haven't.:Yes, I might have...")) {
+ case 1:
+ mes "[Loki]";
+ mes "So you haven't.";
+ mes "You're telling the truth.";
+ next;
+ break;
+ case 2:
+ mes "[Loki]";
+ mes "Wait.";
+ mes "(Loki comes closer.)";
+ mes "... No.";
+ mes "You're telling the truth.";
+ next;
+ break;
+ }
+ mes "[Loki]";
+ mes "Now we have to say goodbye here.";
+ mes "If you survive this forest, of course.";
+ set ep14_1_mistwoods,2;
+ setquest 7212;
+ close;
+ case 2:
+ mes "[Loki]";
+ mes "I understand.";
+ mes "Step back if you aren't ready.";
+ mes "This forest doesn't like strangers.";
+ set ep14_1_mistwoods,1;
+ close;
+ }
+ } else if (ep14_1_mistwoods == 1) {
+ mes "[Loki]";
+ mes "I told you - step back if you don't want to die.";
+ mes "It's not easy going through the forest.";
+ mes "It may cost you your life.";
+ next;
+ switch(select("Okay.:What do you want?")) {
+ case 1:
+ mes "- When you step back,";
+ mes "Loki nods slightly and then looks away. -";
+ close;
+ case 2:
+ mes "[Loki]";
+ mes "I'm looking for somebody.";
+ mes "Have you ever seen a guard... a girl with purple hair?";
+ next;
+ switch(select("No, I haven't.:Yes, I might have...")) {
+ case 1:
+ mes "[Loki]";
+ mes "So you haven't.";
+ mes "You're telling the truth.";
+ next;
+ break;
+ case 2:
+ mes "[Loki]";
+ mes "Wait.";
+ mes "(Loki comes closer.)";
+ mes "... No.";
+ mes "You're telling the truth.";
+ next;
+ break;
+ }
+ mes "[Loki]";
+ mes "Now we have to say goodbye here.";
+ mes "Hopefully, we will see each other again in Mora.";
+ set ep14_1_mistwoods,2;
+ setquest 7212;
+ close;
+ }
+ } else if (ep14_1_mistwoods == 2) {
+ mes "[Loki]";
+ mes "I don't want to go with you.";
+ mes "Hopefully, we will see each other again in Mora.";
+ close;
+ } else if (ep14_1_mistwoods == 3) {
+ mes "[Loki]";
+ mes "So we meet again.";
+ mes "Are you used to this place?";
+ mes "Come to the inn in Mora.";
+ mes "I have something to give to you.";
+ close;
+ } else {
+ mes "[Loki]";
+ mes "We're seeing a lot of each other these days.";
+ mes "It seems you are completely comfortable with the place.";
+ mes "You'd better not be too proud of yourself.";
+ close;
+ }
+ end;
+OnInstanceInit:
+OnEnable:
+ enablenpc instance_npcname("Mysterious Young Man#mis", instance_id());
+ end;
+OnDisable:
+ disablenpc instance_npcname("Mysterious Young Man#mis", instance_id());
+ end;
+}
+
+1@mist,183,304,3 script Loki#mist 512,{
+ if (ep14_1_mistwoods < 2) {
+ mes "[Loki]";
+ mes "An adventurer in the forest.";
+ mes ".....";
+ mes "You can go to Mora through this forest.";
+ close;
+ } else if (ep14_1_mistwoods == 2) {
+ mes "[Loki]";
+ mes "Is it you that took care of this unruly girl?";
+ mes "I guess I have to thank you.";
+ mes "You've calmed her down.";
+ next;
+ select("What's happening?:This girl...?");
+ mes "[Loki]";
+ mes "You might be able to change your appearance, but you cannot change your unique, innate light.";
+ mes "A scent strong enough to burn your nose.";
+ next;
+ mes "[Loki]";
+ mes "This is Nydhogg, the Guardian of Yggdrasil,";
+ mes "whom I was looking for.";
+ mes "Now she won't wander around crazy any more.";
+ next;
+ select("What are you going to do now?");
+ mes "[Loki]";
+ mes "I'll wait for her to wake up and get out of this forest.";
+ mes "I can manage it on my own.";
+ mes "I'll see you in Mora.";
+ set ep14_1_mistwoods,3;
+ erasequest 7212;
+ setquest 7213;
+ close;
+ } else if (ep14_1_mistwoods == 3) {
+ mes "[Loki]";
+ mes "I don't want to go with you.";
+ mes "I can manage her on my own.";
+ mes "If you have something to say, say it after we get out of the forest.";
+ close;
+ } else {
+ mes "[Loki]";
+ mes "I don't want to go with you.";
+ mes "If you have something to say, say it after we get out of the forest.";
+ close;
+ }
+ end;
+OnInstanceInit:
+OnDisable:
+ disablenpc instance_npcname("Loki#mist", instance_id());
+ end;
+OnEnable:
+ enablenpc instance_npcname("Loki#mist", instance_id());
+ end;
+}
+
+1@mist,181,303,3 script Collapsed Girl#mist 511,{
+ mes "You see a girl with mysterious hair collapsed on the ground.";
+ mes "As you approach her, you smell the scent of flowers so strong that it makes you dizzy.";
+ close;
+OnInstanceInit:
+OnDisable:
+ disablenpc instance_npcname("Collapsed Girl#mist", instance_id());
+ end;
+OnEnable:
+ enablenpc instance_npcname("Collapsed Girl#mist", instance_id());
+ end;
+}
+
+mora,46,152,5 script Flower Smelling Lady 510,{
+ if (ep14_1_mistwoods < 3) {
+ mes "[Flower Smell Lady]";
+ mes "I need rest.";
+ mes "I'm too tired to talk to you.";
+ mes "I'm sorry.";
+ close;
+ } else if (ep14_1_mistwoods == 3) {
+ mes "[Nydhogg the Guardian]";
+ mes "I've been waiting for you.";
+ mes "I'm still confused, but I know what I did wrong.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "If it weren't for you, I would still be wandering in the abyssal darkness.";
+ mes "I thank you, from the bottom of my heart.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "I'm ashamed of myself, falling for the sweet but empty words that came to me in my loneliness.";
+ mes "....";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "I don't deserve to be a guardian any more.";
+ mes "A dragon gone crazy is not a guardian any more.";
+ next;
+ mes "[Loki]";
+ mes "Yggdrasil doesn't think so.";
+ mes "Nidi, don't forget your duties.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "Are you...?";
+ mes "I see...";
+ mes "I thought I was forsaken...";
+ next;
+ mes "The Guardian slowly looked away as if deep in thought.";
+ set ep14_1_mistwoods,4;
+ close2;
+ } else if (ep14_1_mistwoods == 4) {
+ mes "- He seems to be deep in thought. -";
+ close;
+ } else {
+ mes "[Nydhogg the Guardian]";
+ mes "I haven't gotten all of my powers back.";
+ mes "I'm sorry I can't protect you.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "Loki said...";
+ mes "that I won't cry from loneliness again,";
+ mes "that I will always have new friends like you...";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "...I've lost everything, but I'm happy now.";
+ close;
+ }
+}
+
+mora,48,152,3 script Sharp Eyed Man 512,{
+ if (checkweight(1201,1) == 0 || MaxWeight - Weight < 1000) {
+ mes "- You have too many items to do this quest. -";
+ close;
+ }
+ if (ep14_1_mistwoods < 3) {
+ mes "He won't look at you. It's like he's not interested at all.";
+ close;
+ } else if (ep14_1_mistwoods == 3) {
+ mes "[Loki]";
+ mes "So you've passed through the forest.";
+ mes "It seems Niddy has something to say to you.";
+ close;
+ } else if (ep14_1_mistwoods == 4) {
+ mes "[Loki]";
+ mes "Nydhogg was one of the guardians of the World Tree.";
+ mes "But he abandoned his duties as a guardian when he gave in to Morroc's temptation.";
+ next;
+ mes "[Loki]";
+ mes "Some fools performed a ritual to break the seal that held Morroc.";
+ mes "But the ritual didn't work right. The servant of Morroc failed to break the seal.";
+ next;
+ mes "[Loki]";
+ mes "But the seal is so weak that it can break open any time.";
+ mes "It's Yggdrasil the World Tree's will that has kept the seal from breaking.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "That's right. The power of the World Tree is linked to the whole world.";
+ mes "When the bond between the guardians and Yggdrasil broke, Yggdrasil became unstable.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "That's why all those disasters happened to Yggdrasil.";
+ mes "As the World Tree became unstable, the influence it had on the seal grew weak.";
+ next;
+ mes "[Loki]";
+ mes "And Morroc broke himself free from the seal.";
+ mes "Although it seems like he used most of his powers just to break the seal...";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "It's all my fault.";
+ mes "I couldn't break free from Morroc's temptation.";
+ mes "For too... too long...";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "...I wanted to be relieved of my thousands of years of loneliness.";
+ mes "I wasn't in my right mind then.";
+ mes "It was none other than I that broke my bond with Yggdrasil.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "I lost control of myself, and did what I shouldn't have done.";
+ mes "The other side of me became a shadow and a reckless tyrant.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "Facing the world, I realized...";
+ mes "I felt too great a sense of loss... it was much more painful than the loneliness I had endured for thousands of years.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "That's how I was left alone.";
+ mes "I felt too great a sense of loss... it was much more painful than the loneliness I had endured for thousands of years.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "So I became a sinner, forgotten to the world.";
+ next;
+ mes "[Loki]";
+ mes "It's not too late.";
+ mes "You're still a guardian.";
+ mes "You still have things to do.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "... Oh, yes. It's late, but I have to fulfill my duties as a guardian.";
+ mes "Now I know. I'll destroy Morroc with my own hands.";
+ mes "I will fulfill my duties as a guardian.";
+ next;
+ switch(select("You're not alone.:Those are very important duties.")) {
+ case 1:
+ mes "[Nydhogg the Guardian]";
+ mes "You're right.";
+ mes "It may be why I haven't been forsaken - to realize that I'm not alone.";
+ mes "You are a kind soul.";
+ next;
+ break;
+ case 2:
+ mes "[Nydhogg the Guardian]";
+ mes "But this is my atonement.";
+ mes "I'm happy, though.";
+ mes "I don't have to fight the loneliness any more.";
+ next;
+ break;
+ }
+ mes "[Nydhogg the Guardian]";
+ mes strcharinfo(0)+"...";
+ mes "Thanks for listening to my long story.";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "It's what I always have with me.";
+ mes "I'm sure it will protect you someday.";
+ next;
+ mes "[Loki]";
+ mes "(Removes his scarf from around his neck and hands it to you.)";
+ next;
+ mes "[Nydhogg the Guardian]";
+ mes "May the blessing of Mother Yggdrasil be with you...";
+ set ep14_1_mistwoods,10;
+ completequest 7213;
+ getitem 2568,1; //Muffler_Of_Roki
+ getitem 2858,1; //Pendant_Of_Guardian
+ getexp 400000,400000;
+ close;
+ } else {
+ mes "[Loki]";
+ mes "I'll be staying here for a while.";
+ mes "We may meet again.";
+ next;
+ mes "[Loki]";
+ mes "The day when Morroc reveals his despicable nature...";
+ mes "I will be waiting for him.";
+ close;
+ }
+}
+
+// Monster Spawns
+//============================================================
+1@mist,1,1,0 script #Mist Mobs Respawn1 844,{
+ end;
+OnInstanceInit:
+ monster "1@mist",0,0,"Miming",2137,15,instance_npcname("#Mist Mobs Respawn1", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ set .@num_mobs, 15 - mobcount("1@mist",instance_npcname("#Mist Mobs Respawn1", instance_id())+"::OnMyMobDead");
+ if (.@num_mobs > 0)
+ monster "1@mist",0,0,"Miming",2137,.@num_mobs,instance_npcname("#Mist Mobs Respawn1", instance_id())+"::OnMyMobDead";
+ end;
+}
+
+1@mist,1,2,0 script #Mist Mobs Respawn2 844,{
+ end;
+OnInstanceInit:
+ monster "1@mist",0,0,"Pom Spider",2132,35,instance_npcname("#Mist Mobs Respawn2", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ set .@num_mobs, 35 - mobcount("1@mist",instance_npcname("#Mist Mobs Respawn2", instance_id())+"::OnMyMobDead");
+ if (.@num_mobs > 0)
+ monster "1@mist",0,0,"Pom Spider",2132,.@num_mobs,instance_npcname("#Mist Mobs Respawn2", instance_id())+"::OnMyMobDead";
+ end;
+}
+
+1@mist,1,3,0 script #Mist Mobs Respawn3 844,{
+ end;
+OnInstanceInit:
+ monster "1@mist",0,0,"Angra Mantis",2133,35,instance_npcname("#Mist Mobs Respawn3", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ set .@num_mobs, 35 - mobcount("1@mist",instance_npcname("#Mist Mobs Respawn3", instance_id())+"::OnMyMobDead");
+ if (.@num_mobs > 0)
+ monster "1@mist",0,0,"Angra Mantis",2133,.@num_mobs,instance_npcname("#Mist Mobs Respawn3", instance_id())+"::OnMyMobDead";
+ end;
+}
+
+1@mist,1,4,0 script #Mist Mobs Respawn4 844,{
+ end;
+OnInstanceInit:
+ monster "1@mist",0,0,"Parus",2134,35,instance_npcname("#Mist Mobs Respawn4", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ set .@num_mobs, 35 - mobcount("1@mist",instance_npcname("#Mist Mobs Respawn4", instance_id())+"::OnMyMobDead");
+ if (.@num_mobs > 0)
+ monster "1@mist",0,0,"Parus",2134,.@num_mobs,instance_npcname("#Mist Mobs Respawn4", instance_id())+"::OnMyMobDead";
+ end;
+}
+
+1@mist,1,5,0 script #Mist Mobs Respawn5 844,{
+ end;
+OnInstanceInit:
+ monster "1@mist",0,0,"Little Fatum",2136,15,instance_npcname("#Mist Mobs Respawn5", instance_id())+"::OnMyMobDead";
+ end;
+OnMyMobDead:
+ set .@num_mobs, 15 - mobcount("1@mist",instance_npcname("#Mist Mobs Respawn5", instance_id())+"::OnMyMobDead");
+ if (.@num_mobs > 0)
+ monster "1@mist",0,0,"Little Fatum",2136,.@num_mobs,instance_npcname("#Mist Mobs Respawn5", instance_id())+"::OnMyMobDead";
+ end;
+}
+
+1@mist,1,6,0 script #Fragments of Memory 844,{
+ end;
+OnInstanceInit:
+ disablenpc instance_npcname("#Fragments of Memory", instance_id());
+ monster "1@mist",0,0,"Guardian's Fragments of Memory",2138,15;
+ end;
+}
+
+// Warp Portals
+//============================================================
+bif_fild01,38,374,0 script Mysterious Flower#ep14_1 844,{
+ mes "It's a giant flower with mysterious energy.";
+ if (countitem(12561)) {
+ mes "It's reacting to the Mysterious Flower Seeds you have with you.";
+ next;
+ switch(select("Observe the reaction.:Stop the reaction.")) {
+ case 1:
+ mes "The flower started to shake violently";
+ mes "and swing forward as if trying to send the seeds as far away as possible!!!";
+ close2;
+ delitem 12561,1; //Mysterious_Seed
+ warp "bif_fild02",160,230;
+ end;
+ case 2:
+ mes "As you hold onto the Mysterious Flower Seeds tightly,";
+ mes "the flower shook violently and then became calm again.";
+ close;
+ }
+ }
+ mes "It looks like it has some special use, but you're not sure what.";
+ close;
+}
+
+1@mist,104,23,0 warp #to_bif01 1,1,bif_fild01,160,352
+
+1@mist,109,70,0 script a1_a2 45,1,1,{
+ end;
+OnTouch:
+ if (checkquest(7211,PLAYTIME) == -1)
+ setquest 7211;
+ warp "1@mist",116,40;
+ end;
+}
+
+1@mist,113,40,0 warp a2_a7 1,1,1@mist,90,81
+1@mist,93,81,0 warp a7_a14 1,1,1@mist,108,152
+1@mist,111,154,0 warp a14_a24 1,1,1@mist,236,108
+1@mist,236,110,0 warp a24_a1 1,1,1@mist,106,69
+1@mist,161,67,0 warp a18-1_a22 1,1,1@mist,159,85
+1@mist,180,116,0 warp a23_a18-1 1,1,1@mist,164,66
+1@mist,180,63,0 warp a18-2_a9 1,1,1@mist,141,90
+1@mist,116,84,0 warp a8_a26 1,1,1@mist,222,133
+1@mist,220,133,0 warp a26_a27-1 1,1,1@mist,200,64
+1@mist,197,64,0 warp a27-1_a23 1,1,1@mist,177,116
+1@mist,146,194,0 warp af1-2_a27-2 1,1,1@mist,225,96
+1@mist,133,195,0 warp af1-1_af2-1 1,1,1@mist,202,110
+1@mist,202,107,0 warp af2-1_af1-1 1,1,1@mist,134,189
+1@mist,217,110,0 warp af2-2_a20-1 1,1,1@mist,240,56
+1@mist,240,54,0 warp a20-1_af2-2 1,1,1@mist,214,110
+1@mist,234,67,0 warp a20-2_a21 1,1,1@mist,239,80
+1@mist,242,77,0 warp a21_a15-1 1,1,1@mist,153,137
+1@mist,156,139,0 warp a15-1_a3 1,1,1@mist,123,55
+1@mist,124,51,0 warp a3_a20-1 1,1,1@mist,240,56
+1@mist,48,41,0 warp a4-1_a17 1,1,1@mist,174,165
+1@mist,171,165,0 warp a17_a16 1,1,1@mist,168,143
+1@mist,169,141,0 warp a16_a10 1,1,1@mist,101,107
+1@mist,99,107,0 warp a10_a4-2 1,1,1@mist,57,38
+1@mist,65,113,0 warp a11_a28 1,1,1@mist,218,151
+1@mist,221,151,0 warp a28_a13 1,1,1@mist,117,126
+1@mist,114,126,0 warp a13_a5 1,1,1@mist,36,62
+1@mist,61,88,0 warp a6_a19 1,1,1@mist,189,139
+1@mist,186,140,0 warp a19_a12 1,1,1@mist,98,126
+1@mist,101,126,0 warp a12_a29-1 1,1,1@mist,238,151
+1@mist,235,152,0 warp a29-1_af1-2 1,1,1@mist,144,194
+1@mist,254,151,0 warp a29-2E_b1 1,1,1@mist,271,164
+1@mist,275,211,0 warp b1_b13 1,1,1@mist,277,112
+1@mist,301,141,0 warp b14_b24 1,1,1@mist,99,232
+1@mist,99,230,0 warp b24_b25 1,1,1@mist,103,255
+1@mist,102,253,0 warp b25_b4-1 1,1,1@mist,215,177
+1@mist,212,177,0 warp b4-1_b1 1,1,1@mist,276,208
+1@mist,289,167,0 warp b2_b19 1,1,1@mist,152,219
+1@mist,149,219,0 warp b19_b20 1,1,1@mist,119,227
+1@mist,115,227,0 warp b20_b23 1,1,1@mist,230,353
+1@mist,233,353,0 warp b23_b7 1,1,1@mist,289,225
+1@mist,76,273,0 warp bf1-2_b7 1,1,1@mist,289,225
+1@mist,61,282,0 warp bf1-1_bf2-1 1,1,1@mist,256,220
+1@mist,252,220,0 warp bf2-1_bf1-1 1,1,1@mist,65,282
+1@mist,267,213,0 warp bf2-2_b28 1,1,1@mist,214,268
+1@mist,212,265,0 warp b28_b12 1,1,1@mist,288,266
+1@mist,285,266,0 warp b12_b21 1,1,1@mist,143,234
+1@mist,143,231,0 warp b21_b29 1,1,1@mist,222,281
+1@mist,223,279,0 warp b29_b31 1,1,1@mist,158,317
+1@mist,134,287,0 warp b30_b3 1,1,1@mist,293,195
+1@mist,295,197,0 warp b3_b10 1,1,1@mist,239,253
+1@mist,236,253,0 warp b10_b12 1,1,1@mist,288,266
+1@mist,111,203,0 warp b16_b34 1,1,1@mist,202,333
+1@mist,199,333,0 warp b34_b27-1 1,1,1@mist,203,251
+1@mist,206,249,0 warp b27-1_b22 1,1,1@mist,168,239
+1@mist,165,239,0 warp b22_b15 1,1,1@mist,89,173
+1@mist,177,265,0 warp b27-2_a14 1,1,1@mist,108,152
+1@mist,166,314,0 warp bN-1_b27-3 1,1,1@mist,206,297
+1@mist,197,299,0 warp bN-2_b17 1,1,1@mist,167,200
+1@mist,165,200,0 warp b17_bN-2 1,1,1@mist,193,299
+1@mist,86,173,0 warp b15_b32 1,1,1@mist,218,313
+1@mist,215,313,0 warp b32_b28 1,1,1@mist,214,268
+1@mist,230,324,0 warp b33_b6-1 1,1,1@mist,221,233
+1@mist,230,230,0 warp b6-2_b11 1,1,1@mist,263,261
+1@mist,263,258,0 warp b11_b9 1,1,1@mist,272,246
+1@mist,269,246,0 warp b9_b26 1,1,1@mist,143,265
+1@mist,140,265,0 warp b26_b5 1,1,1@mist,209,200
+1@mist,195,206,0 warp b18_b35 1,1,1@mist,169,341
+1@mist,166,341,0 warp b35_b36 1,1,1@mist,198,354
+1@mist,201,354,0 warp b36_b37-1 1,1,1@mist,83,224
+1@mist,87,224,0 warp b37-1_b35 1,1,1@mist,169,341
+1@mist,84,273,0 warp b37-2_c1 1,1,1@mist,98,287
+1@mist,111,298,0 warp c2_c3 1,1,1@mist,82,307
+1@mist,79,307,0 warp c3_c7 1,1,1@mist,284,89
+1@mist,281,89,0 warp c7_c12 1,1,1@mist,264,291
+1@mist,261,291,0 warp c12_c2 1,1,1@mist,115,298
+1@mist,326,275,0 warp c13-1_b13 1,1,1@mist,277,112
+1@mist,294,293,0 warp c13-2_c5 1,1,1@mist,78,330
+1@mist,81,330,0 warp c5_c17 1,1,1@mist,308,330
+1@mist,308,327,0 warp c17_c10 1,1,1@mist,309,165
+1@mist,306,165,0 warp c10_c13-2 1,1,1@mist,298,293
+1@mist,46,316,0 warp c4_c6 1,1,1@mist,113,328
+1@mist,95,328,0 warp c6_c9 1,1,1@mist,342,157
+1@mist,339,157,0 warp c9_c16 1,1,1@mist,343,328
+1@mist,343,325,0 warp c16_c8-2 1,1,1@mist,346,120
+1@mist,344,123,0 warp c8-2_c19 1,1,1@mist,277,343
+1@mist,256,313,0 warp c18_c15 1,1,1@mist,343,307
+1@mist,342,305,0 warp c15_cKEY 1,1,1@mist,332,121
+1@mist,335,120,0 warp cKEY_c18 1,1,1@mist,259,313
+1@mist,317,89,0 warp c8-1_c14 1,1,1@mist,339,284
+1@mist,339,281,0 warp c14_c11-1 1,1,1@mist,332,172
+1@mist,329,171,0 warp c11-1_c8-2 1,1,1@mist,346,120
+1@mist,301,237,0 warp b8_b2 1,1,1@mist,289,170
+
+// Disable Garden Tree warps.
+// Custom, but saves processing and lines.
+1@mist,1,1,0 script #mist_warp_init 844,{
+ end;
+OnInstanceInit:
+ disablenpc instance_npcname("a25_a18-1", instance_id());
+ disablenpc instance_npcname("a27-2_af1-2", instance_id());
+ disablenpc instance_npcname("a15-2_a4-1", instance_id());
+ disablenpc instance_npcname("a4-2_a11", instance_id());
+ disablenpc instance_npcname("b4-2_b2", instance_id());
+ disablenpc instance_npcname("b7_bf1-2", instance_id());
+ disablenpc instance_npcname("b31_b16", instance_id());
+ disablenpc instance_npcname("b27-3_bN-1", instance_id());
+ disablenpc instance_npcname("b6-1_b33", instance_id());
+ disablenpc instance_npcname("b5_b14", instance_id());
+ disablenpc instance_npcname("c1_c13-1", instance_id());
+ disablenpc instance_npcname("c13-3_c4", instance_id());
+ disablenpc instance_npcname("c19_c4", instance_id());
+ disablenpc instance_npcname("#to_bif02", instance_id());
+ disablenpc instance_npcname("#mist_warp_init", instance_id());
+ end;
+}
+1@mist,247,123,0 warp a25_a18-1 1,1,1@mist,164,66 //Tom
+1@mist,225,98,0 warp a27-2_af1-2 1,1,1@mist,144,194 //Tomba
+1@mist,159,184,0 warp a15-2_a4-1 1,1,1@mist,49,37 //Remi
+1@mist,61,39,0 warp a4-2_a11 1,1,1@mist,68,113 //Rem
+1@mist,230,179,0 warp b4-2_b2 1,1,1@mist,289,170 //Ron
+1@mist,285,225,0 warp b7_bf1-2 1,1,1@mist,72,274 //Rover
+1@mist,161,316,0 warp b31_b16 1,1,1@mist,108,203 //Mona
+1@mist,204,299,0 warp b27-3_bN-1 1,1,1@mist,169,314 //Namon
+1@mist,221,236,0 warp b6-1_b33 1,1,1@mist,233,324 //Neoron
+1@mist,206,200,0 warp b5_b14 1,1,1@mist,298,142 //Spyder
+1@mist,95,287,0 warp c1_c13-1 1,1,1@mist,323,276 //Tito
+1@mist,324,325,0 warp c13-3_c4 1,1,1@mist,49,316 //Pumba
+1@mist,280,344,0 warp c19_c4 1,1,1@mist,49,316 //Tete
+1@mist,345,186,0 warp #to_bif02 1,1,bif_fild02,151,121 //The Gardeners' Tree
diff --git a/npc/re/jobs/1-1/mage.txt b/npc/re/jobs/1-1/mage.txt
index b6cc20f2c..1fce4269e 100644
--- a/npc/re/jobs/1-1/mage.txt
+++ b/npc/re/jobs/1-1/mage.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Renewal Mage Job Quest
//===== By: ==================================================
//= Kisuka
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Job Change to Mage Class
//===== Additional Comments: =================================
diff --git a/npc/re/jobs/1-1/merchant.txt b/npc/re/jobs/1-1/merchant.txt
index b08cf1a40..58c13ae17 100644
--- a/npc/re/jobs/1-1/merchant.txt
+++ b/npc/re/jobs/1-1/merchant.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Renewal Merchant Job Quest
//===== By: ==================================================
//= Kisuka
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Job Change to Merchant Class
//===== Additional Comments: =================================
diff --git a/npc/re/jobs/1-1/swordman.txt b/npc/re/jobs/1-1/swordman.txt
index db7b62d41..0d47f0b3a 100644
--- a/npc/re/jobs/1-1/swordman.txt
+++ b/npc/re/jobs/1-1/swordman.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Renewal Swordman Job Quest
//===== By: ==================================================
//= Kisuka
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Job Change to Swordman Class
//===== Additional Comments: =================================
diff --git a/npc/re/jobs/1-1/thief.txt b/npc/re/jobs/1-1/thief.txt
index e0ea4d5a9..23b23bd96 100644
--- a/npc/re/jobs/1-1/thief.txt
+++ b/npc/re/jobs/1-1/thief.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Renewal Thief Job Quest
//===== By: ==================================================
//= Kisuka
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Job Change to Thief Class
//===== Additional Comments: =================================
diff --git a/npc/re/jobs/3-1/guillotine_cross.txt b/npc/re/jobs/3-1/guillotine_cross.txt
index f8ba5b50e..71769be81 100644
--- a/npc/re/jobs/3-1/guillotine_cross.txt
+++ b/npc/re/jobs/3-1/guillotine_cross.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Guillotine Cross Job Quest
//===== By: ==================================================
//= Muad_Dib
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= rAthena SVN r16945+
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Job change Quest from Assassin / Assassin Cross -> Guillotine Cross.
diff --git a/npc/re/jobs/3-1/mechanic.txt b/npc/re/jobs/3-1/mechanic.txt
index 94792439d..c38d4608f 100644
--- a/npc/re/jobs/3-1/mechanic.txt
+++ b/npc/re/jobs/3-1/mechanic.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Mechanic Job Quest
//===== By: ==================================================
//= Muad_Dib
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Jobchange Quest from Blacksmith / Whitesmith -> Mechanic.
diff --git a/npc/re/jobs/3-1/ranger.txt b/npc/re/jobs/3-1/ranger.txt
index e499b03b2..314f199d2 100644
--- a/npc/re/jobs/3-1/ranger.txt
+++ b/npc/re/jobs/3-1/ranger.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Ranger Job Quest
//===== By: ==================================================
//= Muad_Dib
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Job change Quest from Hunter / Sniper -> Ranger.
diff --git a/npc/re/jobs/3-1/warlock.txt b/npc/re/jobs/3-1/warlock.txt
index 8a8e1f0ce..9894eae4b 100644
--- a/npc/re/jobs/3-1/warlock.txt
+++ b/npc/re/jobs/3-1/warlock.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Warlock Job Quest
//===== By: ==================================================
//= Muad_Dib, Gepard & L0ne_W0lf
//===== Current Version: =====================================
//= 1.3a
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Job change Quest from Wizard / High Wizard -> Warlock.
diff --git a/npc/re/jobs/3-2/genetic.txt b/npc/re/jobs/3-2/genetic.txt
index 1d0d8cbe9..bfa7d422c 100644
--- a/npc/re/jobs/3-2/genetic.txt
+++ b/npc/re/jobs/3-2/genetic.txt
@@ -1,15 +1,15 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Genetic Job Quest
-//===== By: ==================================================
+//===== By: ==================================================
//= Muad_Dib, Aeomin
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.3a
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= [Official Conversion]
//= Job change Quest from Alchemist / Creator -> Genetic.
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.0 First Version. [Masao]
//= 1.1 Fixed Scatter Stuff NPCs [JayPee].
//= 1.2 Updated dialogue. Credits to Muad_Dib. [Joseph]
diff --git a/npc/re/jobs/3-2/minstrel.txt b/npc/re/jobs/3-2/minstrel.txt
index 9610e2c57..a9d584526 100644
--- a/npc/re/jobs/3-2/minstrel.txt
+++ b/npc/re/jobs/3-2/minstrel.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Minstrel Job Quest
//===== By: ==================================================
//= Muad_Dib
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Job change Quest from Bard / Clown -> Minstrel.
diff --git a/npc/re/jobs/3-2/royal_guard.txt b/npc/re/jobs/3-2/royal_guard.txt
index a7f21d763..614896133 100644
--- a/npc/re/jobs/3-2/royal_guard.txt
+++ b/npc/re/jobs/3-2/royal_guard.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Royal Guard Job Quest
//===== By: ==================================================
//= Muad_Dib
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Job change Quest from Crusader / Paladin -> Royal Guard.
diff --git a/npc/re/jobs/3-2/shadow_chaser.txt b/npc/re/jobs/3-2/shadow_chaser.txt
index 4f0fd02b6..f9d27dc84 100644
--- a/npc/re/jobs/3-2/shadow_chaser.txt
+++ b/npc/re/jobs/3-2/shadow_chaser.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Shadow Chaser Job Quest
//===== By: ==================================================
//= Muad_Dib
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Job change Quest from Rogue / Stalker -> Shadow Chaser.
diff --git a/npc/re/jobs/3-2/sorcerer.txt b/npc/re/jobs/3-2/sorcerer.txt
index 712e01452..71ec97e4b 100644
--- a/npc/re/jobs/3-2/sorcerer.txt
+++ b/npc/re/jobs/3-2/sorcerer.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Sorcerer Job Quest
//===== By: ==================================================
//= Muad_Dib
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Job change Quest from Sage / Professor -> Sorcerer.
diff --git a/npc/re/jobs/3-2/sura.txt b/npc/re/jobs/3-2/sura.txt
index b31719934..311e95ec1 100644
--- a/npc/re/jobs/3-2/sura.txt
+++ b/npc/re/jobs/3-2/sura.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Sura Job Quest
//===== By: ==================================================
//= Muad_Dib, Gepard
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Job change Quest from Monk / Champion -> Sura.
diff --git a/npc/re/jobs/3-2/wanderer.txt b/npc/re/jobs/3-2/wanderer.txt
index 552c9d80b..41839b644 100644
--- a/npc/re/jobs/3-2/wanderer.txt
+++ b/npc/re/jobs/3-2/wanderer.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Wanderer Job Quest
//===== By: ==================================================
//= Muad_Dib, Meyraw
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Job change Quest from Dancer / Gypsy -> Wanderer.
diff --git a/npc/re/jobs/novice/supernovice_ex.txt b/npc/re/jobs/novice/supernovice_ex.txt
index 5687c0768..4a8436dfe 100644
--- a/npc/re/jobs/novice/supernovice_ex.txt
+++ b/npc/re/jobs/novice/supernovice_ex.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Expanded Super Novice Job Quest
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.1a
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Job Change quest for Expanded Super Novice class.
//===== Additional Comments: =================================
diff --git a/npc/re/kafras/kafras.txt b/npc/re/kafras/kafras.txt
index eb4cd30d3..2cab9e388 100644
--- a/npc/re/kafras/kafras.txt
+++ b/npc/re/kafras/kafras.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Kafras (Cities/Dungeons/Fields)
//===== By: ==================================================
//= Joseph
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Argument settings for callfunc "F_Kafra":
//= arg(0): 0 - Default Kafra message
diff --git a/npc/re/merchants/card_separation.txt b/npc/re/merchants/card_separation.txt
index a81aeb746..386474000 100644
--- a/npc/re/merchants/card_separation.txt
+++ b/npc/re/merchants/card_separation.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Card Separation System
//===== By: ==================================================
//= Muad_Dib
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Official Conversion]
//= Separates cards from equipment.
diff --git a/npc/re/merchants/coin_exchange.txt b/npc/re/merchants/coin_exchange.txt
index 92afddca0..7ee6a53af 100644
--- a/npc/re/merchants/coin_exchange.txt
+++ b/npc/re/merchants/coin_exchange.txt
@@ -1,7 +1,7 @@
-//===== Hercules Script =======================================
+//===== Hercules Script ======================================
//= Coin Merchants
//===== By: ==================================================
-//= rAthena Dev Team
+//= Hercules Dev Team
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
diff --git a/npc/re/merchants/diamond.txt b/npc/re/merchants/diamond.txt
index 118a3d111..fa19f372d 100644
--- a/npc/re/merchants/diamond.txt
+++ b/npc/re/merchants/diamond.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Rare Diamond Merchant
//===== By: ==================================================
//= Z3R0
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Aegis Conversion]
//= Exchanges 17 Carat Diamond
diff --git a/npc/re/merchants/enchan_mal.txt b/npc/re/merchants/enchan_mal.txt
index 5caa70217..c7e182005 100644
--- a/npc/re/merchants/enchan_mal.txt
+++ b/npc/re/merchants/enchan_mal.txt
@@ -1,19 +1,19 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Malangdo Enchants
-//===== By: ==================================================
+//===== By: ==================================================
//= Muad_Dib
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.0a
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= [Official Conversion]
//= Adds enchantments to many high level weapons in exchange
//= for Malangdo coins.
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.0 First Version. [Euphy]
//= 1.0a Added 'delequip' command. [Euphy]
-//============================================================
+//============================================================
malangdo,213,167,4 script Mayomayo#mal 555,{
disable_items;
diff --git a/npc/re/merchants/enchan_mora.txt b/npc/re/merchants/enchan_mora.txt
new file mode 100644
index 000000000..8ff8f758d
--- /dev/null
+++ b/npc/re/merchants/enchan_mora.txt
@@ -0,0 +1,2356 @@
+//===== rAthena Script =======================================
+//= Mora Enchants
+//===== By: ==================================================
+//= Euphy
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= rAthena SVN
+//===== Description: =========================================
+//= [Official Conversion]
+//= Adds enchantments to various items in exchange for
+//= Mora coins.
+//===== Additional Comments: =================================
+//= 1.0 First Version. [Euphy]
+//============================================================
+
+// Arch Bishop Enchants :: coin_arc
+//============================================================
+mora,88,89,5 script Keeper of Secrets#pa082 495,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ disable_items;
+ if (countitem(6380) < 10) {
+ mes "[Artifice]";
+ mes "Relics for Archbishops are meant for defense and support!";
+ next;
+ mes "[Artifice]";
+ mes "Like the other Guardians, they may trade coins for their relics, so collect Mora Coins!";
+ next;
+ mes "[Artifice]";
+ mes "If you collect more than 10 coins then come to me to trade!";
+ close;
+ }
+ mes "[Artifice]";
+ mes "By the light! You look like you are ready to gain access to our relics.";
+ next;
+ mes "[Artifice]";
+ mes "Ring, Shoes, Shawl, Robe, Shield, or Weapon.";
+ mes "Select one of the six kinds of relics to receive.";
+ next;
+ mes "[Artifice]";
+ mes "I'll randomly give you one of 2 types of the equipment, depending upon the weather and my mood.";
+ next;
+ mes "[Artifice]";
+ mes "All I need is 10 Mora Coins of yours to grant you a relic!";
+ next;
+ switch(select("I don't think I'm ready.:I'm ready to exchange my Mora Coins.:Exchange my Ring.")) {
+ case 1:
+ mes "[Artifice]";
+ mes "See you next time!";
+ close;
+ case 2:
+ mes "[Artifice]";
+ // What does this even mean? (custom dialogue below)
+ //mes "You influence what part are you?";
+ mes "What kind of relic do you want?";
+ next;
+ switch(select("I'm not ready.:Ring:Shoes:Shawl:Robe:Shield:Weapon")) {
+ case 1:
+ mes "[Artifice]";
+ mes "Go with the light.";
+ close;
+ case 2:
+ if (countitem(2864) || countitem(2865) || countitem(2866)) {
+ mes "[Artifice]";
+ mes "You are already allowed access to our relics by your possession of a Ring!";
+ close;
+ }
+ if (Class == Job_Arch_Bishop || Class == Job_Arch_Bishop_T || Class == Job_Baby_Bishop) {
+ setarray .@items[0],2864,2865,2866; //Light_Of_Cure,Seal_Of_Cathedral,Ring_Of_Archbishop
+ break;
+ } else {
+ mes "[Artifice]";
+ mes "We prefer to only deal with Arch-Bishops.";
+ close;
+ }
+ case 3:
+ setarray .@items[0],2471,2472; //Shoes_Of_Affection,Shoes_Of_Judgement
+ break;
+ case 4:
+ setarray .@items[0],2569,2570; //Shawl_Of_Affection,Shawl_Of_Judgement
+ break;
+ case 5:
+ setarray .@items[0],15029,15030; //Robe_Of_Affection,Robe_Of_Judgement
+ break;
+ case 6:
+ setarray .@items[0],2156; //Bible_Of_Promise1
+ break;
+ case 7:
+ setarray .@items[0],1657,16013; //Wand_Of_Affection,Mace_Of_Judgement
+ break;
+ }
+ set .@item, .@items[rand(getarraysize(.@items))];
+ delitem 6380,10; //Mora_Coin
+ getitem .@item,1;
+ mes "[Artifice]";
+ mes "You have obtained ^aa00aa"+getitemname(.@item)+"^000000. May the Blessing of the Light be with you.";
+ close;
+ case 3:
+ if (Class == Job_Arch_Bishop || Class == Job_Arch_Bishop_T || Class == Job_Baby_Bishop) {
+ mes "[Artifice]";
+ mes "We exchange rings into coins for those who cannot control the ring.";
+ next;
+ mes "[Artifice]";
+ mes "It seems that you have power to control the ring so I cannot exchange it into coins.";
+ close;
+ }
+ if (countitem(2864)) set .@item,2864; //Light_Of_Cure
+ else if (countitem(2865)) set .@item,2865; //Seal_Of_Cathedral
+ else if (countitem(2866)) set .@item,2866; //Ring_Of_Archbishop
+ else {
+ mes "[Artifice]";
+ mes "Did you change something?";
+ close;
+ }
+ mes "[Artifice]";
+ mes "You have a "+getitemname(.@item)+". Do you really want to trade it for 10 Mora Coins?";
+ next;
+ switch(select("I'm not ready:Exchange my "+getitemname(.@item))) {
+ case 1:
+ mes "[Artifice]";
+ mes "If you change your mind, please stop by again.";
+ close;
+ case 2:
+ delitem .@item,1;
+ getitem 6380,10; //Mora_Coin
+ mes "[Artifice]";
+ mes "I think that was an even trade.";
+ close;
+ }
+ }
+}
+
+mora,96,74,5 script Master of Relics#pa0829 495,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ disable_items;
+ mes "[Relice]";
+ mes "I enhance Relics that holy Arch-Bishops use, it will take 2 Mora Coins and the relic to allow me to attempt to enhance it.";
+ next;
+ switch(select("More details please.:Please Enhance my Relic.")) {
+ case 1:
+ mes "[Relice]";
+ mes "Let me briefly explain, for 2 Mora Coins and the relic I can give you a single Enchantment on that relic.";
+ next;
+ mes "[Relice]";
+ mes "Even though this relic was already enchanted, we will re-enchant it without checking its status.";
+ next;
+ mes "[Relice]";
+ mes "So it you have already enchanted relic, please put it some place safe and come back.";
+ next;
+ mes "[Relice]";
+ mes "Ah, one more thing! It is possible I can fail though and if that happens the relic is lost forever.";
+ close;
+ case 2:
+ mes "[Relice]";
+ mes "Ok, you can get a new Relic from Artifice if it fails.";
+ next;
+ mes "[Relice]";
+ mes "If you have a ritual for luck, you should use it now!";
+ next;
+ set .@select, select("Wait a minute!:Light of Cure:Seal of Cathedral:Ring of Archbishop:Shoes of Affection:Shoes of Judgement:Shawl of Affection:Shawl of Judgement:Robe of Affection:Robe of Judgement:Bible of Promise 1st Vol:Wand of Affection:Mace of Judgement");
+ switch(.@select) {
+ case 1:
+ mes "[Relice]";
+ mes "Certainly. Go with the Light.";
+ close;
+ case 2:
+ case 3:
+ case 4:
+ setarray .@items[0],2864,2865,2866; //Light_Of_Cure,Seal_Of_Cathedral,Ring_Of_Archbishop
+ setarray .@special[0],4803,4804,4805; //Highness_Heal_3sec,Coluceo_Heal30,Heal_Amount2
+ set .@item, .@items[.@select-2];
+ set .@sp, .@special[.@select-2];
+ set .@enchant_type,1;
+ break;
+ case 5:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ setarray .@items[0],2471,2472,2569,2570,15029,15030,2156; //Shoes_Of_Affection,Shoes_Of_Judgement,Shawl_Of_Affection,Shawl_Of_Judgement,Robe_Of_Affection,Robe_Of_Judgement,Bible_Of_Promise1
+ set .@item, .@items[.@select-5];
+ set .@enchant_type,2;
+ break;
+ case 12:
+ set .@item,1657; //Wand_Of_Affection
+ set .@enchant_type,3;
+ break;
+ case 13:
+ set .@item,16013; //Mace_Of_Judgement
+ set .@enchant_type,4;
+ break;
+ }
+ if (countitem(6380) < 2 || countitem(.@item) == 0) {
+ mes "[Relice]";
+ mes "For 2 Mora Coins I can strengthen the relic you have in many ways!";
+ close;
+ }
+ specialeffect2 EF_REPAIRWEAPON;
+ delitem 6380,2; //Mora_Coin
+ delitem .@item,1;
+ switch(.@enchant_type) {
+ case 1:
+ set .@i, rand(1,1487);
+ if (.@i <= 16) setarray .@enchants[2],4710,.@sp; //Inteligence2 [sp]
+ else if (.@i <= 32) setarray .@enchants[2],4710,4799; //Inteligence2 HP500
+ else if (.@i <= 48) setarray .@enchants[2],4710,4766; //Inteligence2 Atk2
+ else if (.@i <= 64) setarray .@enchants[2],4710,4788; //Inteligence2 Mdef6
+ else if (.@i <= 80) setarray .@enchants[2],4720,.@sp; //Dexterity1 [sp]
+ else if (.@i <= 96) setarray .@enchants[2],4720,4799; //Dexterity1 HP500
+ else if (.@i <= 112) setarray .@enchants[2],4720,4766; //Dexterity1 Atk2
+ else if (.@i <= 128) setarray .@enchants[2],4720,4788; //Dexterity1 Mdef6
+ else if (.@i <= 144) setarray .@enchants[2],4721,.@sp; //Dexterity2 [sp]
+ else if (.@i <= 160) setarray .@enchants[2],4721,4799; //Dexterity2 HP500
+ else if (.@i <= 176) setarray .@enchants[2],4721,4766; //Dexterity2 Atk2
+ else if (.@i <= 192) setarray .@enchants[2],4721,4788; //Dexterity2 Mdef6
+ else if (.@i <= 208) setarray .@enchants[2],4740,.@sp; //Vitality1 [sp]
+ else if (.@i <= 224) setarray .@enchants[2],4740,4799; //Vitality1 HP500
+ else if (.@i <= 240) setarray .@enchants[2],4740,4766; //Vitality1 Atk2
+ else if (.@i <= 256) setarray .@enchants[2],4740,4788; //Vitality1 Mdef6
+ else if (.@i <= 272) setarray .@enchants[2],4710,.@sp; //Inteligence2 [sp]
+ else if (.@i <= 288) setarray .@enchants[2],4710,4799; //Inteligence2 HP500
+ else if (.@i <= 304) setarray .@enchants[2],4710,4766; //Inteligence2 Atk2
+ else if (.@i <= 320) setarray .@enchants[2],4710,4788; //Inteligence2 Mdef6
+ else if (.@i <= 336) setarray .@enchants[2],4720,.@sp; //Dexterity1 [sp]
+ else if (.@i <= 352) setarray .@enchants[2],4720,4799; //Dexterity1 HP500
+ else if (.@i <= 368) setarray .@enchants[2],4720,4766; //Dexterity1 Atk2
+ else if (.@i <= 384) setarray .@enchants[2],4720,4788; //Dexterity1 Mdef6
+ else if (.@i <= 400) setarray .@enchants[2],4721,.@sp; //Dexterity2 [sp]
+ else if (.@i <= 416) setarray .@enchants[2],4721,4799; //Dexterity2 HP500
+ else if (.@i <= 432) setarray .@enchants[2],4721,4766; //Dexterity2 Atk2
+ else if (.@i <= 448) setarray .@enchants[2],4721,4788; //Dexterity2 Mdef6
+ else if (.@i <= 464) setarray .@enchants[2],4740,.@sp; //Vitality1 [sp]
+ else if (.@i <= 480) setarray .@enchants[2],4740,4799; //Vitality1 HP500
+ else if (.@i <= 496) setarray .@enchants[2],4740,4766; //Vitality1 Atk2
+ else if (.@i <= 512) setarray .@enchants[2],4740,4788; //Vitality1 Mdef6
+ else if (.@i <= 528) setarray .@enchants[2],4710,.@sp; //Inteligence2 [sp]
+ else if (.@i <= 544) setarray .@enchants[2],4710,4799; //Inteligence2 HP500
+ else if (.@i <= 560) setarray .@enchants[2],4710,4766; //Inteligence2 Atk2
+ else if (.@i <= 576) setarray .@enchants[2],4710,4788; //Inteligence2 Mdef6
+ else if (.@i <= 592) setarray .@enchants[2],4720,.@sp; //Dexterity1 [sp]
+ else if (.@i <= 608) setarray .@enchants[2],4720,4799; //Dexterity1 HP500
+ else if (.@i <= 624) setarray .@enchants[2],4720,4766; //Dexterity1 Atk2
+ else if (.@i <= 640) setarray .@enchants[2],4720,4788; //Dexterity1 Mdef6
+ else if (.@i <= 656) setarray .@enchants[2],4721,.@sp; //Dexterity2 [sp]
+ else if (.@i <= 672) setarray .@enchants[2],4721,4799; //Dexterity2 HP500
+ else if (.@i <= 688) setarray .@enchants[2],4721,4766; //Dexterity2 Atk2
+ else if (.@i <= 704) setarray .@enchants[2],4721,4788; //Dexterity2 Mdef6
+ else if (.@i <= 720) setarray .@enchants[2],4740,.@sp; //Vitality1 [sp]
+ else if (.@i <= 736) setarray .@enchants[2],4740,4799; //Vitality1 HP500
+ else if (.@i <= 752) setarray .@enchants[2],4740,4766; //Vitality1 Atk2
+ else if (.@i <= 768) setarray .@enchants[2],4740,4788; //Vitality1 Mdef6
+ else if (.@i <= 784) setarray .@enchants[2],4710,.@sp; //Inteligence2 [sp]
+ else if (.@i <= 800) setarray .@enchants[2],4710,4799; //Inteligence2 HP500
+ else if (.@i <= 816) setarray .@enchants[2],4710,4766; //Inteligence2 Atk2
+ else if (.@i <= 832) setarray .@enchants[2],4710,4788; //Inteligence2 Mdef6
+ else if (.@i <= 848) setarray .@enchants[2],4720,.@sp; //Dexterity1 [sp]
+ else if (.@i <= 864) setarray .@enchants[2],4720,4799; //Dexterity1 HP500
+ else if (.@i <= 880) setarray .@enchants[2],4720,4766; //Dexterity1 Atk2
+ else if (.@i <= 896) setarray .@enchants[2],4720,4788; //Dexterity1 Mdef6
+ else if (.@i <= 912) setarray .@enchants[2],4721,.@sp; //Dexterity2 [sp]
+ else if (.@i <= 928) setarray .@enchants[2],4721,4799; //Dexterity2 HP500
+ else if (.@i <= 944) setarray .@enchants[2],4721,4766; //Dexterity2 Atk2
+ else if (.@i <= 960) setarray .@enchants[2],4721,4788; //Dexterity2 Mdef6
+ else if (.@i <= 976) setarray .@enchants[2],4740,.@sp; //Vitality1 [sp]
+ else if (.@i <= 992) setarray .@enchants[2],4740,4799; //Vitality1 HP500
+ else if (.@i <= 1008) setarray .@enchants[2],4740,4766; //Vitality1 Atk2
+ else if (.@i <= 1024) setarray .@enchants[2],4740,4788; //Vitality1 Mdef6
+ else if (.@i <= 1040) setarray .@enchants[2],.@sp,.@sp; //[sp] [sp]
+ else if (.@i <= 1487) {
+ mes "[Relice]";
+ mes "Sometimes things just don't work out the way you want. I hope next time things go better for you. Until then, good bye.";
+ close;
+ }
+ break;
+ case 2:
+ set .@i, rand(1,1487);
+ if (.@i <= 16) setarray .@enchants[1],4710,4711,4764; //Inteligence1 Inteligence2 Critical5
+ else if (.@i <= 32) setarray .@enchants[1],4710,4711,4799; //Inteligence1 Inteligence2 HP500
+ else if (.@i <= 48) setarray .@enchants[1],4710,4711,4766; //Inteligence1 Inteligence2 Atk2
+ else if (.@i <= 64) setarray .@enchants[1],4710,4711,4788; //Inteligence1 Inteligence2 Mdef6
+ else if (.@i <= 80) setarray .@enchants[1],4710,4720,4764; //Inteligence1 Dexterity1 Critical5
+ else if (.@i <= 96) setarray .@enchants[1],4710,4720,4799; //Inteligence1 Dexterity1 HP500
+ else if (.@i <= 112) setarray .@enchants[1],4710,4720,4766; //Inteligence1 Dexterity1 Atk2
+ else if (.@i <= 128) setarray .@enchants[1],4710,4720,4788; //Inteligence1 Dexterity1 Mdef6
+ else if (.@i <= 144) setarray .@enchants[1],4710,4721,4764; //Inteligence1 Dexterity2 Critical5
+ else if (.@i <= 160) setarray .@enchants[1],4710,4721,4799; //Inteligence1 Dexterity2 HP500
+ else if (.@i <= 176) setarray .@enchants[1],4710,4721,4766; //Inteligence1 Dexterity2 Atk2
+ else if (.@i <= 192) setarray .@enchants[1],4710,4721,4788; //Inteligence1 Dexterity2 Mdef6
+ else if (.@i <= 208) setarray .@enchants[1],4710,4740,4764; //Inteligence1 Vitality1 Critical5
+ else if (.@i <= 224) setarray .@enchants[1],4710,4740,4799; //Inteligence1 Vitality1 HP500
+ else if (.@i <= 240) setarray .@enchants[1],4710,4740,4766; //Inteligence1 Vitality1 Atk2
+ else if (.@i <= 256) setarray .@enchants[1],4710,4740,4788; //Inteligence1 Vitality1 Mdef6
+ else if (.@i <= 272) setarray .@enchants[1],4711,4711,4764; //Inteligence2 Inteligence2 Critical5
+ else if (.@i <= 288) setarray .@enchants[1],4711,4711,4799; //Inteligence2 Inteligence2 HP500
+ else if (.@i <= 304) setarray .@enchants[1],4711,4711,4766; //Inteligence2 Inteligence2 Atk2
+ else if (.@i <= 320) setarray .@enchants[1],4711,4711,4788; //Inteligence2 Inteligence2 Mdef6
+ else if (.@i <= 336) setarray .@enchants[1],4711,4720,4764; //Inteligence2 Dexterity1 Critical5
+ else if (.@i <= 352) setarray .@enchants[1],4711,4720,4799; //Inteligence2 Dexterity1 HP500
+ else if (.@i <= 368) setarray .@enchants[1],4711,4720,4766; //Inteligence2 Dexterity1 Atk2
+ else if (.@i <= 384) setarray .@enchants[1],4711,4720,4788; //Inteligence2 Dexterity1 Mdef6
+ else if (.@i <= 400) setarray .@enchants[1],4711,4721,4764; //Inteligence2 Dexterity2 Critical5
+ else if (.@i <= 416) setarray .@enchants[1],4711,4721,4799; //Inteligence2 Dexterity2 HP500
+ else if (.@i <= 432) setarray .@enchants[1],4711,4721,4766; //Inteligence2 Dexterity2 Atk2
+ else if (.@i <= 448) setarray .@enchants[1],4711,4721,4788; //Inteligence2 Dexterity2 Mdef6
+ else if (.@i <= 464) setarray .@enchants[1],4711,4740,4764; //Inteligence2 Vitality1 Critical5
+ else if (.@i <= 480) setarray .@enchants[1],4711,4740,4799; //Inteligence2 Vitality1 HP500
+ else if (.@i <= 496) setarray .@enchants[1],4711,4740,4766; //Inteligence2 Vitality1 Atk2
+ else if (.@i <= 512) setarray .@enchants[1],4711,4740,4788; //Inteligence2 Vitality1 Mdef6
+ else if (.@i <= 528) setarray .@enchants[1],4720,4711,4764; //Dexterity1 Inteligence2 Critical5
+ else if (.@i <= 544) setarray .@enchants[1],4720,4711,4799; //Dexterity1 Inteligence2 HP500
+ else if (.@i <= 560) setarray .@enchants[1],4720,4711,4766; //Dexterity1 Inteligence2 Atk2
+ else if (.@i <= 576) setarray .@enchants[1],4720,4711,4788; //Dexterity1 Inteligence2 Mdef6
+ else if (.@i <= 592) setarray .@enchants[1],4720,4720,4764; //Dexterity1 Dexterity1 Critical5
+ else if (.@i <= 608) setarray .@enchants[1],4720,4720,4799; //Dexterity1 Dexterity1 HP500
+ else if (.@i <= 624) setarray .@enchants[1],4720,4720,4766; //Dexterity1 Dexterity1 Atk2
+ else if (.@i <= 640) setarray .@enchants[1],4720,4720,4788; //Dexterity1 Dexterity1 Mdef6
+ else if (.@i <= 656) setarray .@enchants[1],4720,4721,4764; //Dexterity1 Dexterity2 Critical5
+ else if (.@i <= 672) setarray .@enchants[1],4720,4721,4799; //Dexterity1 Dexterity2 HP500
+ else if (.@i <= 688) setarray .@enchants[1],4720,4721,4766; //Dexterity1 Dexterity2 Atk2
+ else if (.@i <= 704) setarray .@enchants[1],4720,4721,4788; //Dexterity1 Dexterity2 Mdef6
+ else if (.@i <= 720) setarray .@enchants[1],4720,4740,4764; //Dexterity1 Vitality1 Critical5
+ else if (.@i <= 736) setarray .@enchants[1],4720,4740,4799; //Dexterity1 Vitality1 HP500
+ else if (.@i <= 752) setarray .@enchants[1],4720,4740,4766; //Dexterity1 Vitality1 Atk2
+ else if (.@i <= 768) setarray .@enchants[1],4720,4740,4788; //Dexterity1 Vitality1 Mdef6
+ else if (.@i <= 784) setarray .@enchants[1],4721,4711,4764; //Dexterity2 Inteligence2 Critical5
+ else if (.@i <= 800) setarray .@enchants[1],4721,4711,4799; //Dexterity2 Inteligence2 HP500
+ else if (.@i <= 816) setarray .@enchants[1],4721,4711,4766; //Dexterity2 Inteligence2 Atk2
+ else if (.@i <= 832) setarray .@enchants[1],4721,4711,4788; //Dexterity2 Inteligence2 Mdef6
+ else if (.@i <= 848) setarray .@enchants[1],4721,4720,4764; //Dexterity2 Dexterity1 Critical5
+ else if (.@i <= 864) setarray .@enchants[1],4721,4720,4799; //Dexterity2 Dexterity1 HP500
+ else if (.@i <= 880) setarray .@enchants[1],4721,4720,4766; //Dexterity2 Dexterity1 Atk2
+ else if (.@i <= 896) setarray .@enchants[1],4721,4720,4788; //Dexterity2 Dexterity1 Mdef6
+ else if (.@i <= 912) setarray .@enchants[1],4721,4721,4764; //Dexterity2 Dexterity2 Critical5
+ else if (.@i <= 928) setarray .@enchants[1],4721,4721,4799; //Dexterity2 Dexterity2 HP500
+ else if (.@i <= 944) setarray .@enchants[1],4721,4721,4766; //Dexterity2 Dexterity2 Atk2
+ else if (.@i <= 960) setarray .@enchants[1],4721,4721,4788; //Dexterity2 Dexterity2 Mdef6
+ else if (.@i <= 976) setarray .@enchants[1],4721,4740,4764; //Dexterity2 Vitality1 Critical5
+ else if (.@i <= 992) setarray .@enchants[1],4721,4740,4799; //Dexterity2 Vitality1 HP500
+ else if (.@i <= 1008) setarray .@enchants[1],4721,4740,4766; //Dexterity2 Vitality1 Atk2
+ else if (.@i <= 1024) setarray .@enchants[1],4721,4740,4788; //Dexterity2 Vitality1 Mdef6
+ else if (.@i <= 1026) setarray .@enchants[1],4761,4761,4761; //Matk2 Matk2 Matk2
+ else if (.@i <= 1028) setarray .@enchants[1],4712,4713,4713; //Inteligence3 Inteligence4 Inteligence4
+ else if (.@i <= 1030) setarray .@enchants[1],4712,4761,4761; //Inteligence3 Matk2 Matk2
+ else if (.@i <= 1032) setarray .@enchants[1],4712,4713,4761; //Inteligence3 Inteligence4 Matk2
+ else if (.@i <= 1034) setarray .@enchants[1],4722,4723,4723; //Dexterity3 Dexterity4 Dexterity4
+ else if (.@i <= 1036) setarray .@enchants[1],4722,4703,4703; //Dexterity3 Strength4 Strength4
+ else if (.@i <= 1038) setarray .@enchants[1],4722,4767,4767; //Dexterity3 Atk3 Atk3
+ else if (.@i <= 1040) setarray .@enchants[1],4767,4767,4767; //Atk3 Atk3 Atk3
+ else if (.@i <= 1487) {
+ mes "[Relice]";
+ mes "Sometimes things just don't work out the way you want. I hope next time things go better for you. Until then, good bye.";
+ close;
+ }
+ break;
+ case 3:
+ set .@i, rand(1,2852);
+ if (.@i <= 31) setarray .@enchants[2],4720,4710; //Dexterity1 Inteligence1
+ else if (.@i <= 62) setarray .@enchants[2],4720,4711; //Dexterity1 Inteligence2
+ else if (.@i <= 93) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 124) setarray .@enchants[2],4720,4760; //Dexterity1 Matk1
+ else if (.@i <= 155) setarray .@enchants[2],4740,4710; //Vitality1 Inteligence1
+ else if (.@i <= 186) setarray .@enchants[2],4740,4711; //Vitality1 Inteligence2
+ else if (.@i <= 217) setarray .@enchants[2],4740,4721; //Vitality1 Dexterity2
+ else if (.@i <= 248) setarray .@enchants[2],4740,4760; //Vitality1 Matk1
+ else if (.@i <= 279) setarray .@enchants[2],4741,4710; //Vitality2 Inteligence1
+ else if (.@i <= 310) setarray .@enchants[2],4741,4711; //Vitality2 Inteligence2
+ else if (.@i <= 341) setarray .@enchants[2],4741,4721; //Vitality2 Dexterity2
+ else if (.@i <= 372) setarray .@enchants[2],4741,4760; //Vitality2 Matk1
+ else if (.@i <= 403) setarray .@enchants[2],4801,4710; //SP100 Inteligence1
+ else if (.@i <= 434) setarray .@enchants[2],4801,4711; //SP100 Inteligence2
+ else if (.@i <= 465) setarray .@enchants[2],4801,4721; //SP100 Dexterity2
+ else if (.@i <= 496) setarray .@enchants[2],4801,4760; //SP100 Matk1
+ else if (.@i <= 527) setarray .@enchants[2],4720,4710; //Dexterity1 Inteligence1
+ else if (.@i <= 558) setarray .@enchants[2],4720,4711; //Dexterity1 Inteligence2
+ else if (.@i <= 589) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 620) setarray .@enchants[2],4720,4760; //Dexterity1 Matk1
+ else if (.@i <= 651) setarray .@enchants[2],4740,4710; //Vitality1 Inteligence1
+ else if (.@i <= 682) setarray .@enchants[2],4740,4711; //Vitality1 Inteligence2
+ else if (.@i <= 713) setarray .@enchants[2],4740,4721; //Vitality1 Dexterity2
+ else if (.@i <= 744) setarray .@enchants[2],4740,4760; //Vitality1 Matk1
+ else if (.@i <= 775) setarray .@enchants[2],4741,4710; //Vitality2 Inteligence1
+ else if (.@i <= 806) setarray .@enchants[2],4741,4711; //Vitality2 Inteligence2
+ else if (.@i <= 837) setarray .@enchants[2],4741,4721; //Vitality2 Dexterity2
+ else if (.@i <= 868) setarray .@enchants[2],4741,4760; //Vitality2 Matk1
+ else if (.@i <= 899) setarray .@enchants[2],4801,4710; //SP100 Inteligence1
+ else if (.@i <= 930) setarray .@enchants[2],4801,4711; //SP100 Inteligence2
+ else if (.@i <= 961) setarray .@enchants[2],4801,4721; //SP100 Dexterity2
+ else if (.@i <= 992) setarray .@enchants[2],4801,4760; //SP100 Matk1
+ else if (.@i <= 1023) setarray .@enchants[2],4720,4710; //Dexterity1 Inteligence1
+ else if (.@i <= 1054) setarray .@enchants[2],4720,4711; //Dexterity1 Inteligence2
+ else if (.@i <= 1085) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 1116) setarray .@enchants[2],4720,4760; //Dexterity1 Matk1
+ else if (.@i <= 1147) setarray .@enchants[2],4740,4710; //Vitality1 Inteligence1
+ else if (.@i <= 1178) setarray .@enchants[2],4740,4711; //Vitality1 Inteligence2
+ else if (.@i <= 1209) setarray .@enchants[2],4740,4721; //Vitality1 Dexterity2
+ else if (.@i <= 1240) setarray .@enchants[2],4740,4760; //Vitality1 Matk1
+ else if (.@i <= 1271) setarray .@enchants[2],4741,4710; //Vitality2 Inteligence1
+ else if (.@i <= 1302) setarray .@enchants[2],4741,4711; //Vitality2 Inteligence2
+ else if (.@i <= 1333) setarray .@enchants[2],4741,4721; //Vitality2 Dexterity2
+ else if (.@i <= 1364) setarray .@enchants[2],4741,4760; //Vitality2 Matk1
+ else if (.@i <= 1395) setarray .@enchants[2],4801,4710; //SP100 Inteligence1
+ else if (.@i <= 1426) setarray .@enchants[2],4801,4711; //SP100 Inteligence2
+ else if (.@i <= 1457) setarray .@enchants[2],4801,4721; //SP100 Dexterity2
+ else if (.@i <= 1488) setarray .@enchants[2],4801,4760; //SP100 Matk1
+ else if (.@i <= 1519) setarray .@enchants[2],4720,4710; //Dexterity1 Inteligence1
+ else if (.@i <= 1550) setarray .@enchants[2],4720,4711; //Dexterity1 Inteligence2
+ else if (.@i <= 1581) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 1612) setarray .@enchants[2],4720,4760; //Dexterity1 Matk1
+ else if (.@i <= 1643) setarray .@enchants[2],4740,4710; //Vitality1 Inteligence1
+ else if (.@i <= 1674) setarray .@enchants[2],4740,4711; //Vitality1 Inteligence2
+ else if (.@i <= 1705) setarray .@enchants[2],4740,4721; //Vitality1 Dexterity2
+ else if (.@i <= 1736) setarray .@enchants[2],4740,4760; //Vitality1 Matk1
+ else if (.@i <= 1767) setarray .@enchants[2],4741,4710; //Vitality2 Inteligence1
+ else if (.@i <= 1798) setarray .@enchants[2],4741,4711; //Vitality2 Inteligence2
+ else if (.@i <= 1829) setarray .@enchants[2],4741,4721; //Vitality2 Dexterity2
+ else if (.@i <= 1860) setarray .@enchants[2],4741,4760; //Vitality2 Matk1
+ else if (.@i <= 1891) setarray .@enchants[2],4801,4710; //SP100 Inteligence1
+ else if (.@i <= 1922) setarray .@enchants[2],4801,4711; //SP100 Inteligence2
+ else if (.@i <= 1953) setarray .@enchants[2],4801,4721; //SP100 Dexterity2
+ else if (.@i <= 1984) setarray .@enchants[2],4801,4760; //SP100 Matk1
+ else if (.@i <= 1986) setarray .@enchants[2],4761,4761; //Matk2 Matk2
+ else if (.@i <= 1988) setarray .@enchants[2],4761,4723; //Matk2 Dexterity4
+ else if (.@i <= 1990) setarray .@enchants[2],4761,4714; //Matk2 Inteligence5
+ else if (.@i <= 1992) setarray .@enchants[2],4714,4714; //Inteligence5 Inteligence5
+ else if (.@i <= 1994) setarray .@enchants[2],4714,4723; //Inteligence5 Dexterity4
+ else if (.@i <= 1996) setarray .@enchants[2],4723,4723; //Dexterity4 Dexterity4
+ else if (.@i <= 2852) {
+ mes "[Relice]";
+ mes "Sometimes things just don't work out the way you want. I hope next time things go better for you. Until then, good bye.";
+ close;
+ }
+ break;
+ case 4:
+ set .@i, rand(1,2852);
+ if (.@i <= 31) setarray .@enchants[2],4720,4700; //Dexterity1 Strength1
+ else if (.@i <= 62) setarray .@enchants[2],4720,4701; //Dexterity1 Strength2
+ else if (.@i <= 93) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 124) setarray .@enchants[2],4720,4767; //Dexterity1 Atk3
+ else if (.@i <= 155) setarray .@enchants[2],4740,4700; //Vitality1 Strength1
+ else if (.@i <= 186) setarray .@enchants[2],4740,4701; //Vitality1 Strength2
+ else if (.@i <= 217) setarray .@enchants[2],4740,4721; //Vitality1 Dexterity2
+ else if (.@i <= 248) setarray .@enchants[2],4740,4767; //Vitality1 Atk3
+ else if (.@i <= 279) setarray .@enchants[2],4741,4700; //Vitality2 Strength1
+ else if (.@i <= 310) setarray .@enchants[2],4741,4701; //Vitality2 Strength2
+ else if (.@i <= 341) setarray .@enchants[2],4741,4721; //Vitality2 Dexterity2
+ else if (.@i <= 372) setarray .@enchants[2],4741,4767; //Vitality2 Atk3
+ else if (.@i <= 403) setarray .@enchants[2],4701,4700; //Strength2 Strength1
+ else if (.@i <= 434) setarray .@enchants[2],4701,4701; //Strength2 Strength2
+ else if (.@i <= 465) setarray .@enchants[2],4701,4721; //Strength2 Dexterity2
+ else if (.@i <= 496) setarray .@enchants[2],4701,4767; //Strength2 Atk3
+ else if (.@i <= 527) setarray .@enchants[2],4720,4700; //Dexterity1 Strength1
+ else if (.@i <= 558) setarray .@enchants[2],4720,4701; //Dexterity1 Strength2
+ else if (.@i <= 589) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 620) setarray .@enchants[2],4720,4767; //Dexterity1 Atk3
+ else if (.@i <= 651) setarray .@enchants[2],4740,4700; //Vitality1 Strength1
+ else if (.@i <= 682) setarray .@enchants[2],4740,4701; //Vitality1 Strength2
+ else if (.@i <= 713) setarray .@enchants[2],4740,4721; //Vitality1 Dexterity2
+ else if (.@i <= 744) setarray .@enchants[2],4740,4767; //Vitality1 Atk3
+ else if (.@i <= 775) setarray .@enchants[2],4741,4700; //Vitality2 Strength1
+ else if (.@i <= 806) setarray .@enchants[2],4741,4701; //Vitality2 Strength2
+ else if (.@i <= 837) setarray .@enchants[2],4741,4721; //Vitality2 Dexterity2
+ else if (.@i <= 868) setarray .@enchants[2],4741,4767; //Vitality2 Atk3
+ else if (.@i <= 899) setarray .@enchants[2],4701,4700; //Strength2 Strength1
+ else if (.@i <= 930) setarray .@enchants[2],4701,4701; //Strength2 Strength2
+ else if (.@i <= 961) setarray .@enchants[2],4701,4721; //Strength2 Dexterity2
+ else if (.@i <= 992) setarray .@enchants[2],4701,4767; //Strength2 Atk3
+ else if (.@i <= 1023) setarray .@enchants[2],4720,4700; //Dexterity1 Strength1
+ else if (.@i <= 1054) setarray .@enchants[2],4720,4701; //Dexterity1 Strength2
+ else if (.@i <= 1085) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 1116) setarray .@enchants[2],4720,4767; //Dexterity1 Atk3
+ else if (.@i <= 1147) setarray .@enchants[2],4740,4700; //Vitality1 Strength1
+ else if (.@i <= 1178) setarray .@enchants[2],4740,4701; //Vitality1 Strength2
+ else if (.@i <= 1209) setarray .@enchants[2],4740,4721; //Vitality1 Dexterity2
+ else if (.@i <= 1240) setarray .@enchants[2],4740,4767; //Vitality1 Atk3
+ else if (.@i <= 1271) setarray .@enchants[2],4741,4700; //Vitality2 Strength1
+ else if (.@i <= 1302) setarray .@enchants[2],4741,4701; //Vitality2 Strength2
+ else if (.@i <= 1333) setarray .@enchants[2],4741,4721; //Vitality2 Dexterity2
+ else if (.@i <= 1364) setarray .@enchants[2],4741,4767; //Vitality2 Atk3
+ else if (.@i <= 1395) setarray .@enchants[2],4701,4700; //Strength2 Strength1
+ else if (.@i <= 1426) setarray .@enchants[2],4701,4701; //Strength2 Strength2
+ else if (.@i <= 1457) setarray .@enchants[2],4701,4721; //Strength2 Dexterity2
+ else if (.@i <= 1488) setarray .@enchants[2],4701,4767; //Strength2 Atk3
+ else if (.@i <= 1519) setarray .@enchants[2],4720,4700; //Dexterity1 Strength1
+ else if (.@i <= 1550) setarray .@enchants[2],4720,4701; //Dexterity1 Strength2
+ else if (.@i <= 1581) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 1612) setarray .@enchants[2],4720,4767; //Dexterity1 Atk3
+ else if (.@i <= 1643) setarray .@enchants[2],4740,4700; //Vitality1 Strength1
+ else if (.@i <= 1674) setarray .@enchants[2],4740,4701; //Vitality1 Strength2
+ else if (.@i <= 1705) setarray .@enchants[2],4740,4721; //Vitality1 Dexterity2
+ else if (.@i <= 1736) setarray .@enchants[2],4740,4767; //Vitality1 Atk3
+ else if (.@i <= 1767) setarray .@enchants[2],4741,4700; //Vitality2 Strength1
+ else if (.@i <= 1798) setarray .@enchants[2],4741,4701; //Vitality2 Strength2
+ else if (.@i <= 1829) setarray .@enchants[2],4741,4721; //Vitality2 Dexterity2
+ else if (.@i <= 1860) setarray .@enchants[2],4741,4767; //Vitality2 Atk3
+ else if (.@i <= 1891) setarray .@enchants[2],4701,4700; //Strength2 Strength1
+ else if (.@i <= 1922) setarray .@enchants[2],4701,4701; //Strength2 Strength2
+ else if (.@i <= 1953) setarray .@enchants[2],4701,4721; //Strength2 Dexterity2
+ else if (.@i <= 1984) setarray .@enchants[2],4701,4767; //Strength2 Atk3
+ else if (.@i <= 1986) setarray .@enchants[2],4767,4767; //Atk3 Atk3
+ else if (.@i <= 1988) setarray .@enchants[2],4767,4723; //Atk3 Dexterity4
+ else if (.@i <= 1990) setarray .@enchants[2],4767,4704; //Atk3 Strength5
+ else if (.@i <= 1992) setarray .@enchants[2],4704,4704; //Strength5 Strength5
+ else if (.@i <= 1994) setarray .@enchants[2],4704,4723; //Strength5 Dexterity4
+ else if (.@i <= 1996) setarray .@enchants[2],4723,4723; //Dexterity4 Dexterity4
+ else if (.@i <= 2852) {
+ mes "[Relice]";
+ mes "Sometimes things just don't work out the way you want. I hope next time things go better for you. Until then, good bye.";
+ close;
+ }
+ break;
+ }
+ getitem2 .@item,1,1,0,0,0,.@enchants[1],.@enchants[2],.@enchants[3];
+ mes "[Relice]";
+ mes "The strengthening went well, lucky you!";
+ close;
+ }
+}
+
+// Warlock Enchants :: coin_warrock
+//============================================================
+mora,104,76,4 script Guardian of Artifacts#p 495,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ if (countitem(6380) < 10) {
+ mes "[Guardian of Artifacts]";
+ mes "My job is to guard the Warlock's ancient artifacts.";
+ next;
+ mes "[Guardian of Artifacts]";
+ mes "Well, it's not a big deal actually. I give out artifacts to those who deserve them for the price of a few Mora Coins.";
+ next;
+ mes "[Guardian of Artifacts]";
+ mes "You can trade with me when you have 10 or more Coins. See you later.";
+ close;
+ }
+ mes "[Guardian of Artifacts]";
+ mes "Wow~ I see you're ready for the Warlock's Ancient Artifacts.";
+ next;
+ mes "[Guardian of Artifacts]";
+ mes "You can choose from four types of items:";
+ mes "staffs, orbs, shoes, and robes.";
+ next;
+ mes "[Guardian of Artifacts]";
+ mes "There are four options available for each type, but the item available will change day to day, depending on my mood.";
+ next;
+ mes "[Guardian of Artifacts]";
+ mes "Do you want to buy an artifact with your Mora Coins?";
+ next;
+ if(select("Maybe later... I have things to do.:Yes, I do.") == 1) {
+ mes "[Guardian of Artifacts]";
+ mes "Okay, see you later then.";
+ close;
+ }
+ mes "[Guardian of Artifacts]";
+ mes "What type of item do you want to buy?";
+ next;
+ switch(select("Quit:Shoes:Orbs:Robes:Staves")) {
+ case 1:
+ mes "[Guardian of Artifacts]";
+ mes "Okay, see you later then.";
+ close;
+ case 2:
+ setarray .@items[0],2467,2468,2469,2470; //Golden_Rod_Shoes,Aqua_Shoes,Crimson_Shoes,Forest_Shoes
+ set .@plural,1;
+ break;
+ case 3:
+ setarray .@items[0],2859,2860,2861,2862; //Golden_Rod_Orb,Aqua_Orb,Crimson_Orb,Forest_Orb
+ break;
+ case 4:
+ setarray .@items[0],15025,15026,15027,15028; //Golden_Rod_Robe,Aqua_Robe,Crimson_Robe,Forest_Robe
+ break;
+ case 5:
+ setarray .@items[0],2007,2008,2009,2010; //Golden_Rod_Staff,Aqua_Staff,Crimson_Staff,Forest_Staff
+ break;
+ }
+ if (countitem(6380) < 10) {
+ mes "[Guardian of Artifacts]";
+ mes "Would you please come back when you have enough Coins?";
+ close;
+ }
+ set .@item, .@items[rand(getarraysize(.@items))];
+ delitem 6380,10; //Mora_Coin
+ getitem .@item,1;
+ mes "[Guardian of Artifacts]";
+ mes "I have ^aa00aa"+getitemname(.@item)+"^000000 available today. I hope "+((.@plural)?"they":"it")+" will come in handy...";
+ close;
+}
+
+mora,99,93,5 script Artifact Crafter#pa0829 495,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ disable_items;
+ mes "[Artifact Crafter]";
+ mes "My job is to imbue artifacts with new power. If you have enough Coins, you can have one of the following items reinforced.";
+ next;
+ if(select("Tell me more.:I want to have my item reinforced.") == 1) {
+ mes "[Artifact Crafter]";
+ mes "Let me explain. One reinforcement costs you two Coins.";
+ next;
+ set .@info_only,1;
+ }
+ mes "[Artifact Crafter]";
+ mes "And, I'll work on the item whether it's been already reinforced or not.";
+ next;
+ mes "[Artifact Crafter]";
+ mes "So if you have an artifact reinforced to your liking, put it in a safe place and come back.";
+ next;
+ mes "[Artifact Crafter]";
+ mes "And another thing, the artifact will be destroyed if the reinforcement fails. Please keep that in mind.";
+ if (.@info_only)
+ close;
+ next;
+ set .@select, select("Maybe next time.:Golden Rod Staff:Aqua Staff:Crimson Staff:Forest Staff:Golden Rod Shoes:Aqua Shoes:Crimson Shoes:Forest Shoes:Golden Rod Orb:Aqua Orb:Crimson Orb:Forest Orb:Golden Rod Robe:Aqua Robe:Crimson Robe:Forest Robe");
+ switch(.@select) {
+ case 1:
+ mes "[Artifact Crafter]";
+ mes "As you wish.";
+ close;
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ setarray .@items[0],2007,2008,2009,2010; //Golden_Rod_Staff,Aqua_Staff,Crimson_Staff,Forest_Staff
+ set .@enchant_type,1;
+ break;
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ setarray .@items[0],2467,2468,2469,2470; //Golden_Rod_Shoes,Aqua_Shoes,Crimson_Shoes,Forest_Shoes
+ set .@enchant_type,2;
+ break;
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ setarray .@items[0],2859,2860,2861,2862; //Golden_Rod_Orb,Aqua_Orb,Crimson_Orb,Forest_Orb
+ set .@enchant_type,2;
+ break;
+ case 14:
+ case 15:
+ case 16:
+ case 17:
+ setarray .@items[0],15025,15026,15027,15028; //Golden_Rod_Robe,Aqua_Robe,Crimson_Robe,Forest_Robe
+ set .@enchant_type,2;
+ break;
+ }
+ set .@item, .@items[(.@select-2)%4];
+ if (countitem(6380) == 0 || countitem(.@item) == 0) {
+ mes "[Artifact Crafter]";
+ mes "You have to have 2 Mora Coins and an item to be reinforced before I can do my work.";
+ close;
+ }
+ specialeffect2 EF_REPAIRWEAPON;
+ delitem 6380,2; //Mora_Coin
+ delitem .@item,1;
+ switch(.@enchant_type) {
+ case 1:
+ set .@i, rand(1,2847);
+ if (.@i <= 31) setarray .@enchants[2],4720,4786; //Dexterity1 Mdef2
+ else if (.@i <= 62) setarray .@enchants[2],4720,4760; //Dexterity1 Matk1
+ else if (.@i <= 93) setarray .@enchants[2],4720,4711; //Dexterity1 Inteligence2
+ else if (.@i <= 124) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 155) setarray .@enchants[2],4796,4786; //HP200 Mdef2
+ else if (.@i <= 186) setarray .@enchants[2],4796,4760; //HP200 Matk1
+ else if (.@i <= 217) setarray .@enchants[2],4796,4711; //HP200 Inteligence2
+ else if (.@i <= 248) setarray .@enchants[2],4796,4721; //HP200 Dexterity2
+ else if (.@i <= 279) setarray .@enchants[2],4710,4786; //Inteligence1 Mdef2
+ else if (.@i <= 310) setarray .@enchants[2],4710,4760; //Inteligence1 Matk1
+ else if (.@i <= 341) setarray .@enchants[2],4710,4711; //Inteligence1 Inteligence2
+ else if (.@i <= 372) setarray .@enchants[2],4710,4721; //Inteligence1 Dexterity2
+ else if (.@i <= 403) setarray .@enchants[2],4801,4786; //SP100 Mdef2
+ else if (.@i <= 434) setarray .@enchants[2],4801,4760; //SP100 Matk1
+ else if (.@i <= 465) setarray .@enchants[2],4801,4711; //SP100 Inteligence2
+ else if (.@i <= 496) setarray .@enchants[2],4801,4721; //SP100 Dexterity2
+ else if (.@i <= 527) setarray .@enchants[2],4720,4786; //Dexterity1 Mdef2
+ else if (.@i <= 558) setarray .@enchants[2],4720,4760; //Dexterity1 Matk1
+ else if (.@i <= 589) setarray .@enchants[2],4720,4711; //Dexterity1 Inteligence2
+ else if (.@i <= 620) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 651) setarray .@enchants[2],4796,4786; //HP200 Mdef2
+ else if (.@i <= 682) setarray .@enchants[2],4796,4760; //HP200 Matk1
+ else if (.@i <= 713) setarray .@enchants[2],4796,4711; //HP200 Inteligence2
+ else if (.@i <= 744) setarray .@enchants[2],4796,4721; //HP200 Dexterity2
+ else if (.@i <= 775) setarray .@enchants[2],4710,4786; //Inteligence1 Mdef2
+ else if (.@i <= 806) setarray .@enchants[2],4710,4760; //Inteligence1 Matk1
+ else if (.@i <= 837) setarray .@enchants[2],4710,4711; //Inteligence1 Inteligence2
+ else if (.@i <= 868) setarray .@enchants[2],4710,4721; //Inteligence1 Dexterity2
+ else if (.@i <= 899) setarray .@enchants[2],4801,4786; //SP100 Mdef2
+ else if (.@i <= 930) setarray .@enchants[2],4801,4760; //SP100 Matk1
+ else if (.@i <= 961) setarray .@enchants[2],4801,4711; //SP100 Inteligence2
+ else if (.@i <= 992) setarray .@enchants[2],4801,4721; //SP100 Dexterity2
+ else if (.@i <= 1023) setarray .@enchants[2],4720,4786; //Dexterity1 Mdef2
+ else if (.@i <= 1054) setarray .@enchants[2],4720,4760; //Dexterity1 Matk1
+ else if (.@i <= 1085) setarray .@enchants[2],4720,4711; //Dexterity1 Inteligence2
+ else if (.@i <= 1116) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 1147) setarray .@enchants[2],4796,4786; //HP200 Mdef2
+ else if (.@i <= 1178) setarray .@enchants[2],4796,4760; //HP200 Matk1
+ else if (.@i <= 1209) setarray .@enchants[2],4796,4711; //HP200 Inteligence2
+ else if (.@i <= 1240) setarray .@enchants[2],4796,4721; //HP200 Dexterity2
+ else if (.@i <= 1271) setarray .@enchants[2],4710,4786; //Inteligence1 Mdef2
+ else if (.@i <= 1302) setarray .@enchants[2],4710,4760; //Inteligence1 Matk1
+ else if (.@i <= 1333) setarray .@enchants[2],4710,4711; //Inteligence1 Inteligence2
+ else if (.@i <= 1364) setarray .@enchants[2],4710,4721; //Inteligence1 Dexterity2
+ else if (.@i <= 1395) setarray .@enchants[2],4801,4786; //SP100 Mdef2
+ else if (.@i <= 1426) setarray .@enchants[2],4801,4760; //SP100 Matk1
+ else if (.@i <= 1457) setarray .@enchants[2],4801,4711; //SP100 Inteligence2
+ else if (.@i <= 1488) setarray .@enchants[2],4801,4721; //SP100 Dexterity2
+ else if (.@i <= 1519) setarray .@enchants[2],4720,4786; //Dexterity1 Mdef2
+ else if (.@i <= 1550) setarray .@enchants[2],4720,4760; //Dexterity1 Matk1
+ else if (.@i <= 1581) setarray .@enchants[2],4720,4711; //Dexterity1 Inteligence2
+ else if (.@i <= 1612) setarray .@enchants[2],4720,4721; //Dexterity1 Dexterity2
+ else if (.@i <= 1643) setarray .@enchants[2],4796,4786; //HP200 Mdef2
+ else if (.@i <= 1674) setarray .@enchants[2],4796,4760; //HP200 Matk1
+ else if (.@i <= 1705) setarray .@enchants[2],4796,4711; //HP200 Inteligence2
+ else if (.@i <= 1736) setarray .@enchants[2],4796,4721; //HP200 Dexterity2
+ else if (.@i <= 1767) setarray .@enchants[2],4710,4786; //Inteligence1 Mdef2
+ else if (.@i <= 1798) setarray .@enchants[2],4710,4760; //Inteligence1 Matk1
+ else if (.@i <= 1829) setarray .@enchants[2],4710,4711; //Inteligence1 Inteligence2
+ else if (.@i <= 1860) setarray .@enchants[2],4710,4721; //Inteligence1 Dexterity2
+ else if (.@i <= 1891) setarray .@enchants[2],4801,4786; //SP100 Mdef2
+ else if (.@i <= 1922) setarray .@enchants[2],4801,4760; //SP100 Matk1
+ else if (.@i <= 1953) setarray .@enchants[2],4801,4711; //SP100 Inteligence2
+ else if (.@i <= 1984) setarray .@enchants[2],4801,4721; //SP100 Dexterity2
+ else if (.@i <= 1986) setarray .@enchants[2],4713,4761; //Inteligence4 Matk2
+ else if (.@i <= 1988) setarray .@enchants[2],4713,4713; //Inteligence4 Inteligence4
+ else if (.@i <= 1990) setarray .@enchants[2],4761,4761; //Matk2 Matk2
+ else if (.@i <= 1992) setarray .@enchants[2],4761,4713; //Matk2 Inteligence4
+ else if (.@i <= 2847) {
+ mes "[Artifact Crafter]";
+ mes "Oh no... it broke... Well, it happens. Better luck next time.";
+ close;
+ }
+ break;
+ case 2:
+ set .@i, rand(1,2858);
+ if (.@i <= 31) setarray .@enchants[1],4710,4720,4786; //Inteligence1 Dexterity1 Mdef2
+ else if (.@i <= 62) setarray .@enchants[1],4710,4720,4760; //Inteligence1 Dexterity1 Matk1
+ else if (.@i <= 93) setarray .@enchants[1],4710,4720,4711; //Inteligence1 Dexterity1 Inteligence2
+ else if (.@i <= 124) setarray .@enchants[1],4710,4720,4721; //Inteligence1 Dexterity1 Dexterity2
+ else if (.@i <= 155) setarray .@enchants[1],4710,4796,4786; //Inteligence1 HP200 Mdef2
+ else if (.@i <= 186) setarray .@enchants[1],4710,4796,4760; //Inteligence1 HP200 Matk1
+ else if (.@i <= 217) setarray .@enchants[1],4710,4796,4711; //Inteligence1 HP200 Inteligence2
+ else if (.@i <= 248) setarray .@enchants[1],4710,4796,4721; //Inteligence1 HP200 Dexterity2
+ else if (.@i <= 279) setarray .@enchants[1],4710,4710,4786; //Inteligence1 Inteligence1 Mdef2
+ else if (.@i <= 310) setarray .@enchants[1],4710,4710,4760; //Inteligence1 Inteligence1 Matk1
+ else if (.@i <= 341) setarray .@enchants[1],4710,4710,4711; //Inteligence1 Inteligence1 Inteligence2
+ else if (.@i <= 372) setarray .@enchants[1],4710,4710,4721; //Inteligence1 Inteligence1 Dexterity2
+ else if (.@i <= 403) setarray .@enchants[1],4710,4801,4786; //Inteligence1 SP100 Mdef2
+ else if (.@i <= 434) setarray .@enchants[1],4710,4801,4760; //Inteligence1 SP100 Matk1
+ else if (.@i <= 465) setarray .@enchants[1],4710,4801,4711; //Inteligence1 SP100 Inteligence2
+ else if (.@i <= 496) setarray .@enchants[1],4710,4801,4721; //Inteligence1 SP100 Dexterity2
+ else if (.@i <= 527) setarray .@enchants[1],4711,4720,4786; //Inteligence2 Dexterity1 Mdef2
+ else if (.@i <= 558) setarray .@enchants[1],4711,4720,4760; //Inteligence2 Dexterity1 Matk1
+ else if (.@i <= 589) setarray .@enchants[1],4711,4720,4711; //Inteligence2 Dexterity1 Inteligence2
+ else if (.@i <= 620) setarray .@enchants[1],4711,4720,4721; //Inteligence2 Dexterity1 Dexterity2
+ else if (.@i <= 651) setarray .@enchants[1],4711,4796,4786; //Inteligence2 HP200 Mdef2
+ else if (.@i <= 682) setarray .@enchants[1],4711,4796,4760; //Inteligence2 HP200 Matk1
+ else if (.@i <= 713) setarray .@enchants[1],4711,4796,4711; //Inteligence2 HP200 Inteligence2
+ else if (.@i <= 744) setarray .@enchants[1],4711,4796,4721; //Inteligence2 HP200 Dexterity2
+ else if (.@i <= 775) setarray .@enchants[1],4711,4710,4786; //Inteligence2 Inteligence1 Mdef2
+ else if (.@i <= 806) setarray .@enchants[1],4711,4710,4760; //Inteligence2 Inteligence1 Matk1
+ else if (.@i <= 837) setarray .@enchants[1],4711,4710,4711; //Inteligence2 Inteligence1 Inteligence2
+ else if (.@i <= 868) setarray .@enchants[1],4711,4710,4721; //Inteligence2 Inteligence1 Dexterity2
+ else if (.@i <= 899) setarray .@enchants[1],4711,4801,4786; //Inteligence2 SP100 Mdef2
+ else if (.@i <= 930) setarray .@enchants[1],4711,4801,4760; //Inteligence2 SP100 Matk1
+ else if (.@i <= 961) setarray .@enchants[1],4711,4801,4711; //Inteligence2 SP100 Inteligence2
+ else if (.@i <= 992) setarray .@enchants[1],4711,4801,4721; //Inteligence2 SP100 Dexterity2
+ else if (.@i <= 1023) setarray .@enchants[1],4720,4720,4786; //Dexterity1 Dexterity1 Mdef2
+ else if (.@i <= 1054) setarray .@enchants[1],4720,4720,4760; //Dexterity1 Dexterity1 Matk1
+ else if (.@i <= 1085) setarray .@enchants[1],4720,4720,4711; //Dexterity1 Dexterity1 Inteligence2
+ else if (.@i <= 1116) setarray .@enchants[1],4720,4720,4721; //Dexterity1 Dexterity1 Dexterity2
+ else if (.@i <= 1147) setarray .@enchants[1],4720,4796,4786; //Dexterity1 HP200 Mdef2
+ else if (.@i <= 1178) setarray .@enchants[1],4720,4796,4760; //Dexterity1 HP200 Matk1
+ else if (.@i <= 1209) setarray .@enchants[1],4720,4796,4711; //Dexterity1 HP200 Inteligence2
+ else if (.@i <= 1240) setarray .@enchants[1],4720,4796,4721; //Dexterity1 HP200 Dexterity2
+ else if (.@i <= 1271) setarray .@enchants[1],4720,4710,4786; //Dexterity1 Inteligence1 Mdef2
+ else if (.@i <= 1302) setarray .@enchants[1],4720,4710,4760; //Dexterity1 Inteligence1 Matk1
+ else if (.@i <= 1333) setarray .@enchants[1],4720,4710,4711; //Dexterity1 Inteligence1 Inteligence2
+ else if (.@i <= 1364) setarray .@enchants[1],4720,4710,4721; //Dexterity1 Inteligence1 Dexterity2
+ else if (.@i <= 1395) setarray .@enchants[1],4720,4801,4786; //Dexterity1 SP100 Mdef2
+ else if (.@i <= 1426) setarray .@enchants[1],4720,4801,4760; //Dexterity1 SP100 Matk1
+ else if (.@i <= 1457) setarray .@enchants[1],4720,4801,4711; //Dexterity1 SP100 Inteligence2
+ else if (.@i <= 1488) setarray .@enchants[1],4720,4801,4721; //Dexterity1 SP100 Dexterity2
+ else if (.@i <= 1519) setarray .@enchants[1],4721,4720,4786; //Dexterity2 Dexterity1 Mdef2
+ else if (.@i <= 1550) setarray .@enchants[1],4721,4720,4760; //Dexterity2 Dexterity1 Matk1
+ else if (.@i <= 1581) setarray .@enchants[1],4721,4720,4711; //Dexterity2 Dexterity1 Inteligence2
+ else if (.@i <= 1612) setarray .@enchants[1],4721,4720,4721; //Dexterity2 Dexterity1 Dexterity2
+ else if (.@i <= 1643) setarray .@enchants[1],4721,4796,4786; //Dexterity2 HP200 Mdef2
+ else if (.@i <= 1674) setarray .@enchants[1],4721,4796,4760; //Dexterity2 HP200 Matk1
+ else if (.@i <= 1705) setarray .@enchants[1],4721,4796,4711; //Dexterity2 HP200 Inteligence2
+ else if (.@i <= 1736) setarray .@enchants[1],4721,4796,4721; //Dexterity2 HP200 Dexterity2
+ else if (.@i <= 1767) setarray .@enchants[1],4721,4710,4786; //Dexterity2 Inteligence1 Mdef2
+ else if (.@i <= 1798) setarray .@enchants[1],4721,4710,4760; //Dexterity2 Inteligence1 Matk1
+ else if (.@i <= 1829) setarray .@enchants[1],4721,4710,4711; //Dexterity2 Inteligence1 Inteligence2
+ else if (.@i <= 1860) setarray .@enchants[1],4721,4710,4721; //Dexterity2 Inteligence1 Dexterity2
+ else if (.@i <= 1891) setarray .@enchants[1],4721,4801,4786; //Dexterity2 SP100 Mdef2
+ else if (.@i <= 1922) setarray .@enchants[1],4721,4801,4760; //Dexterity2 SP100 Matk1
+ else if (.@i <= 1953) setarray .@enchants[1],4721,4801,4711; //Dexterity2 SP100 Inteligence2
+ else if (.@i <= 1984) setarray .@enchants[1],4721,4801,4721; //Dexterity2 SP100 Dexterity2
+ else if (.@i <= 1986) setarray .@enchants[1],4712,4713,4761; //Inteligence3 Inteligence4 Matk2
+ else if (.@i <= 1988) setarray .@enchants[1],4712,4713,4713; //Inteligence3 Inteligence4 Inteligence4
+ else if (.@i <= 1990) setarray .@enchants[1],4712,4761,4761; //Inteligence3 Matk2 Matk2
+ else if (.@i <= 1992) setarray .@enchants[1],4712,4761,4713; //Inteligence3 Matk2 Inteligence4
+ else if (.@i <= 1994) setarray .@enchants[1],4722,4713,4761; //Dexterity3 Inteligence4 Matk2
+ else if (.@i <= 1996) setarray .@enchants[1],4722,4713,4713; //Dexterity3 Inteligence4 Inteligence4
+ else if (.@i <= 1998) setarray .@enchants[1],4722,4761,4761; //Dexterity3 Matk2 Matk2
+ else if (.@i <= 2000) setarray .@enchants[1],4722,4761,4713; //Dexterity3 Matk2 Inteligence4
+ else if (.@i <= 2858) {
+ mes "[Artifact Crafter]";
+ mes "Oh no... it broke... Well, it happens. Better luck next time.";
+ close;
+ }
+ break;
+ }
+ getitem2 .@item,1,1,0,0,0,.@enchants[1],.@enchants[2],.@enchants[3];
+ mes "[Artifact Crafter]";
+ mes "Looks like my effort was successful.";
+ close;
+}
+
+// Rune Knight, Guillotine Cross, & Ranger Enchants :: new_artifact
+//============================================================
+mora,152,97,5 script Guardian of Power#pa082 515,{
+ if (checkweight(1201,1) == 0) {
+ mes "Reduce the amount of items that you have in your inventory before continuing.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much in your inventory.";
+ close;
+ }
+ if (countitem(6380) < 10) {
+ mes "[Guardian of Power]";
+ mes "I give Rune Knights, Guillotine Crosses, and Rangers ancient artifacts to help them carry out their missions.";
+ next;
+ mes "[Guardian of Power]";
+ mes "There are guardians that give Mora Village coins which you can use to exchange for these artifacts.";
+ next;
+ mes "[Guardian of Power]";
+ mes "If you collect 10 or more Mora coins, then I can trade them for the artifacts.";
+ close;
+ }
+ mes "[Guardian of Power]";
+ mes "I think that you're ready to receive the ancient artifacts.";
+ next;
+ mes "[Guardian of Power]";
+ mes "Based on what class you specify, there are various artifacts available.";
+ next;
+ mes "[Guardian of Power]";
+ mes "^ff0000Choose carefully because these artifacts aren't easy to come by^000000. So what class do you want it for?";
+ next;
+ setarray .@jobs$[0],"Rune Knight","Guillotine Cross","Ranger";
+ set .@job, select("Cancel:Rune Knight:Guillotine Cross:Ranger")-2;
+ if (.@job == -1) {
+ mes "[Guardian of Power]";
+ mes "Talk to me later then.";
+ close;
+ }
+ mes "[Guardian of Power]";
+ mes .@jobs$[.@job]+"~ which artifact do you want?";
+ next;
+ switch(.@job) {
+ case 0: // Rune Knight
+ setarray .@items[0],2475,2476,2574,2575;
+ set .@i, select("Cancel:Ur's Greaves (Shoes):Peuz Greaves (Shoes):Ur's Manteau (Garment):Peuz Manteau (Garment)")-2;
+ break;
+ case 1: // Guillotine Cross
+ setarray .@items[0],2477,2478,2577,2578;
+ set .@i, select("Cancel:Sapha Shoes (Shoes):Nab Shoes (Shoes):Sapha Hood (Garment):Nab Hood (Garment)")-2;
+ break;
+ case 2: // Ranger
+ setarray .@items[0],2479,2480,2580,2581;
+ set .@i, select("Cancel:White Wing Boots (Shoes):Black Wing Boots (Shoes):White Wing Manteau (Garment):Black Wing Manteau (Garment)")-2;
+ break;
+ }
+ if (.@i == -1) {
+ mes "[Guardian of Power]";
+ mes "Talk to me later then.";
+ close;
+ }
+ if (countitem(6380) < 10) {
+ mes "[Guardian of Power]";
+ mes "Didn't I tell you to bring the correct amount of Mora Coins?";
+ close;
+ }
+ delitem 6380,10; //Mora_Coin
+ getitem .@items[.@i],1;
+ mes "[Guardian of Power]";
+ mes "Thank you for the 10 Mora Coins. Here is your artifact for the "+.@jobs$[.@job]+" job. Come back whenever you get more Mora Coins.";
+ close;
+}
+
+mora,148,98,3 script Artifact Researcher#new 521,{
+ if (checkweight(1201,1) == 0) {
+ mes "Reduce the amount of items that you have in your inventory before continuing.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much in your inventory.";
+ close;
+ }
+ disable_items;
+ mes "[Artifact Researcher]";
+ mes "Nice to meet you.";
+ mes "I'm here in Mora studying ancient relics and artifacts. The new discoveries of Adventurers has made this village very exciting for me.";
+ next;
+ switch(select("Tell me more...:Give abilities to artifacts.:Reset Enhanced abilities.")) {
+ case 1:
+ mes "[Artifact Researcher]";
+ mes "New artifacts have been found here in Mora village, haven't you heard the news?";
+ next;
+ mes "[Artifact Researcher]";
+ mes "If you come across any of these artifacts, there are hidden powers that can be extracted from them.";
+ next;
+ mes "[Artifact Researcher]";
+ mes "I'm going to continue my research for these artifacts. We researchers are taking Mora Coins as payment for our services...";
+ next;
+ mes "[Artifact Researcher]";
+ mes "I'm offering my services to give abilities to the artifacts for 100,000 zeny and 1 Mora Coin.";
+ next;
+ mes "[Artifact Researcher]";
+ mes "The best part of my service is that any enhancements that you have in these artifacts will not be harmed.";
+ close;
+ case 2:
+ set @mora_enchant_select,1;
+ break;
+ case 3:
+ set @mora_enchant_select,2;
+ break;
+ }
+ if (Zeny < 100000 || countitem(6380) == 0) {
+ mes "[Artifact Researcher]";
+ mes "I'm not giving these services out for free pal. 100,000 zeny or 1 Mora Coin. Is that too much to ask?";
+ close;
+ }
+ mes "[Artifact Researcher]";
+ mes "Ok, so are you ready? Before I start working on this, what kind of equipment did you want me to enhance?";
+ next;
+ set .@i, select("I'm not wearing the equipment:1. Weapon:2. Shoes:3. Garment:4. Armor:5. Accessory")-2;
+ if (.@i == -1) {
+ mes "[Artifact Researcher]";
+ mes "Make sure you're wearing the equipment first.";
+ close;
+ }
+ setarray .@parts[0], EQI_HAND_R, EQI_SHOES, EQI_GARMENT, EQI_ARMOR, EQI_ACC_L;
+ set .@part, .@parts[.@i];
+ if (!getequipisequiped(.@part)) {
+ mes "[Artifact Researcher]";
+ mes "Make sure you're wearing the equipment first.";
+ close;
+ }
+ set .@equip_id, getequipid(.@part);
+ set @mora_equip_part, .@part;
+
+ // @mora_equip_id = enc_type
+ //callsub L_Socket,<enchant type>,<bonus enchant type>,<4-x enchants possible>;
+ // Enchant types:
+ // [1]ATK [2]CRIT [3]EVA [4]Healer [5]Spell 1 [6]Assist 1 [7]Assist 2 [8]STR [9]Range [10]Physical [11]Spell 2
+ switch(.@part) {
+ case 4: //EQI_HAND_R
+ switch(.@equip_id) {
+ case 1660: callsub L_Socket,4,5,1; //Wand_Of_Affection2
+ case 2011: callsub L_Socket,5,11,1; //Golden_Rod_Staff2
+ case 2012: callsub L_Socket,5,11,1; //Aqua_Staff2
+ case 2013: callsub L_Socket,5,11,1; //Crimson_Staff2
+ case 2014: callsub L_Socket,5,11,1; //Forest_Staff2
+ case 16018: callsub L_Socket,1,5,1; //Mace_Of_Judgement2
+ }
+ break;
+ case 6: //EQI_SHOES
+ switch(.@equip_id) {
+ case 2475: callsub L_Socket,6,8,1; //Ur_Greave
+ case 2476: callsub L_Socket,6,10,1; //Peuz_Greave
+ case 2477: callsub L_Socket,6,2,1; //Sabah_Shoes
+ case 2478: callsub L_Socket,6,1,1; //Nab_Shoes
+ case 2479: callsub L_Socket,6,2,1; //White_Wing_Boots
+ case 2480: callsub L_Socket,6,1,1; //Black_Wing_Boots
+ }
+ break;
+ case 5: //EQI_GARMENT
+ switch(.@equip_id) {
+ case 2574: callsub L_Socket,3,8,1; //Ur_Manteau
+ case 2575: callsub L_Socket,3,2,1; //Peuz_Manteau
+ case 2577: callsub L_Socket,3,2,1; //Sabah_Hood
+ case 2578: callsub L_Socket,3,2,1; //Nab_Hood
+ case 2580: callsub L_Socket,3,1,1; //White_Wing_Manteau
+ case 2581: callsub L_Socket,3,1,1; //Black_Wing_Manteau
+ }
+ break;
+ case 2: //EQI_ARMOR
+ switch(.@equip_id) {
+ case 15036: callsub L_Socket,8,1,1; //Ur_Plate
+ case 15037: callsub L_Socket,10,2,1; //Peuz_Plate
+ case 15038: callsub L_Socket,2,10,1; //Sabah_Cloth
+ case 15039: callsub L_Socket,1,2,1; //Nab_Cloth
+ case 15042: callsub L_Socket,2,9,1; //White_Wing_Suits
+ case 15043: callsub L_Socket,1,9,1; //Black_Wing_Suits
+ }
+ break;
+ case 7: //EQI_ACC_L
+ switch(.@equip_id) {
+ case 2883: callsub L_Socket,6,0,2; //Ur_Seal
+ case 2884: callsub L_Socket,6,0,2; //Peuz_Seal
+ case 2886: callsub L_Socket,6,0,2; //Sabah_Ring
+ case 2887: callsub L_Socket,6,0,2; //Nab_Ring
+ case 2890: callsub L_Socket,6,0,2; //White_Wing_Brooch
+ case 2891: callsub L_Socket,6,0,2; //Black_wing_Brooch
+ }
+ break;
+ }
+ mes "[Artifact Researcher]";
+ mes "^990099"+getequipname(.@part)+"^000000??";
+ mes "I really want to study this equipment...";
+ set @mora_equip_part,0;
+ close;
+
+L_Socket:
+ set .@select, @mora_enchant_select;
+ set .@enchant_type, getarg(0);
+ set .@part, @mora_equip_part;
+ set .@equip_id, getequipid(.@part);
+ set .@equip_name$, getitemname(.@equip_id);
+ set .@equip_refine, getequiprefinerycnt(.@part);
+ setarray .@equip_card[0], getequipcardid(.@part,0),getequipcardid(.@part,1),getequipcardid(.@part,2),getequipcardid(.@part,3);
+ set @mora_equip_part,0;
+ set @mora_enchant_select,0;
+
+ if (.@select == 1) {
+ // If refine is +9 or higher, unlock bonus enchant type.
+ if (.@equip_refine >= 9 && getarg(1) > 0) {
+ if (.@enchant_type < 1 || .@enchant_type > 11 || getarg(1) > 11) {
+ mes "[Artifact Researcher]";
+ mes "Mm-hmm something is wrong.";
+ close;
+ }
+ setarray .@enchant_type$[1],"ATK Type","Critical Type","Evasion Type","Healer Type","Spell Ability 1","Assist Ability 1","Assist Ability 2","Strength","Range Type","Physical Type","Spell Ability 2";
+ mes "[Artifact Researcher]";
+ mes "It's a considerable reinforcement to the equipment. In this case extended enhancements can be granted. Which stat do you want to enhance?";
+ next;
+ switch(select(.@enchant_type$[.@enchant_type],.@enchant_type$[getarg(1)])) {
+ case 1:
+ break;
+ case 2:
+ set .@enchant_type, getarg(1);
+ break;
+ }
+ }
+ if (.@equip_card[3] == 0 && getarg(2) < 4) {
+ set .@slot,4;
+ mes "[Artifact Researcher]";
+ mes "Attempting to strengthen the ability further. The previous enforcement won't be affected. Do you want to continue?";
+ } else if (.@equip_card[2] == 0 && getarg(2) < 3) {
+ set .@slot,3;
+ mes "[Artifact Researcher]";
+ mes "Attempting second enhancement. The previous enforcement won't be affected.";
+ next;
+ mes "[Artifact Researcher]";
+ mes "I may have a chance to fail now with this attempt. Do you wish to continue?";
+ } else if (.@equip_card[1] == 0 && getarg(2) < 2) {
+ set .@slot,2;
+ mes "[Artifact Researcher]";
+ mes "Let's start the third enhancement. I can give the best stats at this stage but remember, ^990000there is now a chance for the artifact to be destroyed and previous enhancements will be erased^000000. Continue?";
+ } else {
+ mes "[Artifact Researcher]";
+ mes "This artifact has been strengthened to the limit. Further enhancement is impossible at its current state.";
+ close;
+ }
+ next;
+ if(select("I'll come back later.:Please continue!") == 1) {
+ mes "[Artifact Researcher]";
+ mes "If you change your mind, please come back.";
+ close;
+ }
+ switch(.@enchant_type) {
+ case 1: //Attack
+ if (.@slot == 4) set .@i, rand(1,525);
+ else if (.@slot == 3) set .@i, rand(301,655);
+ else if (.@slot == 2) set .@i, rand(451,750);
+ else {
+ mes "[Artifact Researcher]";
+ mes "An unknown error has occurred.";
+ close;
+ }
+ if (.@i < 101) set .@enchant,4700; //Strength1
+ else if (.@i < 201) set .@enchant,4811; //Fighting_Spirit1
+ else if (.@i < 301) set .@enchant,4819; //Atk1
+ else if (.@i < 351) set .@enchant,4701; //Strength2
+ else if (.@i < 401) set .@enchant,4810; //Fighting_Spirit2
+ else if (.@i < 451) set .@enchant,4766; //Atk2
+ else if (.@i < 476) set .@enchant,4702; //Strength3
+ else if (.@i < 501) set .@enchant,4809; //Fighting_Spirit3
+ else if (.@i < 526) set .@enchant,4767; //Atk3
+ else if (.@i < 626) set .@enchant,0;
+ else if (.@i < 641) set .@enchant,4703; //Strength4
+ else if (.@i < 656) set .@enchant,4808; //Fighting_Spirit4
+ else if (.@i < 661) set .@enchant,4704; //Strength5
+ else if (.@i < 666) set .@enchant,4820; //Fighting_Spirit5
+ else if (.@i < 668) set .@enchant,4705; //Strength6
+ else if (.@i < 670) set .@enchant,4821; //Fighting_Spirit6
+ else set .@enchant,9;
+ break;
+ case 2: //Critical
+ if (.@slot == 4) set .@i, rand(1,470);
+ else if (.@slot == 3) set .@i, rand(201,610);
+ else if (.@slot == 2) set .@i, rand(381,750);
+ else {
+ mes "[Artifact Researcher]";
+ mes "An unknown error has occurred.";
+ close;
+ }
+ if (.@i < 101) set .@enchant,4750; //Luck1
+ else if (.@i < 201) set .@enchant,4700; //Strength1
+ else if (.@i < 261) set .@enchant,4751; //Luck2
+ else if (.@i < 321) set .@enchant,4701; //Strength2
+ else if (.@i < 351) set .@enchant,4752; //Luck3
+ else if (.@i < 381) set .@enchant,4702; //Strength3
+ else if (.@i < 411) set .@enchant,4764; //Critical5
+ else if (.@i < 441) set .@enchant,4818; //Sharp1
+ else if (.@i < 471) set .@enchant,4752; //Luck3
+ else if (.@i < 571) set .@enchant,0;
+ else if (.@i < 586) set .@enchant,4753; //Luck4
+ else if (.@i < 601) set .@enchant,4754; //Luck5
+ else if (.@i < 606) set .@enchant,4765; //Critical7
+ else if (.@i < 611) set .@enchant,4817; //Sharp2
+ else if (.@i < 616) set .@enchant,4703; //Strength4
+ else if (.@i < 618) set .@enchant,4816; //Sharp3
+ else set .@enchant,9;
+ break;
+ case 3: //Evasion
+ if (.@slot == 4) set .@i, rand(1,525);
+ else if (.@slot == 3) set .@i, rand(301,670);
+ else if (.@slot == 2) set .@i, rand(451,800);
+ else {
+ mes "[Artifact Researcher]";
+ mes "An unknown error has occurred.";
+ close;
+ }
+ if (.@i < 101) set .@enchant,4859; //Evasion1
+ else if (.@i < 201) set .@enchant,4750; //Luck1
+ else if (.@i < 301) set .@enchant,4730; //Agility1
+ else if (.@i < 351) set .@enchant,4860; //Evasion3
+ else if (.@i < 401) set .@enchant,4751; //Luck2
+ else if (.@i < 451) set .@enchant,4731; //Agility2
+ else if (.@i < 476) set .@enchant,4731; //Agility2
+ else if (.@i < 501) set .@enchant,4752; //Luck3
+ else if (.@i < 526) set .@enchant,4732; //Agility3
+ else if (.@i < 626) set .@enchant,0;
+ else if (.@i < 641) set .@enchant,4762; //Evasion6
+ else if (.@i < 656) set .@enchant,4753; //Luck4
+ else if (.@i < 671) set .@enchant,4733; //Agility4
+ else if (.@i < 676) set .@enchant,4763; //Evasion12
+ else if (.@i < 681) set .@enchant,4754; //Luck5
+ else if (.@i < 683) set .@enchant,4734; //Agility5
+ else set .@enchant,9;
+ break;
+ case 4: //Healer
+ if (.@slot == 4) set .@i, rand(1,375);
+ else if (.@slot == 3) set .@i, rand(201,535);
+ else if (.@slot == 2) set .@i, rand(301,650);
+ else {
+ mes "[Artifact Researcher]";
+ mes "An unknown error has occurred.";
+ close;
+ }
+ if (.@i < 101) set .@enchant,4710; //Inteligence1
+ else if (.@i < 201) set .@enchant,4720; //Dexterity1
+ else if (.@i < 251) set .@enchant,4711; //Inteligence2
+ else if (.@i < 301) set .@enchant,4721; //Dexterity2
+ else if (.@i < 326) set .@enchant,4805; //Heal_Amount2
+ else if (.@i < 351) set .@enchant,4712; //Inteligence3
+ else if (.@i < 376) set .@enchant,4722; //Dexterity3
+ else if (.@i < 476) set .@enchant,0;
+ else if (.@i < 491) set .@enchant,4760; //Matk1
+ else if (.@i < 506) set .@enchant,4850; //Heal_Amount3
+ else if (.@i < 521) set .@enchant,4713; //Inteligence4
+ else if (.@i < 536) set .@enchant,4723; //Dexterity4
+ else if (.@i < 541) set .@enchant,4761; //Matk2
+ else if (.@i < 546) set .@enchant,4851; //Heal_Amount4
+ else if (.@i < 548) set .@enchant,4806; //Matk3
+ else if (.@i < 550) set .@enchant,4852; //Heal_Amount5
+ else set .@enchant,9;
+ break;
+ case 5: //Spell 1
+ if (.@slot == 4) set .@i, rand(1,600);
+ else if (.@slot == 3) set .@i, rand(401,760);
+ else if (.@slot == 2) set .@i, rand(401,766);
+ else {
+ mes "[Artifact Researcher]";
+ mes "An unknown error has occurred.";
+ close;
+ }
+ if (.@i < 101) set .@enchant,4710; //Inteligence1
+ else if (.@i < 201) set .@enchant,4720; //Dexterity1
+ else if (.@i < 301) set .@enchant,4795; //HP100
+ else if (.@i < 401) set .@enchant,4815; //Spell1
+ else if (.@i < 451) set .@enchant,4711; //Inteligence2
+ else if (.@i < 501) set .@enchant,4721; //Dexterity2
+ else if (.@i < 551) set .@enchant,4796; //HP200
+ else if (.@i < 601) set .@enchant,4814; //Spell2
+ else if (.@i < 701) set .@enchant,0;
+ else if (.@i < 716) set .@enchant,4712; //Inteligence3
+ else if (.@i < 731) set .@enchant,4722; //Dexterity3
+ else if (.@i < 746) set .@enchant,4797; //HP300
+ else if (.@i < 761) set .@enchant,4813; //Spell3
+ else if (.@i < 763) set .@enchant,4713; //Inteligence4
+ else if (.@i < 765) set .@enchant,4723; //Dexterity4
+ else if (.@i < 767) set .@enchant,4812; //Spell4
+ else set .@enchant,9;
+ break;
+ case 6: //Assist 1
+ if (.@slot == 4) set .@i, rand(1,520);
+ else if (.@slot == 3) set .@i, rand(321,720);
+ else if (.@slot == 2) set .@i, rand(521,850);
+ else {
+ mes "[Artifact Researcher]";
+ mes "An unknown error has occurred.";
+ close;
+ }
+ if (.@i < 81) set .@enchant,4792; //Def6
+ else if (.@i < 161) set .@enchant,4787; //Mdef4
+ else if (.@i < 241) set .@enchant,4801; //SP100
+ else if (.@i < 321) set .@enchant,4796; //HP200
+ else if (.@i < 371) set .@enchant,4700; //Strength1
+ else if (.@i < 421) set .@enchant,4720; //Dexterity1
+ else if (.@i < 471) set .@enchant,4730; //Agility1
+ else if (.@i < 521) set .@enchant,4740; //Vitality1
+ else if (.@i < 621) set .@enchant,0;
+ else if (.@i < 646) set .@enchant,4793; //Def9
+ else if (.@i < 671) set .@enchant,4788; //Mdef6
+ else if (.@i < 696) set .@enchant,4802; //SP150
+ else if (.@i < 721) set .@enchant,4797; //HP300
+ else if (.@i < 731) set .@enchant,4701; //Strength2
+ else if (.@i < 741) set .@enchant,4721; //Dexterity2
+ else if (.@i < 751) set .@enchant,4731; //Agility2
+ else set .@enchant,9;
+ break;
+ case 7: //Assist 2
+ if (.@slot == 4) set .@i, rand(1,520);
+ else if (.@slot == 3) set .@i, rand(321,720);
+ else if (.@slot == 2) set .@i, rand(521,850);
+ else {
+ mes "[Artifact Researcher]";
+ mes "An unknown error has occurred.";
+ close;
+ }
+ if (.@i < 81) set .@enchant,4792; //Def6
+ else if (.@i < 161) set .@enchant,4787; //Mdef4
+ else if (.@i < 241) set .@enchant,4801; //SP100
+ else if (.@i < 321) set .@enchant,4796; //HP200
+ else if (.@i < 371) set .@enchant,4710; //Inteligence1
+ else if (.@i < 421) set .@enchant,4720; //Dexterity1
+ else if (.@i < 471) set .@enchant,4730; //Agility1
+ else if (.@i < 521) set .@enchant,4740; //Vitality1
+ else if (.@i < 621) set .@enchant,0;
+ else if (.@i < 646) set .@enchant,4793; //Def9
+ else if (.@i < 671) set .@enchant,4788; //Mdef6
+ else if (.@i < 696) set .@enchant,4802; //SP150
+ else if (.@i < 721) set .@enchant,4797; //HP300
+ else if (.@i < 731) set .@enchant,4711; //Inteligence2
+ else if (.@i < 741) set .@enchant,4721; //Dexterity2
+ else if (.@i < 751) set .@enchant,4741; //Vitality2
+ else set .@enchant,9;
+ break;
+ case 8: //Strength
+ if (.@slot == 4) set .@i, rand(1,525);
+ else if (.@slot == 3) set .@i, rand(301,685);
+ else if (.@slot == 2) set .@i, rand(451,800);
+ else {
+ mes "[Artifact Researcher]";
+ mes "An unknown error has occurred.";
+ close;
+ }
+ if (.@i < 101) set .@enchant,4740; //Vitality1
+ else if (.@i < 201) set .@enchant,4797; //HP300
+ else if (.@i < 301) set .@enchant,4791; //Def3
+ else if (.@i < 351) set .@enchant,4741; //Vitality2
+ else if (.@i < 401) set .@enchant,4798; //HP400
+ else if (.@i < 451) set .@enchant,4792; //Def6
+ else if (.@i < 476) set .@enchant,4742; //Vitality3
+ else if (.@i < 501) set .@enchant,4793; //Def9
+ else if (.@i < 526) set .@enchant,4799; //HP500
+ else if (.@i < 626) set .@enchant,0;
+ else if (.@i < 641) set .@enchant,4742; //Vitality3
+ else if (.@i < 656) set .@enchant,4743; //Vitality4
+ else if (.@i < 671) set .@enchant,4794; //Def12
+ //else if (.@i < 686) set .@enchant,01; // ??
+ else if (.@i < 688) set .@enchant,4744; //Vitality5
+ //else if (.@i < 690) set .@enchant,02; // ??
+ else set .@enchant,9;
+ break;
+ case 9: //Range
+ if (.@slot == 4) set .@i, rand(1,470);
+ else if (.@slot == 3) set .@i, rand(201,610);
+ else if (.@slot == 2) set .@i, rand(321,750);
+ else {
+ mes "[Artifact Researcher]";
+ mes "An unknown error has occurred.";
+ close;
+ }
+ if (.@i < 101) set .@enchant,4750; //Luck1
+ else if (.@i < 201) set .@enchant,4720; //Dexterity1
+ else if (.@i < 261) set .@enchant,4751; //Luck2
+ else if (.@i < 321) set .@enchant,4721; //Dexterity2
+ else if (.@i < 351) set .@enchant,4752; //Luck3
+ else if (.@i < 381) set .@enchant,4722; //Dexterity3
+ else if (.@i < 411) set .@enchant,4764; //Critical5
+ else if (.@i < 441) set .@enchant,4832; //Expert_Archer1
+ else if (.@i < 471) set .@enchant,4753; //Luck4
+ else if (.@i < 571) set .@enchant,0;
+ else if (.@i < 586) set .@enchant,4723; //Dexterity4
+ else if (.@i < 601) set .@enchant,4833; //Expert_Archer2
+ else if (.@i < 606) set .@enchant,4765; //Critical7
+ else if (.@i < 611) set .@enchant,4834; //Expert_Archer3
+ else if (.@i < 616) set .@enchant,4724; //Dexterity5
+ else if (.@i < 618) set .@enchant,4835; //Expert_Archer4
+ else set .@enchant,9;
+ break;
+ case 10: //Physical
+ if (.@slot == 4) set .@i, rand(1,600);
+ else if (.@slot == 3) set .@i, rand(401,800);
+ else if (.@slot == 2) set .@i, rand(601,930);
+ else {
+ mes "[Artifact Researcher]";
+ mes "An unknown error has occurred.";
+ close;
+ }
+ if (.@i < 101) set .@enchant,4791; //Def3
+ else if (.@i < 201) set .@enchant,4730; //Agility1
+ else if (.@i < 301) set .@enchant,4750; //Luck1
+ else if (.@i < 401) set .@enchant,4795; //HP100
+ else if (.@i < 451) set .@enchant,4792; //Def6
+ else if (.@i < 501) set .@enchant,4731; //Agility2
+ else if (.@i < 551) set .@enchant,4751; //Luck2
+ else if (.@i < 601) set .@enchant,4796; //HP200
+ else if (.@i < 701) set .@enchant,0;
+ else if (.@i < 726) set .@enchant,4793; //Def9
+ else if (.@i < 751) set .@enchant,4732; //Agility3
+ else if (.@i < 776) set .@enchant,4752; //Luck3
+ else if (.@i < 801) set .@enchant,4797; //HP300
+ else if (.@i < 816) set .@enchant,4733; //Agility4
+ else if (.@i < 831) set .@enchant,4753; //Luck4
+ else if (.@i < 833) set .@enchant,4807; //Atk_Speed1
+ else set .@enchant,9;
+ break;
+ case 11: //Spell 2
+ if (.@slot == 4) set .@i, rand(1,600);
+ else if (.@slot == 3) set .@i, rand(401,760);
+ else if (.@slot == 2) set .@i, rand(401,766);
+ else {
+ mes "[Artifact Researcher]";
+ mes "An unknown error has occurred.";
+ close;
+ }
+ if (.@i < 101) set .@enchant,4711; //Inteligence2
+ else if (.@i < 201) set .@enchant,4721; //Dexterity2
+ else if (.@i < 301) set .@enchant,4796; //HP200
+ else if (.@i < 401) set .@enchant,4814; //Spell2
+ else if (.@i < 451) set .@enchant,4712; //Inteligence3
+ else if (.@i < 501) set .@enchant,4722; //Dexterity3
+ else if (.@i < 551) set .@enchant,4760; //Matk1
+ else if (.@i < 601) set .@enchant,4813; //Spell3
+ else if (.@i < 701) set .@enchant,0;
+ else if (.@i < 716) set .@enchant,4713; //Inteligence4
+ else if (.@i < 731) set .@enchant,4723; //Dexterity4
+ else if (.@i < 746) set .@enchant,4761; //Matk2
+ else if (.@i < 761) set .@enchant,4812; //Spell4
+ else if (.@i < 763) set .@enchant,4714; //Inteligence5
+ else if (.@i < 765) set .@enchant,4724; //Dexterity5
+ else if (.@i < 767) set .@enchant,4806; //Matk3
+ else set .@enchant,9;
+ break;
+ default:
+ mes "[Artifact Researcher]";
+ mes "Well I guess I was wrong...";
+ close;
+ }
+ if (.@equip_card[3] == 0 && getarg(2) < 4) {
+ set .@equip_card[3],.@enchant;
+ } else if (.@equip_card[2] == 0 && getarg(2) < 3) {
+ set .@equip_card[2],.@enchant;
+ if (.@enchant == 0) {
+ set .@equip_card[3],0;
+ }
+ } else if (.@equip_card[1] == 0 && getarg(2) < 2) {
+ set .@equip_card[1],.@enchant;
+ if (.@enchant == 0) {
+ set .@equip_card[2],0;
+ set .@equip_card[3],0;
+ }
+ } else {
+ mes "[Artifact Researcher]";
+ mes "I think there was an enhancing limit to the artifacts.";
+ close;
+ }
+ if (Zeny < 100000 || countitem(6380) == 0) {
+ mes "[Artifact Researcher]";
+ mes "I'm not going to do the work unless you pay the fee.";
+ close;
+ }
+ delitem 6380,1; //Mora_Coin
+ set Zeny, Zeny-100000;
+ delequip .@part;
+ if (.@enchant == 9) {
+ specialeffect2 EF_SUI_EXPLOSION;
+ mes "[Artifact Researcher]";
+ mes "This!";
+ mes "I... I'm sorry but the equipment has been destroyed.";
+ close;
+ }
+ if (.@enchant == 0) {
+ specialeffect2 EF_SHIELDCHARGE;
+ mes "[Artifact Researcher]";
+ mes "Since the balance of power does not match, the given existing ability has been destroyed. It is unfortunate but please try again next time.";
+ } else {
+ specialeffect2 EF_REPAIRWEAPON;
+ mes "[Artifact Researcher]";
+ // Replacing original dialogue since it doesn't make sense.
+ //mes "The artifact ^990000"+.@slot+" will have the first enhancement retained.";
+ mes "I've successfully enhanced the artifact ^990000"+.@equip_name$+"^000000 at socket "+.@slot+".";
+ }
+
+// GetNonSlotItemSock2 .@equip_refine .@equip_id .@equip_card[0] .@equip_card[1] .@equip_card[2] .@equip_card[3]
+ getitem2 .@equip_id,1,1,.@equip_refine,0,.@equip_card[0],.@equip_card[1],.@equip_card[2],.@equip_card[3];
+
+ close;
+ } else if (.@select == 2) {
+ if (Zeny < 100000 || countitem(6380) == 0) {
+ mes "[Artifact Researcher]";
+ mes "You've got to pay if you want the services.";
+ close;
+ }
+ specialeffect2 EF_REPAIRWEAPON;
+ mes "[Artifact Researcher]";
+ mes "The ability to enhance remains.";
+ delitem 6380,1; //Mora_Coin
+ set Zeny, Zeny-100000;
+ delequip .@part;
+
+// GetNonSlotItemSock2 .@equip_refine .@equip_id .@equip_card[0] .@equip_card[1] .@equip_card[2] .@equip_card[3]
+ for(set .@i,0; .@i<4; set .@i,.@i+1) {
+ if (.@equip_card[.@i] >= 4700) // Armor Enchant System
+ set .@equip_card[.@i],0;
+ }
+ getitem2 .@equip_id,1,1,.@equip_refine,0,.@equip_card[0],.@equip_card[1],.@equip_card[2],.@equip_card[3];
+
+ close;
+ }
+}
+
+// Arch Bishop & Warlock Empowering :: relic_change
+//============================================================
+mora,124,82,4 script Artifact Collector#blan 522,{
+ if (checkweight(1201,1) == 0) {
+ mes "Reduce the amount of items that you have in your inventory before continuing.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much in your inventory.";
+ close;
+ }
+ disable_items;
+ emotion e_ho;
+ mes "Those Mora Artifacts look so perfect!";
+ mes "But I know you want them to be even better!";
+ next;
+ mes "[Artifact Collector]";
+ mes "Greetings Adventurer. We will be great friends in a moment after I tell you how to Empower your Artifacts!";
+ next;
+ switch(select("Let's do this!:Empower Artifacts?:Nope, not for me!")) {
+ case 1:
+ break;
+ case 2:
+ emotion e_ok;
+ mes "[Artifact Collector]";
+ mes "You seem like a pretty good judge of character.";
+ next;
+ mes "[Artifact Collector]";
+ mes "For over 200 years I've been working with Artifacts here in Mora. Toiling to get the perfect +9!";
+ next;
+ select("Gulp... +9?!");
+ emotion e_omg,1;
+ mes "[Artifact Collector]";
+ mes "My business is collecting the old relics and refining them to their essence!";
+ next;
+ emotion e_sob;
+ mes "[Artifact Collector]";
+ mes "Finding the perfect Artifact for me to experiment on is my life's work.";
+ mes "Plus seeing the wonder of our ancestor's legacy is also gratifying.";
+ next;
+ select("I can see how that could be fun.");
+ emotion e_pat;
+ mes "[Artifact Collector]";
+ mes "Thank you human.";
+ next;
+ mes "[Artifact Collector]";
+ mes "I've been doing this for over 200 years, and honestly the readily available supply is gone, and Artificer and Artifact Crafter won't trade me anymore...";
+ next;
+ emotion e_dots;
+ mes "[Artifact Collector]";
+ mes "But maybe the Humans that are starting to visit can bring in some new stock!";
+ next;
+ select("Humans... Stock?");
+ emotion e_what,1;
+ mes "[Artifact Collector]";
+ mes "Yes! If the humans can bring me new artifacts I can work on my ultimate achievement!";
+ next;
+ select("Ultimate Achievement?");
+ emotion e_what,1;
+ emotion e_ok;
+ mes "[Artifact Collector]";
+ mes "Patience, we'll get to that...";
+ next;
+ mes "[Artifact Collector]";
+ mes "I am a collector, by trade, but my greatest achievement is empowering some artifacts with greater power!";
+ mes "I have only perfected my ability on a few Artifact types so far.";
+ next;
+ mes "[Artifact Collector]";
+ mes "You might just be the human to help me complete my plan.";
+ next;
+ emotion e_otl;
+ mes "[Artifact Collector]";
+ mes "Oh how I love how fate works sometimes...";
+ next;
+ mes "[Artifact Collector]";
+ mes "+1, +2, +3, +4, +5, +6 those refinements are not strong enough to work on my craft.";
+ next;
+ emotion 57,0;
+ mes "[Artifact Collector]";
+ mes "But +7! +7 is rare and just barely strong enough to work in my crafting attempts.";
+ next;
+ select("I'm gonna be abused again...");
+ emotion e_hmm,1;
+ mes "[Artifact Collector]";
+ mes "Right you are! I know it is natural for you Humans to help a friend, even without the friend asking...";
+ next;
+ select("I'm not sure if...");
+ emotion e_what,1;
+ mes "[Artifact Collector]";
+ mes "Of course I'll accept your help! Find me...";
+ next;
+ mes "- Golden Rod Staff -";
+ mes "- Aqua Staff -";
+ mes "- Crimson Staff -";
+ mes "- Forest Staff -";
+ mes "- Staff of Mercy -";
+ mes "- Mace of Judgement -";
+ next;
+ select("Anything else?");
+ emotion e_what,1;
+ mes "[Artifact Collector]";
+ mes "Well aside from the +7, there are very specific enchantments that need to be on the artifact that help catalyze the process.";
+ next;
+ mes "[Artifact Collector]";
+ mes "If either the +7 or the specific enchantment is missing I can't do it.";
+ next;
+ select("So the Refining will be preserved?");
+ emotion e_omg,1;
+ emotion e_an;
+ mes "[Artifact Collector]";
+ mes "No, but what you'll get back is so much better!";
+ next;
+ mes "[Artifact Collector]";
+ mes "By now you are wondering more about the artifacts I'm looking for?";
+ next;
+ emotion e_what;
+ mes "[Artifact Collector]";
+ mes "Go ahead and ask!";
+ next;
+ setarray .@artifacts[0],1657,16013,2007,2008,2009,2010;
+ setarray .@empowered[0],1660,16018,2011,2012,2013,2014;
+ while(1) {
+ set .@i, select("I don't think I'm interested:Staff of Mercy:Mace of Judgement:Golden Rod Staff:Aqua Staff:Crimson Staff:Forest Staff")-2;
+ if (.@i == -1) {
+ emotion e_what;
+ mes "[Artifact Collector]";
+ mes "Ok, well maybe someday you will be.";
+ close;
+ }
+ mes "[Artifact Collector]";
+ mes getitemname(.@artifacts[.@i])+" must of course be refined to +7 or higher for me to distill it to an enchantment.";
+ next;
+ switch(.@i) {
+ case 0:
+ setarray .@enchants[0],4761,4723,4714;
+ set .@str$, "MATK+2%, DEX+4, INT+5";
+ break;
+ case 1:
+ setarray .@enchants[0],4767,4723,4704;
+ set .@str$, "ATK+3%, DEX+4, STR+5";
+ break;
+ default:
+ setarray .@enchants[0],4761,4713;
+ set .@str$, "MATK+2%, INT+4";
+ break;
+ }
+ mes "[Artifact Collector]";
+ mes "It must also carry any of these enchantments: "+.@str$+" to be craftable by me.";
+ next;
+ select(getitemname(.@empowered[.@i])+" attributes?");
+ callsub L_ShowInfo, .@empowered[.@i];
+ mes "[Artifact Collector]";
+ mes "But please if you do get one, please let me work on it, I'm begging you.";
+ next;
+ }
+ case 3:
+ mes "[Artifact Collector]";
+ mes "Have yourself a great day. Bye~";
+ close;
+ }
+ emotion e_flash;
+ mes "[Artifact Collector]";
+ mes "Let me take a look at what you have brought me.";
+ next;
+ if (!getequipisequiped(EQI_HAND_R)) {
+ emotion e_an;
+ mes "[Artifact Collector]";
+ mes "I don't know what you are trying to do... I can't enhance what you don't have.";
+ close;
+ }
+ set .@equip_id, getequipid(EQI_HAND_R);
+ setarray .@equip_card[2], getequipcardid(EQI_HAND_R,2),getequipcardid(EQI_HAND_R,3);
+ switch(.@equip_id) {
+ case 2007: //Golden_Rod_Staff
+ case 2008: //Aqua_Staff
+ case 2009: //Crimson_Staff
+ case 2010: //Forest_Staff
+ if (.@equip_card[2] == 4761 || .@equip_card[3] == 4761 || //Matk2
+ .@equip_card[2] == 4713 || .@equip_card[3] == 4713) //Inteligence4
+ set .@empowered,.@equip_id+4; //Golden_Rod_Staff2,Aqua_Staff2,Crimson_Staff2,Forest_Staff2
+ break;
+ case 1657: //Wand_Of_Affection
+ if (.@equip_card[2] == 4761 || .@equip_card[3] == 4761 || //Matk2
+ .@equip_card[2] == 4714 || .@equip_card[3] == 4714 || //Inteligence5
+ .@equip_card[2] == 4723 || .@equip_card[3] == 4723) //Dexterity4
+ set .@empowered,1660; //Wand_Of_Affection2
+ break;
+ case 16013: //Mace_Of_Judgement
+ if (.@equip_card[2] == 4723 || .@equip_card[3] == 4723 || //Dexterity4
+ .@equip_card[2] == 4704 || .@equip_card[3] == 4704 || //Strength5
+ .@equip_card[2] == 4767 || .@equip_card[3] == 4767) //Atk3
+ set .@empowered,16018; //Mace_Of_Judgement2
+ break;
+ default:
+ emotion e_an;
+ mes "[Artifact Collector]";
+ mes "The weapon you have isn't one of the Artifacts I can work with.";
+ close;
+ }
+ if (getequiprefinerycnt(EQI_HAND_R) < 7) {
+ emotion e_an;
+ mes "[Artifact Collector]";
+ mes "I must insist that the refine level of the Artifact be at least +7!";
+ close;
+ }
+ if (!.@empowered) {
+ emotion e_an;
+ mes "[Artifact Collector]";
+ mes "These attributes just won't do for my research process, try re-randoming them.";
+ close;
+ }
+ emotion e_slur;
+ mes "[Artifact Collector]";
+ mes "I'm tingling with excitement!";
+ mes "You've brought me everything I need!!";
+ next;
+ emotion e_ok;
+ mes "[Artifact Collector]";
+ mes "If you are ready I am about to show you what I can do with your +"+getequiprefinerycnt(EQI_HAND_R)+" Artifact!";
+ next;
+ mes "[Artifact Collector]";
+ mes "I'm going to take your ^FF0000"+getequipname(EQI_HAND_R)+"^000000 and exchange it, are you ready?";
+ next;
+ switch(select("NOOO!:Yes, I'm ready!:What will it be after?")) {
+ case 1:
+ emotion e_an;
+ mes "[Artifact Collector]";
+ mes "You've got to be kidding... you got my hopes up...";
+ close;
+ case 2:
+ break;
+ case 3:
+ callsub L_ShowInfo, .@empowered;
+ mes "[Artifact Collector]";
+ mes "Surely you want to go on?";
+ next;
+ if(select("No, I don't.:Yes, do it!") == 1) {
+ emotion e_an;
+ mes "[Artifact Collector]";
+ mes "You've got to be kidding... you got my hopes up...";
+ close;
+ }
+ break;
+ }
+ emotion e_heh;
+ delequip EQI_HAND_R;
+ getitem .@empowered,1;
+ mes "[Artifact Collector]";
+ mes "It is perfectly done, you will be so happy! Good bye friend~";
+ close;
+
+L_ShowInfo:
+ mes "[Artifact Collector]";
+ mes getitemname(getarg(0));
+ switch(getarg(0)) {
+ case 1660: //Wand_Of_Affection2
+ mes "One handed Staff / Attack : 30";
+ mes "Weight : 50 / Any Sex";
+ mes "Archbishop only";
+ mes "Weapon Level : 4 / ^ff0000Required Level: 130^000000";
+ mes "MATK + 180, INT + 4.";
+ mes "Adds 20% Heal Bonus.";
+ mes "If worn with Robes, Shoes, and Robe of Mercy Increase Heal Bonus by an additional 45% and SP consumption of 'Heal' by 50.";
+ mes "When receives close physical attack, Lv.1 Silentium will be excuted at a certain rate.";
+ mes "Recuces 3 seconds of delay after excuting Clearance, Laudaramus, and Laudaagnus skills.";
+ break;
+ case 16018: //Mace_Of_Judgement2
+ mes "Mace / Attack : 170";
+ mes "Weight : 120 / Any Sex";
+ mes "Archbishop only";
+ mes "Weapon Level : 4 / ^ff0000Required Level: 130^000000";
+ mes "MATK + 180, STR + 2, INT + 2.";
+ mes "Physical and Magical Attacks have a chance to increase damage by 40% to Demon monsters for 7 seconds.";
+ mes "If worn with Judgement Golves, Shoes and Shawl, increase Damage against Undead by 30%.";
+ mes "Increase damage of Adoramus by 200%, and increase SP cost of Adoramus by 30.";
+ break;
+ case 2011: //Golden_Rod_Staff2
+ mes "Staff / Attack: 30";
+ mes "Weight : 90 / Any Sex";
+ mes "Warlock only";
+ mes "Weapon Level : 4 / ^ff0000Required Level : 130^000000";
+ mes "INT + 5, MATK + 270.";
+ mes "Increase Jupitel Thunder damage by 30%.";
+ mes "If worn with Golden Robe, Golden Shoes, and Golden Orb Increase Wind Magic damage by 60%.";
+ mes "Lower Earth Magic damage by 60% and resistance to Earth by 50%.";
+ break;
+ case 2012: //Aqua_Staff2
+ mes "Staff / Attack : 30";
+ mes "Weight : 90 / Any Sex";
+ mes "Warlock only";
+ mes "Weapon Level : 4 / ^ff0000Required Level: 130^000000";
+ mes "INT + 5, MATK + 270.";
+ mes "Increase Cold Bolt and Frost Diver damage by 30%.";
+ mes "If worn with Aqua Robe, Shoes, and Orb Increase Water Magic damage by 60%.";
+ mes "Lower Wind Magic damage by 60% and resistance to Wind by 50%.";
+ break;
+ case 2013: //Crimson_Staff2
+ mes "Staff / Attack : 30";
+ mes "Weight : 90 / Any Sex";
+ mes "Warlock only";
+ mes "Weapon Level : 4 / ^ff0000Required Level: 130^000000";
+ mes "INT + 5, MATK + 270.";
+ mes "Increase Fire Bolt and Fireball damage by 30%.";
+ mes "If worn with Crimson Robe, Shoes, and Orb Increase Fire Magic damage by 60%.";
+ mes "Lower Water Magic damage by 60% and resistance to Water by 50%.";
+ break;
+ case 2014: //Forest_Staff2
+ mes "Staff / Attack : 30";
+ mes "Weight : 90 / Any Sex";
+ mes "Warlock only";
+ mes "Weapon Level : 4 / ^ff0000Required Level: 130^000000";
+ mes "INT + 5, MATK + 270.";
+ mes "Increase Earth Spike and Heaven's Drive damage by 30%.";
+ mes "If worn with Forest Robe, Shoes, and Orb Increase Earth Magic damage by 60%.";
+ mes "Lower Fire Magic damage by 60% and resistance to Fire by 50%.";
+ break;
+ }
+ next;
+ return;
+}
+
+// Other Enchants :: sangjo
+//============================================================
+function script F_Mora_Enchant {
+ specialeffect2 EF_REPAIRWEAPON;
+ progressbar "ffff00",3;
+ delitem 6380,5; //Mora_Coin
+ delitem getarg(0),1;
+ set .@i, rand(1,4568);
+ if (.@i <= 11) setarray .@enchants[1],4766,4720,4700; //Atk2 Dexterity1 Strength1
+ else if (.@i <= 22) setarray .@enchants[1],4766,4720,4701; //Atk2 Dexterity1 Strength2
+ else if (.@i <= 33) setarray .@enchants[1],4766,4720,4730; //Atk2 Dexterity1 Agility1
+ else if (.@i <= 44) setarray .@enchants[1],4766,4720,4731; //Atk2 Dexterity1 Agility2
+ else if (.@i <= 55) setarray .@enchants[1],4766,4720,4740; //Atk2 Dexterity1 Vitality1
+ else if (.@i <= 66) setarray .@enchants[1],4766,4720,4741; //Atk2 Dexterity1 Vitality2
+ else if (.@i <= 77) setarray .@enchants[1],4766,4721,4700; //Atk2 Dexterity2 Strength1
+ else if (.@i <= 88) setarray .@enchants[1],4766,4721,4701; //Atk2 Dexterity2 Strength2
+ else if (.@i <= 99) setarray .@enchants[1],4766,4721,4730; //Atk2 Dexterity2 Agility1
+ else if (.@i <= 110) setarray .@enchants[1],4766,4721,4731; //Atk2 Dexterity2 Agility2
+ else if (.@i <= 121) setarray .@enchants[1],4766,4721,4740; //Atk2 Dexterity2 Vitality1
+ else if (.@i <= 132) setarray .@enchants[1],4766,4721,4741; //Atk2 Dexterity2 Vitality2
+ else if (.@i <= 143) setarray .@enchants[1],4766,4710,4700; //Atk2 Inteligence1 Strength1
+ else if (.@i <= 154) setarray .@enchants[1],4766,4710,4701; //Atk2 Inteligence1 Strength2
+ else if (.@i <= 165) setarray .@enchants[1],4766,4710,4730; //Atk2 Inteligence1 Agility1
+ else if (.@i <= 176) setarray .@enchants[1],4766,4710,4731; //Atk2 Inteligence1 Agility2
+ else if (.@i <= 187) setarray .@enchants[1],4766,4710,4740; //Atk2 Inteligence1 Vitality1
+ else if (.@i <= 198) setarray .@enchants[1],4766,4710,4741; //Atk2 Inteligence1 Vitality2
+ else if (.@i <= 209) setarray .@enchants[1],4766,4711,4700; //Atk2 Inteligence2 Strength1
+ else if (.@i <= 220) setarray .@enchants[1],4766,4711,4701; //Atk2 Inteligence2 Strength2
+ else if (.@i <= 231) setarray .@enchants[1],4766,4711,4730; //Atk2 Inteligence2 Agility1
+ else if (.@i <= 242) setarray .@enchants[1],4766,4711,4731; //Atk2 Inteligence2 Agility2
+ else if (.@i <= 253) setarray .@enchants[1],4766,4711,4740; //Atk2 Inteligence2 Vitality1
+ else if (.@i <= 264) setarray .@enchants[1],4766,4711,4741; //Atk2 Inteligence2 Vitality2
+ else if (.@i <= 275) setarray .@enchants[1],4766,4750,4700; //Atk2 Luck1 Strength1
+ else if (.@i <= 286) setarray .@enchants[1],4766,4750,4701; //Atk2 Luck1 Strength2
+ else if (.@i <= 297) setarray .@enchants[1],4766,4750,4730; //Atk2 Luck1 Agility1
+ else if (.@i <= 308) setarray .@enchants[1],4766,4750,4731; //Atk2 Luck1 Agility2
+ else if (.@i <= 319) setarray .@enchants[1],4766,4750,4740; //Atk2 Luck1 Vitality1
+ else if (.@i <= 330) setarray .@enchants[1],4766,4750,4741; //Atk2 Luck1 Vitality2
+ else if (.@i <= 341) setarray .@enchants[1],4766,4751,4700; //Atk2 Luck2 Strength1
+ else if (.@i <= 352) setarray .@enchants[1],4766,4751,4701; //Atk2 Luck2 Strength2
+ else if (.@i <= 363) setarray .@enchants[1],4766,4751,4730; //Atk2 Luck2 Agility1
+ else if (.@i <= 374) setarray .@enchants[1],4766,4751,4731; //Atk2 Luck2 Agility2
+ else if (.@i <= 385) setarray .@enchants[1],4766,4751,4740; //Atk2 Luck2 Vitality1
+ else if (.@i <= 396) setarray .@enchants[1],4766,4751,4741; //Atk2 Luck2 Vitality2
+ else if (.@i <= 407) setarray .@enchants[1],4767,4720,4700; //Atk3 Dexterity1 Strength1
+ else if (.@i <= 418) setarray .@enchants[1],4767,4720,4701; //Atk3 Dexterity1 Strength2
+ else if (.@i <= 429) setarray .@enchants[1],4767,4720,4730; //Atk3 Dexterity1 Agility1
+ else if (.@i <= 440) setarray .@enchants[1],4767,4720,4731; //Atk3 Dexterity1 Agility2
+ else if (.@i <= 451) setarray .@enchants[1],4767,4720,4740; //Atk3 Dexterity1 Vitality1
+ else if (.@i <= 462) setarray .@enchants[1],4767,4720,4741; //Atk3 Dexterity1 Vitality2
+ else if (.@i <= 473) setarray .@enchants[1],4767,4721,4700; //Atk3 Dexterity2 Strength1
+ else if (.@i <= 484) setarray .@enchants[1],4767,4721,4701; //Atk3 Dexterity2 Strength2
+ else if (.@i <= 495) setarray .@enchants[1],4767,4721,4730; //Atk3 Dexterity2 Agility1
+ else if (.@i <= 506) setarray .@enchants[1],4767,4721,4731; //Atk3 Dexterity2 Agility2
+ else if (.@i <= 517) setarray .@enchants[1],4767,4721,4740; //Atk3 Dexterity2 Vitality1
+ else if (.@i <= 528) setarray .@enchants[1],4767,4721,4741; //Atk3 Dexterity2 Vitality2
+ else if (.@i <= 539) setarray .@enchants[1],4767,4710,4700; //Atk3 Inteligence1 Strength1
+ else if (.@i <= 550) setarray .@enchants[1],4767,4710,4701; //Atk3 Inteligence1 Strength2
+ else if (.@i <= 561) setarray .@enchants[1],4767,4710,4730; //Atk3 Inteligence1 Agility1
+ else if (.@i <= 572) setarray .@enchants[1],4767,4710,4731; //Atk3 Inteligence1 Agility2
+ else if (.@i <= 583) setarray .@enchants[1],4767,4710,4740; //Atk3 Inteligence1 Vitality1
+ else if (.@i <= 594) setarray .@enchants[1],4767,4710,4741; //Atk3 Inteligence1 Vitality2
+ else if (.@i <= 605) setarray .@enchants[1],4767,4711,4700; //Atk3 Inteligence2 Strength1
+ else if (.@i <= 616) setarray .@enchants[1],4767,4711,4701; //Atk3 Inteligence2 Strength2
+ else if (.@i <= 627) setarray .@enchants[1],4767,4711,4730; //Atk3 Inteligence2 Agility1
+ else if (.@i <= 638) setarray .@enchants[1],4767,4711,4731; //Atk3 Inteligence2 Agility2
+ else if (.@i <= 649) setarray .@enchants[1],4767,4711,4740; //Atk3 Inteligence2 Vitality1
+ else if (.@i <= 660) setarray .@enchants[1],4767,4711,4741; //Atk3 Inteligence2 Vitality2
+ else if (.@i <= 671) setarray .@enchants[1],4767,4750,4700; //Atk3 Luck1 Strength1
+ else if (.@i <= 682) setarray .@enchants[1],4767,4750,4701; //Atk3 Luck1 Strength2
+ else if (.@i <= 693) setarray .@enchants[1],4767,4750,4730; //Atk3 Luck1 Agility1
+ else if (.@i <= 704) setarray .@enchants[1],4767,4750,4731; //Atk3 Luck1 Agility2
+ else if (.@i <= 715) setarray .@enchants[1],4767,4750,4740; //Atk3 Luck1 Vitality1
+ else if (.@i <= 726) setarray .@enchants[1],4767,4750,4741; //Atk3 Luck1 Vitality2
+ else if (.@i <= 737) setarray .@enchants[1],4767,4751,4700; //Atk3 Luck2 Strength1
+ else if (.@i <= 748) setarray .@enchants[1],4767,4751,4701; //Atk3 Luck2 Strength2
+ else if (.@i <= 759) setarray .@enchants[1],4767,4751,4730; //Atk3 Luck2 Agility1
+ else if (.@i <= 770) setarray .@enchants[1],4767,4751,4731; //Atk3 Luck2 Agility2
+ else if (.@i <= 781) setarray .@enchants[1],4767,4751,4740; //Atk3 Luck2 Vitality1
+ else if (.@i <= 792) setarray .@enchants[1],4767,4751,4741; //Atk3 Luck2 Vitality2
+ else if (.@i <= 803) setarray .@enchants[1],4764,4720,4700; //Critical5 Dexterity1 Strength1
+ else if (.@i <= 814) setarray .@enchants[1],4764,4720,4701; //Critical5 Dexterity1 Strength2
+ else if (.@i <= 825) setarray .@enchants[1],4764,4720,4730; //Critical5 Dexterity1 Agility1
+ else if (.@i <= 836) setarray .@enchants[1],4764,4720,4731; //Critical5 Dexterity1 Agility2
+ else if (.@i <= 847) setarray .@enchants[1],4764,4720,4740; //Critical5 Dexterity1 Vitality1
+ else if (.@i <= 858) setarray .@enchants[1],4764,4720,4741; //Critical5 Dexterity1 Vitality2
+ else if (.@i <= 869) setarray .@enchants[1],4764,4721,4700; //Critical5 Dexterity2 Strength1
+ else if (.@i <= 880) setarray .@enchants[1],4764,4721,4701; //Critical5 Dexterity2 Strength2
+ else if (.@i <= 891) setarray .@enchants[1],4764,4721,4730; //Critical5 Dexterity2 Agility1
+ else if (.@i <= 902) setarray .@enchants[1],4764,4721,4731; //Critical5 Dexterity2 Agility2
+ else if (.@i <= 913) setarray .@enchants[1],4764,4721,4740; //Critical5 Dexterity2 Vitality1
+ else if (.@i <= 924) setarray .@enchants[1],4764,4721,4741; //Critical5 Dexterity2 Vitality2
+ else if (.@i <= 935) setarray .@enchants[1],4764,4710,4700; //Critical5 Inteligence1 Strength1
+ else if (.@i <= 946) setarray .@enchants[1],4764,4710,4701; //Critical5 Inteligence1 Strength2
+ else if (.@i <= 957) setarray .@enchants[1],4764,4710,4730; //Critical5 Inteligence1 Agility1
+ else if (.@i <= 968) setarray .@enchants[1],4764,4710,4731; //Critical5 Inteligence1 Agility2
+ else if (.@i <= 979) setarray .@enchants[1],4764,4710,4740; //Critical5 Inteligence1 Vitality1
+ else if (.@i <= 990) setarray .@enchants[1],4764,4710,4741; //Critical5 Inteligence1 Vitality2
+ else if (.@i <= 1001) setarray .@enchants[1],4764,4711,4700; //Critical5 Inteligence2 Strength1
+ else if (.@i <= 1012) setarray .@enchants[1],4764,4711,4701; //Critical5 Inteligence2 Strength2
+ else if (.@i <= 1023) setarray .@enchants[1],4764,4711,4730; //Critical5 Inteligence2 Agility1
+ else if (.@i <= 1034) setarray .@enchants[1],4764,4711,4731; //Critical5 Inteligence2 Agility2
+ else if (.@i <= 1045) setarray .@enchants[1],4764,4711,4740; //Critical5 Inteligence2 Vitality1
+ else if (.@i <= 1056) setarray .@enchants[1],4764,4711,4741; //Critical5 Inteligence2 Vitality2
+ else if (.@i <= 1067) setarray .@enchants[1],4764,4750,4700; //Critical5 Luck1 Strength1
+ else if (.@i <= 1078) setarray .@enchants[1],4764,4750,4701; //Critical5 Luck1 Strength2
+ else if (.@i <= 1089) setarray .@enchants[1],4764,4750,4730; //Critical5 Luck1 Agility1
+ else if (.@i <= 1100) setarray .@enchants[1],4764,4750,4731; //Critical5 Luck1 Agility2
+ else if (.@i <= 1111) setarray .@enchants[1],4764,4750,4740; //Critical5 Luck1 Vitality1
+ else if (.@i <= 1122) setarray .@enchants[1],4764,4750,4741; //Critical5 Luck1 Vitality2
+ else if (.@i <= 1133) setarray .@enchants[1],4764,4751,4700; //Critical5 Luck2 Strength1
+ else if (.@i <= 1144) setarray .@enchants[1],4764,4751,4701; //Critical5 Luck2 Strength2
+ else if (.@i <= 1155) setarray .@enchants[1],4764,4751,4730; //Critical5 Luck2 Agility1
+ else if (.@i <= 1166) setarray .@enchants[1],4764,4751,4731; //Critical5 Luck2 Agility2
+ else if (.@i <= 1177) setarray .@enchants[1],4764,4751,4740; //Critical5 Luck2 Vitality1
+ else if (.@i <= 1188) setarray .@enchants[1],4764,4751,4741; //Critical5 Luck2 Vitality2
+ else if (.@i <= 1199) setarray .@enchants[1],4765,4720,4700; //Critical7 Dexterity1 Strength1
+ else if (.@i <= 1210) setarray .@enchants[1],4765,4720,4701; //Critical7 Dexterity1 Strength2
+ else if (.@i <= 1221) setarray .@enchants[1],4765,4720,4730; //Critical7 Dexterity1 Agility1
+ else if (.@i <= 1232) setarray .@enchants[1],4765,4720,4731; //Critical7 Dexterity1 Agility2
+ else if (.@i <= 1243) setarray .@enchants[1],4765,4720,4740; //Critical7 Dexterity1 Vitality1
+ else if (.@i <= 1254) setarray .@enchants[1],4765,4720,4741; //Critical7 Dexterity1 Vitality2
+ else if (.@i <= 1265) setarray .@enchants[1],4765,4721,4700; //Critical7 Dexterity2 Strength1
+ else if (.@i <= 1276) setarray .@enchants[1],4765,4721,4701; //Critical7 Dexterity2 Strength2
+ else if (.@i <= 1287) setarray .@enchants[1],4765,4721,4730; //Critical7 Dexterity2 Agility1
+ else if (.@i <= 1298) setarray .@enchants[1],4765,4721,4731; //Critical7 Dexterity2 Agility2
+ else if (.@i <= 1309) setarray .@enchants[1],4765,4721,4740; //Critical7 Dexterity2 Vitality1
+ else if (.@i <= 1320) setarray .@enchants[1],4765,4721,4741; //Critical7 Dexterity2 Vitality2
+ else if (.@i <= 1331) setarray .@enchants[1],4765,4710,4700; //Critical7 Inteligence1 Strength1
+ else if (.@i <= 1342) setarray .@enchants[1],4765,4710,4701; //Critical7 Inteligence1 Strength2
+ else if (.@i <= 1353) setarray .@enchants[1],4765,4710,4730; //Critical7 Inteligence1 Agility1
+ else if (.@i <= 1364) setarray .@enchants[1],4765,4710,4731; //Critical7 Inteligence1 Agility2
+ else if (.@i <= 1375) setarray .@enchants[1],4765,4710,4740; //Critical7 Inteligence1 Vitality1
+ else if (.@i <= 1386) setarray .@enchants[1],4765,4710,4741; //Critical7 Inteligence1 Vitality2
+ else if (.@i <= 1397) setarray .@enchants[1],4765,4711,4700; //Critical7 Inteligence2 Strength1
+ else if (.@i <= 1408) setarray .@enchants[1],4765,4711,4701; //Critical7 Inteligence2 Strength2
+ else if (.@i <= 1419) setarray .@enchants[1],4765,4711,4730; //Critical7 Inteligence2 Agility1
+ else if (.@i <= 1430) setarray .@enchants[1],4765,4711,4731; //Critical7 Inteligence2 Agility2
+ else if (.@i <= 1441) setarray .@enchants[1],4765,4711,4740; //Critical7 Inteligence2 Vitality1
+ else if (.@i <= 1452) setarray .@enchants[1],4765,4711,4741; //Critical7 Inteligence2 Vitality2
+ else if (.@i <= 1463) setarray .@enchants[1],4765,4750,4700; //Critical7 Luck1 Strength1
+ else if (.@i <= 1474) setarray .@enchants[1],4765,4750,4701; //Critical7 Luck1 Strength2
+ else if (.@i <= 1485) setarray .@enchants[1],4765,4750,4730; //Critical7 Luck1 Agility1
+ else if (.@i <= 1496) setarray .@enchants[1],4765,4750,4731; //Critical7 Luck1 Agility2
+ else if (.@i <= 1507) setarray .@enchants[1],4765,4750,4740; //Critical7 Luck1 Vitality1
+ else if (.@i <= 1518) setarray .@enchants[1],4765,4750,4741; //Critical7 Luck1 Vitality2
+ else if (.@i <= 1529) setarray .@enchants[1],4765,4751,4700; //Critical7 Luck2 Strength1
+ else if (.@i <= 1540) setarray .@enchants[1],4765,4751,4701; //Critical7 Luck2 Strength2
+ else if (.@i <= 1551) setarray .@enchants[1],4765,4751,4730; //Critical7 Luck2 Agility1
+ else if (.@i <= 1562) setarray .@enchants[1],4765,4751,4731; //Critical7 Luck2 Agility2
+ else if (.@i <= 1573) setarray .@enchants[1],4765,4751,4740; //Critical7 Luck2 Vitality1
+ else if (.@i <= 1584) setarray .@enchants[1],4765,4751,4741; //Critical7 Luck2 Vitality2
+ else if (.@i <= 1595) setarray .@enchants[1],4762,4720,4700; //Evasion6 Dexterity1 Strength1
+ else if (.@i <= 1606) setarray .@enchants[1],4762,4720,4701; //Evasion6 Dexterity1 Strength2
+ else if (.@i <= 1617) setarray .@enchants[1],4762,4720,4730; //Evasion6 Dexterity1 Agility1
+ else if (.@i <= 1628) setarray .@enchants[1],4762,4720,4731; //Evasion6 Dexterity1 Agility2
+ else if (.@i <= 1639) setarray .@enchants[1],4762,4720,4740; //Evasion6 Dexterity1 Vitality1
+ else if (.@i <= 1650) setarray .@enchants[1],4762,4720,4741; //Evasion6 Dexterity1 Vitality2
+ else if (.@i <= 1661) setarray .@enchants[1],4762,4721,4700; //Evasion6 Dexterity2 Strength1
+ else if (.@i <= 1672) setarray .@enchants[1],4762,4721,4701; //Evasion6 Dexterity2 Strength2
+ else if (.@i <= 1683) setarray .@enchants[1],4762,4721,4730; //Evasion6 Dexterity2 Agility1
+ else if (.@i <= 1694) setarray .@enchants[1],4762,4721,4731; //Evasion6 Dexterity2 Agility2
+ else if (.@i <= 1705) setarray .@enchants[1],4762,4721,4740; //Evasion6 Dexterity2 Vitality1
+ else if (.@i <= 1716) setarray .@enchants[1],4762,4721,4741; //Evasion6 Dexterity2 Vitality2
+ else if (.@i <= 1727) setarray .@enchants[1],4762,4710,4700; //Evasion6 Inteligence1 Strength1
+ else if (.@i <= 1738) setarray .@enchants[1],4762,4710,4701; //Evasion6 Inteligence1 Strength2
+ else if (.@i <= 1749) setarray .@enchants[1],4762,4710,4730; //Evasion6 Inteligence1 Agility1
+ else if (.@i <= 1760) setarray .@enchants[1],4762,4710,4731; //Evasion6 Inteligence1 Agility2
+ else if (.@i <= 1771) setarray .@enchants[1],4762,4710,4740; //Evasion6 Inteligence1 Vitality1
+ else if (.@i <= 1782) setarray .@enchants[1],4762,4710,4741; //Evasion6 Inteligence1 Vitality2
+ else if (.@i <= 1793) setarray .@enchants[1],4762,4711,4700; //Evasion6 Inteligence2 Strength1
+ else if (.@i <= 1804) setarray .@enchants[1],4762,4711,4701; //Evasion6 Inteligence2 Strength2
+ else if (.@i <= 1815) setarray .@enchants[1],4762,4711,4730; //Evasion6 Inteligence2 Agility1
+ else if (.@i <= 1826) setarray .@enchants[1],4762,4711,4731; //Evasion6 Inteligence2 Agility2
+ else if (.@i <= 1837) setarray .@enchants[1],4762,4711,4740; //Evasion6 Inteligence2 Vitality1
+ else if (.@i <= 1848) setarray .@enchants[1],4762,4711,4741; //Evasion6 Inteligence2 Vitality2
+ else if (.@i <= 1859) setarray .@enchants[1],4762,4750,4700; //Evasion6 Luck1 Strength1
+ else if (.@i <= 1870) setarray .@enchants[1],4762,4750,4701; //Evasion6 Luck1 Strength2
+ else if (.@i <= 1881) setarray .@enchants[1],4762,4750,4730; //Evasion6 Luck1 Agility1
+ else if (.@i <= 1892) setarray .@enchants[1],4762,4750,4731; //Evasion6 Luck1 Agility2
+ else if (.@i <= 1903) setarray .@enchants[1],4762,4750,4740; //Evasion6 Luck1 Vitality1
+ else if (.@i <= 1914) setarray .@enchants[1],4762,4750,4741; //Evasion6 Luck1 Vitality2
+ else if (.@i <= 1925) setarray .@enchants[1],4762,4751,4700; //Evasion6 Luck2 Strength1
+ else if (.@i <= 1936) setarray .@enchants[1],4762,4751,4701; //Evasion6 Luck2 Strength2
+ else if (.@i <= 1947) setarray .@enchants[1],4762,4751,4730; //Evasion6 Luck2 Agility1
+ else if (.@i <= 1958) setarray .@enchants[1],4762,4751,4731; //Evasion6 Luck2 Agility2
+ else if (.@i <= 1969) setarray .@enchants[1],4762,4751,4740; //Evasion6 Luck2 Vitality1
+ else if (.@i <= 1980) setarray .@enchants[1],4762,4751,4741; //Evasion6 Luck2 Vitality2
+ else if (.@i <= 1991) setarray .@enchants[1],4763,4720,4700; //Evasion12 Dexterity1 Strength1
+ else if (.@i <= 2002) setarray .@enchants[1],4763,4720,4701; //Evasion12 Dexterity1 Strength2
+ else if (.@i <= 2013) setarray .@enchants[1],4763,4720,4730; //Evasion12 Dexterity1 Agility1
+ else if (.@i <= 2024) setarray .@enchants[1],4763,4720,4731; //Evasion12 Dexterity1 Agility2
+ else if (.@i <= 2035) setarray .@enchants[1],4763,4720,4740; //Evasion12 Dexterity1 Vitality1
+ else if (.@i <= 2046) setarray .@enchants[1],4763,4720,4741; //Evasion12 Dexterity1 Vitality2
+ else if (.@i <= 2057) setarray .@enchants[1],4763,4721,4700; //Evasion12 Dexterity2 Strength1
+ else if (.@i <= 2068) setarray .@enchants[1],4763,4721,4701; //Evasion12 Dexterity2 Strength2
+ else if (.@i <= 2079) setarray .@enchants[1],4763,4721,4730; //Evasion12 Dexterity2 Agility1
+ else if (.@i <= 2090) setarray .@enchants[1],4763,4721,4731; //Evasion12 Dexterity2 Agility2
+ else if (.@i <= 2101) setarray .@enchants[1],4763,4721,4740; //Evasion12 Dexterity2 Vitality1
+ else if (.@i <= 2112) setarray .@enchants[1],4763,4721,4741; //Evasion12 Dexterity2 Vitality2
+ else if (.@i <= 2123) setarray .@enchants[1],4763,4710,4700; //Evasion12 Inteligence1 Strength1
+ else if (.@i <= 2134) setarray .@enchants[1],4763,4710,4701; //Evasion12 Inteligence1 Strength2
+ else if (.@i <= 2145) setarray .@enchants[1],4763,4710,4730; //Evasion12 Inteligence1 Agility1
+ else if (.@i <= 2156) setarray .@enchants[1],4763,4710,4731; //Evasion12 Inteligence1 Agility2
+ else if (.@i <= 2167) setarray .@enchants[1],4763,4710,4740; //Evasion12 Inteligence1 Vitality1
+ else if (.@i <= 2178) setarray .@enchants[1],4763,4710,4741; //Evasion12 Inteligence1 Vitality2
+ else if (.@i <= 2189) setarray .@enchants[1],4763,4711,4700; //Evasion12 Inteligence2 Strength1
+ else if (.@i <= 2200) setarray .@enchants[1],4763,4711,4701; //Evasion12 Inteligence2 Strength2
+ else if (.@i <= 2211) setarray .@enchants[1],4763,4711,4730; //Evasion12 Inteligence2 Agility1
+ else if (.@i <= 2222) setarray .@enchants[1],4763,4711,4731; //Evasion12 Inteligence2 Agility2
+ else if (.@i <= 2233) setarray .@enchants[1],4763,4711,4740; //Evasion12 Inteligence2 Vitality1
+ else if (.@i <= 2244) setarray .@enchants[1],4763,4711,4741; //Evasion12 Inteligence2 Vitality2
+ else if (.@i <= 2255) setarray .@enchants[1],4763,4750,4700; //Evasion12 Luck1 Strength1
+ else if (.@i <= 2266) setarray .@enchants[1],4763,4750,4701; //Evasion12 Luck1 Strength2
+ else if (.@i <= 2277) setarray .@enchants[1],4763,4750,4730; //Evasion12 Luck1 Agility1
+ else if (.@i <= 2288) setarray .@enchants[1],4763,4750,4731; //Evasion12 Luck1 Agility2
+ else if (.@i <= 2299) setarray .@enchants[1],4763,4750,4740; //Evasion12 Luck1 Vitality1
+ else if (.@i <= 2310) setarray .@enchants[1],4763,4750,4741; //Evasion12 Luck1 Vitality2
+ else if (.@i <= 2321) setarray .@enchants[1],4763,4751,4700; //Evasion12 Luck2 Strength1
+ else if (.@i <= 2332) setarray .@enchants[1],4763,4751,4701; //Evasion12 Luck2 Strength2
+ else if (.@i <= 2343) setarray .@enchants[1],4763,4751,4730; //Evasion12 Luck2 Agility1
+ else if (.@i <= 2354) setarray .@enchants[1],4763,4751,4731; //Evasion12 Luck2 Agility2
+ else if (.@i <= 2365) setarray .@enchants[1],4763,4751,4740; //Evasion12 Luck2 Vitality1
+ else if (.@i <= 2376) setarray .@enchants[1],4763,4751,4741; //Evasion12 Luck2 Vitality2
+ else if (.@i <= 2387) setarray .@enchants[1],4760,4720,4700; //Matk1 Dexterity1 Strength1
+ else if (.@i <= 2398) setarray .@enchants[1],4760,4720,4701; //Matk1 Dexterity1 Strength2
+ else if (.@i <= 2409) setarray .@enchants[1],4760,4720,4730; //Matk1 Dexterity1 Agility1
+ else if (.@i <= 2420) setarray .@enchants[1],4760,4720,4731; //Matk1 Dexterity1 Agility2
+ else if (.@i <= 2431) setarray .@enchants[1],4760,4720,4740; //Matk1 Dexterity1 Vitality1
+ else if (.@i <= 2442) setarray .@enchants[1],4760,4720,4741; //Matk1 Dexterity1 Vitality2
+ else if (.@i <= 2453) setarray .@enchants[1],4760,4721,4700; //Matk1 Dexterity2 Strength1
+ else if (.@i <= 2464) setarray .@enchants[1],4760,4721,4701; //Matk1 Dexterity2 Strength2
+ else if (.@i <= 2475) setarray .@enchants[1],4760,4721,4730; //Matk1 Dexterity2 Agility1
+ else if (.@i <= 2486) setarray .@enchants[1],4760,4721,4731; //Matk1 Dexterity2 Agility2
+ else if (.@i <= 2497) setarray .@enchants[1],4760,4721,4740; //Matk1 Dexterity2 Vitality1
+ else if (.@i <= 2508) setarray .@enchants[1],4760,4721,4741; //Matk1 Dexterity2 Vitality2
+ else if (.@i <= 2519) setarray .@enchants[1],4760,4710,4700; //Matk1 Inteligence1 Strength1
+ else if (.@i <= 2530) setarray .@enchants[1],4760,4710,4701; //Matk1 Inteligence1 Strength2
+ else if (.@i <= 2541) setarray .@enchants[1],4760,4710,4730; //Matk1 Inteligence1 Agility1
+ else if (.@i <= 2552) setarray .@enchants[1],4760,4710,4731; //Matk1 Inteligence1 Agility2
+ else if (.@i <= 2563) setarray .@enchants[1],4760,4710,4740; //Matk1 Inteligence1 Vitality1
+ else if (.@i <= 2574) setarray .@enchants[1],4760,4710,4741; //Matk1 Inteligence1 Vitality2
+ else if (.@i <= 2585) setarray .@enchants[1],4760,4711,4700; //Matk1 Inteligence2 Strength1
+ else if (.@i <= 2596) setarray .@enchants[1],4760,4711,4701; //Matk1 Inteligence2 Strength2
+ else if (.@i <= 2607) setarray .@enchants[1],4760,4711,4730; //Matk1 Inteligence2 Agility1
+ else if (.@i <= 2618) setarray .@enchants[1],4760,4711,4731; //Matk1 Inteligence2 Agility2
+ else if (.@i <= 2629) setarray .@enchants[1],4760,4711,4740; //Matk1 Inteligence2 Vitality1
+ else if (.@i <= 2640) setarray .@enchants[1],4760,4711,4741; //Matk1 Inteligence2 Vitality2
+ else if (.@i <= 2651) setarray .@enchants[1],4760,4750,4700; //Matk1 Luck1 Strength1
+ else if (.@i <= 2662) setarray .@enchants[1],4760,4750,4701; //Matk1 Luck1 Strength2
+ else if (.@i <= 2673) setarray .@enchants[1],4760,4750,4730; //Matk1 Luck1 Agility1
+ else if (.@i <= 2684) setarray .@enchants[1],4760,4750,4731; //Matk1 Luck1 Agility2
+ else if (.@i <= 2695) setarray .@enchants[1],4760,4750,4740; //Matk1 Luck1 Vitality1
+ else if (.@i <= 2706) setarray .@enchants[1],4760,4750,4741; //Matk1 Luck1 Vitality2
+ else if (.@i <= 2717) setarray .@enchants[1],4760,4751,4700; //Matk1 Luck2 Strength1
+ else if (.@i <= 2728) setarray .@enchants[1],4760,4751,4701; //Matk1 Luck2 Strength2
+ else if (.@i <= 2739) setarray .@enchants[1],4760,4751,4730; //Matk1 Luck2 Agility1
+ else if (.@i <= 2750) setarray .@enchants[1],4760,4751,4731; //Matk1 Luck2 Agility2
+ else if (.@i <= 2761) setarray .@enchants[1],4760,4751,4740; //Matk1 Luck2 Vitality1
+ else if (.@i <= 2772) setarray .@enchants[1],4760,4751,4741; //Matk1 Luck2 Vitality2
+ else if (.@i <= 2783) setarray .@enchants[1],4761,4720,4700; //Matk2 Dexterity1 Strength1
+ else if (.@i <= 2794) setarray .@enchants[1],4761,4720,4701; //Matk2 Dexterity1 Strength2
+ else if (.@i <= 2805) setarray .@enchants[1],4761,4720,4730; //Matk2 Dexterity1 Agility1
+ else if (.@i <= 2816) setarray .@enchants[1],4761,4720,4731; //Matk2 Dexterity1 Agility2
+ else if (.@i <= 2827) setarray .@enchants[1],4761,4720,4740; //Matk2 Dexterity1 Vitality1
+ else if (.@i <= 2838) setarray .@enchants[1],4761,4720,4741; //Matk2 Dexterity1 Vitality2
+ else if (.@i <= 2849) setarray .@enchants[1],4761,4721,4700; //Matk2 Dexterity2 Strength1
+ else if (.@i <= 2860) setarray .@enchants[1],4761,4721,4701; //Matk2 Dexterity2 Strength2
+ else if (.@i <= 2871) setarray .@enchants[1],4761,4721,4730; //Matk2 Dexterity2 Agility1
+ else if (.@i <= 2882) setarray .@enchants[1],4761,4721,4731; //Matk2 Dexterity2 Agility2
+ else if (.@i <= 2893) setarray .@enchants[1],4761,4721,4740; //Matk2 Dexterity2 Vitality1
+ else if (.@i <= 2904) setarray .@enchants[1],4761,4721,4741; //Matk2 Dexterity2 Vitality2
+ else if (.@i <= 2915) setarray .@enchants[1],4761,4710,4700; //Matk2 Inteligence1 Strength1
+ else if (.@i <= 2926) setarray .@enchants[1],4761,4710,4701; //Matk2 Inteligence1 Strength2
+ else if (.@i <= 2937) setarray .@enchants[1],4761,4710,4730; //Matk2 Inteligence1 Agility1
+ else if (.@i <= 2948) setarray .@enchants[1],4761,4710,4731; //Matk2 Inteligence1 Agility2
+ else if (.@i <= 2959) setarray .@enchants[1],4761,4710,4740; //Matk2 Inteligence1 Vitality1
+ else if (.@i <= 2970) setarray .@enchants[1],4761,4710,4741; //Matk2 Inteligence1 Vitality2
+ else if (.@i <= 2981) setarray .@enchants[1],4761,4711,4700; //Matk2 Inteligence2 Strength1
+ else if (.@i <= 2992) setarray .@enchants[1],4761,4711,4701; //Matk2 Inteligence2 Strength2
+ else if (.@i <= 3003) setarray .@enchants[1],4761,4711,4730; //Matk2 Inteligence2 Agility1
+ else if (.@i <= 3014) setarray .@enchants[1],4761,4711,4731; //Matk2 Inteligence2 Agility2
+ else if (.@i <= 3025) setarray .@enchants[1],4761,4711,4740; //Matk2 Inteligence2 Vitality1
+ else if (.@i <= 3036) setarray .@enchants[1],4761,4711,4741; //Matk2 Inteligence2 Vitality2
+ else if (.@i <= 3047) setarray .@enchants[1],4761,4750,4700; //Matk2 Luck1 Strength1
+ else if (.@i <= 3058) setarray .@enchants[1],4761,4750,4701; //Matk2 Luck1 Strength2
+ else if (.@i <= 3069) setarray .@enchants[1],4761,4750,4730; //Matk2 Luck1 Agility1
+ else if (.@i <= 3080) setarray .@enchants[1],4761,4750,4731; //Matk2 Luck1 Agility2
+ else if (.@i <= 3091) setarray .@enchants[1],4761,4750,4740; //Matk2 Luck1 Vitality1
+ else if (.@i <= 3102) setarray .@enchants[1],4761,4750,4741; //Matk2 Luck1 Vitality2
+ else if (.@i <= 3113) setarray .@enchants[1],4761,4751,4700; //Matk2 Luck2 Strength1
+ else if (.@i <= 3124) setarray .@enchants[1],4761,4751,4701; //Matk2 Luck2 Strength2
+ else if (.@i <= 3135) setarray .@enchants[1],4761,4751,4730; //Matk2 Luck2 Agility1
+ else if (.@i <= 3146) setarray .@enchants[1],4761,4751,4731; //Matk2 Luck2 Agility2
+ else if (.@i <= 3157) setarray .@enchants[1],4761,4751,4740; //Matk2 Luck2 Vitality1
+ else if (.@i <= 3168) setarray .@enchants[1],4761,4751,4741; //Matk2 Luck2 Vitality2
+ else if (.@i <= 3179) setarray .@enchants[1],4761,4720,4700; //Matk2 Dexterity1 Strength1
+ else if (.@i <= 3181) setarray .@enchants[1],4761,4712,4712; //Matk2 Inteligence3 Inteligence3
+ else if (.@i <= 3183) setarray .@enchants[1],4765,4732,4732; //Critical7 Agility3 Agility3
+ else if (.@i <= 3185) setarray .@enchants[1],4763,4752,4753; //Evasion12 Luck3 Luck4
+ else if (.@i <= 3187) setarray .@enchants[1],4763,4742,4742; //Evasion12 Vitality3 Vitality3
+ else if (.@i <= 3189) setarray .@enchants[1],4763,4722,4722; //Evasion12 Dexterity3 Dexterity3
+ else if (.@i <= 3191) setarray .@enchants[1],4742,4742,4742; //Vitality3 Vitality3 Vitality3
+ else if (.@i <= 3193) setarray .@enchants[1],4761,4722,4722; //Matk2 Dexterity3 Dexterity3
+ else if (.@i <= 3195) setarray .@enchants[1],4767,4702,4702; //Atk3 Strength3 Strength3
+ else if (.@i <= 3197) setarray .@enchants[1],4763,4732,4732; //Evasion12 Agility3 Agility3
+ else if (.@i <= 4568) return 0;
+
+ getitem2 getarg(0),1,1,0,0,0,.@enchants[1],.@enchants[2],.@enchants[3];
+ return 1;
+}
+mora,105,176,4 script Master Tailor#pa0829 509,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ if (countitem(6380) < 5 || countitem(15024) < 1) {
+ mes "[Master Tailor]";
+ mes "With my touch, I can turn a typical army padding into a piece of art. I'm Kay the Master Tailor, creating art with army paddings.";
+ next;
+ mes "[Master Tailor]";
+ mes "Well, what's in a name? I can turn your army padding into a piece of art if you bring ^ff00005 Mora Coins and an Army Padding^000000.";
+ if (countitem(6380)) {
+ next;
+ mes "[Master Tailor]";
+ mes "I happen to have a few army paddings in stock. Would you like to buy one? The price is 1 Mora Coin. So cheap.";
+ next;
+ switch(select("Maybe next time.:I'll buy one now.")) {
+ case 1:
+ mes "[Master Tailor]";
+ mes "Okay, I understand.";
+ mes "Come back for one if you change your mind.";
+ close;
+ case 2:
+ delitem 6380,1; //Mora_Coin
+ getitem 15024,1; //Army_Padding
+ mes "[Master Tailor]";
+ mes "Here it is.";
+ mes "It's very nice and fluffy. Please come back.";
+ close;
+ }
+ }
+ close;
+ }
+ mes "[Master Tailor]";
+ mes "Have you come to add art to one of your army paddings?";
+ next;
+ switch(select("Please tell me more.:Yes, I have.")) {
+ case 1:
+ mes "[Master Tailor]";
+ mes "A typical army padding isn't warm enough. It feels rough on your skin and doesn't look good. And artistic value? It has next to none.";
+ next;
+ mes "[Master Tailor]";
+ mes "However, I'll embroider it with velvet threads, and add three options to it.";
+ next;
+ mes "[Master Tailor]";
+ mes "Bring me ^8888005 Mora Coins^000000 and an Army Padding, and we can add some art together!";
+ close;
+ case 2:
+ mes "[Master Tailor]";
+ mes "I'm telling you just in case - I'll do whatever I need to do with your army padding, whether it's brand-new or has been mended before.";
+ next;
+ mes "[Master Tailor]";
+ mes "So if you have with you an army padding mended to your liking, put it in a safe place and come back.";
+ next;
+ mes "[Master Tailor]";
+ mes "And another thing - once I fail to add art to it, it becomes unusable... you'll need to buy a new one in that case.";
+ next;
+ switch(select("Come on, what's the rush?:Okay! Let's do it!!")) {
+ case 1:
+ mes "[Master Tailor]";
+ mes "What's wrong with you?";
+ mes "The villagers keep me busy enough.";
+ close;
+ case 2:
+ if (countitem(6380) < 5 || countitem(15024) == 0) {
+ mes "[Master Tailor]";
+ mes "It looks like you don't have everything you need.";
+ next;
+ mes "[Master Tailor]";
+ mes "You have to have 5 Mora Coins and an Army Padding with you before I can do my work.";
+ close;
+ }
+ if (callfunc("F_Mora_Enchant",15024) == 0) {
+ mes "[Master Tailor]";
+ mes "Oh......";
+ mes "I can't believe I messed up.";
+ next;
+ mes "[Master Tailor]";
+ mes "I want to be alone. Go away!";
+ close;
+ }
+ mes "[Master Tailor]";
+ mes "My art looks great.";
+ close;
+ }
+ }
+}
+
+mora,123,177,6 script Pendant Crafter#pa0829 509,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ if (countitem(6380) < 5 || countitem(2858) == 0) {
+ mes "[Pendant Crafter]";
+ mes "My job is to polish the stone in a Guardian's Pendant, and then carve a symbol with special power on it.";
+ next;
+ mes "[Pendant Crafter]";
+ mes "The process gives the Guardian's Pendant more power than an ordinary accessory.";
+ next;
+ mes "[Pendant Crafter]";
+ mes "If you're interested, I can work on your pendant for ^ff00005 Mora Coins^000000. Of course you need to have a Guardian's Pendant so I can work on with you.";
+ close;
+ }
+ mes "[Pendant Crafter]";
+ mes "Have you come to have your Guardian's Pendant upgraded?";
+ next;
+ switch(select("Please tell me more.:Yes, I have.")) {
+ case 1:
+ mes "[Pendant Crafter]";
+ mes "My job is to polish the stone in a Guardian's Pendant, and then carve a symbol with special power on it.";
+ next;
+ mes "[Pendant Crafter]";
+ mes "The process gives the Guardian's Pendant more power than an ordinary accessory.";
+ next;
+ mes "[Pendant Crafter]";
+ mes "If you're interested, I can work on your pendant for ^ff00005 Mora Coins^000000. Of course you need to have a Guardian's Pendant so I can work on with you.";
+ close;
+ case 2:
+ mes "[Pendant Crafter]";
+ mes "I'm telling you just in case - ";
+ mes "If I work on a Guardian's Pendant that's been upgraded before, it loses its original power.";
+ next;
+ mes "[Pendant Crafter]";
+ mes "And worse, it can lose its power and become an ordinary pendant. Of course, stone is not as susceptible to damage as cloth, so you won't lose the pendant itself.";
+ next;
+ switch(select("Come on, what's the rush?:Okay! Let's do it!!")) {
+ case 1:
+ mes "[Pendant Crafter]";
+ mes "Come back when you're not in a hurry. I always have a lot of time on my hands.";
+ close;
+ case 2:
+ if (countitem(6380) < 5 || countitem(2858) == 0) {
+ mes "[Pendant Crafter]";
+ mes "It looks like you don't have everything you need.";
+ next;
+ mes "[Pendant Crafter]";
+ mes "You must have 5 Mora Coins and a Guardian's Pendant with you before I can do my work.";
+ close;
+ }
+ if (callfunc("F_Mora_Enchant",2858) == 0) {
+ getitem 2858,1; //Pendant_Of_Guardian
+ mes "[Pendant Crafter]";
+ mes "What~!!";
+ mes "What on earth is wrong with it!!";
+ close;
+ }
+ mes "[Pendant Crafter]";
+ mes "Looks like I did it!";
+ close;
+ }
+ }
+}
+
+mora,134,166,4 script Bulberry Westhood#pa0829 509,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ if (countitem(6380) < 5 || countitem(2568) == 0) {
+ mes "[Bulberry Westhood]";
+ mes "I'm Bulberry Westhood, keeping the tradition of quality hoods alive.";
+ next;
+ mes "[Bulberry Westhood]";
+ mes "I only handle quality items - not random scarfs from a marketplace.";
+ next;
+ mes "[Bulberry Westhood]";
+ mes "If you have anything that you think is of high enough quality, come find me with ^ff00005 Mora Coins^000000.";
+ next;
+ mes "[Bulberry Westhood]";
+ mes "I can improve its high quality with my own hands.";
+ close;
+ }
+ mes "[Bulberry Westhood]";
+ mes "So you have a Loki's Scarf 1042 Special Edition. You really have an eye for quality. Can I start working on it right away?";
+ next;
+ switch(select("I don't get it.:Yes, please.")) {
+ case 1:
+ mes "[Bulberry Westhood]";
+ mes "Like I said, I only handle quality items - not random scarfs from a marketplace.";
+ next;
+ mes "[Bulberry Westhood]";
+ mes "This Loki's Scarf you have is awesome. It's a limited edition product with Loki's crest on it!";
+ next;
+ mes "[Bulberry Westhood]";
+ mes "My specialty is bringing out the hidden power at the small cost of... ";
+ mes "5 Mora Coins.";
+ next;
+ mes "[Bulberry Westhood]";
+ mes "Come back if you change your mind.";
+ close;
+ case 2:
+ mes "[Bulberry Westhood]";
+ mes "I'm telling you just in case - ";
+ mes "If I work on a Loki's Scarf that's been upgraded before, it loses its original power.";
+ next;
+ mes "[Bulberry Westhood]";
+ mes "And worse, it can lose all its power becoming an ordinary scarf.";
+ next;
+ mes "[Bulberry Westhood]";
+ mes "Of course, the Loki's Scarf is a quality item, so you won't lose the scarf itself in the process.";
+ next;
+ switch(select("Maybe later, sir...:I'd like to own a quality item!")) {
+ case 1:
+ mes "[Bulberry Westhood]";
+ mes "Ha...!";
+ mes "You say 'later' when you can have the best quality item right away? Well, have it your own way.";
+ close;
+ case 2:
+ if (countitem(6380) < 5 || countitem(2568) == 0) {
+ mes "[Bulberry Westhood]";
+ mes "It looks like you don't everything you need.";
+ next;
+ mes "[Bulberry Westhood]";
+ mes "You must have 5 Mora Coins and a Loki's Scarf with you before you can have the best quality item.";
+ close;
+ }
+ if (callfunc("F_Mora_Enchant",2568) == 0) {
+ getitem 2568,1; //Muffler_Of_Roki
+ mes "[Bulberry Westhood]";
+ mes "Aaarrgghh, this is impossible!";
+ mes "My! My Loki's Scarf!....";
+ next;
+ mes "[Bulberry Westhood]";
+ mes "Oh, I apologize for my disgraceful behavior. I was too upset.";
+ next;
+ mes "[Bulberry Westhood]";
+ mes "Fortunately, it's still in its original state before I started working on it. It's not torn or stretched. It's a quality item after all. Oh ho ho~";
+ close;
+ }
+ mes "[Bulberry Westhood]";
+ mes "Wow~ mission complete!";
+ close;
+ }
+ }
+}
diff --git a/npc/re/merchants/flute.txt b/npc/re/merchants/flute.txt
index a9b9c2367..8eb987e08 100644
--- a/npc/re/merchants/flute.txt
+++ b/npc/re/merchants/flute.txt
@@ -1,18 +1,18 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Falcon & Wolf Flute Trader
-//===== By: ==================================================
+//===== By: ==================================================
//= Masao, Muad_Dib, Ziu
-//===== Current Version: =====================================
+//===== Current Version: =====================================
//= 1.2
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
//= Sells Falcon Flute and Wolf Flute.
-//===== Additional Comments: =================================
+//===== Additional Comments: =================================
//= 1.0 First Version. [Masao]
//= 1.1 Added Baby Hunter and Baby Ranger check. bugreport:5728 [Masao]
//= 1.2 Added Wolf Flute trader, optimized. [Euphy]
-//============================================================
+//============================================================
- script Falcon Flute Trader::fflute -1,{
mes "[Falcon Flute Trader]";
diff --git a/npc/re/merchants/inn.txt b/npc/re/merchants/inn.txt
index e8eb922a5..14e1a2eff 100644
--- a/npc/re/merchants/inn.txt
+++ b/npc/re/merchants/inn.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Inn Npcs
//===== By: ==================================================
//= c, L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Inn Npcs, Save and Heal
//===== Additional Comments: =================================
diff --git a/npc/re/merchants/quivers.txt b/npc/re/merchants/quivers.txt
new file mode 100644
index 000000000..45e44401a
--- /dev/null
+++ b/npc/re/merchants/quivers.txt
@@ -0,0 +1,121 @@
+//===== rAthena Script =======================================
+//= Arrow Quivers
+//===== By: ==================================================
+//= Muad_Dib (Prometheus Project); L0ne_W0lf
+//===== Current Version: =====================================
+//= 1.1
+//===== Compatible With: =====================================
+//= rAthena SVN
+//===== Description: =========================================
+//= Turns arrows into Arrow Quivers.
+// Breakdown of Subroutine "S_BuyQuiver"
+// arg(0): Type of Arrow to be packaged (item ID).
+// arg(1): How many of each 'getarg(0)' arrow per quiver.
+// arg(2): The cost of making a 'getarg(0)' quiver.
+// arg(3): The quiver given by the NPC (item ID).
+//===== Additional Comments: =================================
+//= 1.0 Added Mora NPC. [Euphy]
+//= 1.1 Updated to match the official scripts. [Euphy]
+//============================================================
+
+mora,106,117,3 script Quiver Maker#mora 516,{
+ if (checkweight(1201,1) == 0) {
+ mes "[Quiver Maker]";
+ mes "You have too many things with you.";
+ mes "Make some space in your inventory and come back. I'll tell you something interesting.";
+ close;
+ }
+ if (MaxWeight - Weight < 2000) {
+ mes "[Quiver Maker]";
+ mes "You seem worn out with all that stuff.";
+ mes "Make some space in your inventory and come back. I'll tell you something interesting.";
+ close;
+ }
+ mes "[Quiver Maker]";
+ mes "Mora villagers ask what good quivers are. They just don't know how the world works.";
+ mes "No wonder they don't know a thing about quivers - spreading jam over leaves all day long.";
+ next;
+ switch(select("Please make me a quiver.:What's a quiver?")) {
+ case 1:
+ mes "[Quiver Maker]";
+ mes "At last someone appreciates a quiver!";
+ mes "I can make Elven Quivers and Hunting Quivers.";
+ mes "Which do you need?";
+ next;
+ switch(select("An Elven Quiver:A Hunting Quiver:I don't need a quiver.")) {
+ case 1: callsub S_BuyQuiver,1773,500,500,12575; //Arrow_Of_Elf_Cntr
+ case 2: callsub S_BuyQuiver,1774,500,500,12576; //Hunting_Arrow_Cntr
+ case 3:
+ mes "[Quiver Maker]";
+ mes "You can buy arrows off the tool merchant next to me.";
+ close;
+ }
+ case 2:
+ mes "[Quiver Maker]";
+ mes "An arrow may be thin and light, but carrying hundreds and thousands of arrows is like carrying a whole log.";
+ next;
+ mes "[Quiver Maker]";
+ mes "But when you have quivers, you can put arrows in them and save weight and space.";
+ mes "If you're interested in one, I'll stitch one up for you.";
+ close;
+ }
+ end;
+
+S_BuyQuiver:
+ if (countitem(getarg(0)) < getarg(1)) {
+ mes "[Quiver Maker]";
+ mes "Bring more than "+getarg(1)+" "+getitemname(getarg(0))+" and I'll make you a quiver.";
+ close;
+ }
+ mes "[Quiver Maker]";
+ mes "Oh, I see you have "+getitemname(getarg(0))+" in your hand!";
+ mes "Are you interested in using a quiver? It's really convenient!";
+ mes "If you're interested, I can trade "+getarg(1)+" of those arrows for one of these quivers for ^FF3131"+getarg(2)+" zeny^000000.";
+ next;
+ switch(select("Trade all the arrows you have:Get only one quiver:Don't trade")) {
+ case 1:
+ set .@arrows, countitem(getarg(0));
+ set .@quiver, .@arrows / getarg(1);
+ set .@arrows_used, .@quiver * getarg(1);
+ set .@arrow_zeny01, .@quiver * getarg(2);
+ mes "The number of arrows you have : ^3131FF"+.@arrows+"^000000";
+ mes "The number of quivers available : ^3131FF"+.@quiver+"^000000";
+ mes "Zeny needed for trade : ^3131FF"+.@arrow_zeny01+" zeny^000000";
+ next;
+ mes "Trade?";
+ next;
+ if(select("Trade:Don't trade") == 2) {
+ mes "[Quiver Maker]";
+ mes "Hey, you don't doubt my skills, do you?";
+ close;
+ }
+ break;
+ case 2:
+ set .@quiver, 1;
+ set .@arrows_used, getarg(1);
+ set .@arrow_zeny01, getarg(2);
+ set .@zeny_mes,1;
+ break;
+ case 3:
+ mes "[Quiver Maker]";
+ mes "Hey, you don't doubt my skills, do you?";
+ close;
+ }
+ if (Zeny < .@arrow_zeny01) {
+ mes "[Quiver Maker]";
+ if (.@zeny_mes == 1)
+ mes "I said I'd accept human coins just for you, and you still don't want to spend the money?";
+ else
+ mes "You really don't expect to get your hands on a masterpiece for nothing, do you?";
+ close;
+ }
+ mes "[Quiver Maker]";
+ mes "Hey, here you are.";
+ mes "There is ^3131FFsomething you need to know^000000 - try to remember it.";
+ mes "^FF0000You can't use quivers when your encumbrance is over 70%.^000000";
+ mes "You'd better keep that in mind, or you might be in trouble later.";
+ set Zeny, Zeny-.@arrow_zeny01;
+ delitem getarg(0),.@arrows_used;
+ getitem getarg(3),.@quiver;
+ close;
+}
diff --git a/npc/re/merchants/refine.txt b/npc/re/merchants/refine.txt
index 4b02e0d22..27a09fce7 100644
--- a/npc/re/merchants/refine.txt
+++ b/npc/re/merchants/refine.txt
@@ -1,7 +1,7 @@
//===== Hercules Script ======================================
//= Renewal Refining NPCs
//===== By: ==================================================
-//= rAthena Dev Team
+//= Hercules Dev Team
//===== Current Version: =====================================
//= 1.0a
//===== Compatible With: =====================================
diff --git a/npc/re/merchants/renters.txt b/npc/re/merchants/renters.txt
index 5152fe102..e4f1a02c7 100644
--- a/npc/re/merchants/renters.txt
+++ b/npc/re/merchants/renters.txt
@@ -1,7 +1,7 @@
//===== Hercules Script ======================================
//= Renters
//===== By: ==================================================
-//= rAthena Dev Team
+//= Hercules Dev Team
//===== Current Version: =====================================
//= 2.1
//===== Description: =========================================
@@ -146,7 +146,7 @@ prontera,125,208,5 script Peco Peco Remover 105,{
// Magic Gear Renter
//============================================================
-prontera,163,178,4 script Magic Gear Master 105,{
+prontera,163,178,3 script Magic Gear Master 105,{
mes "[Magic Gear Master]";
if (Class == Job_Mechanic || Class == Job_Mechanic_T || Class == Job_Baby_Mechanic) {
mes "Welcome. Would you like to rent a Magic Gear?";
@@ -179,4 +179,4 @@ prontera,163,178,4 script Magic Gear Master 105,{
mes "How may I help you?";
mes "Magic Gears are only available for Mechanics.";
close;
-} \ No newline at end of file
+}
diff --git a/npc/re/merchants/shops.txt b/npc/re/merchants/shops.txt
index 35b1baf95..b27e5cc1d 100644
--- a/npc/re/merchants/shops.txt
+++ b/npc/re/merchants/shops.txt
@@ -1,7 +1,7 @@
//===== Hercules Script ======================================
//= Shops
//===== By: ==================================================
-//= rAthena Dev Team
+//= Hercules Dev Team
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
diff --git a/npc/re/mobs/dungeons/dew_dun.txt b/npc/re/mobs/dungeons/dew_dun.txt
index 809295e0c..1080a1cf1 100644
--- a/npc/re/mobs/dungeons/dew_dun.txt
+++ b/npc/re/mobs/dungeons/dew_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script ========================================
+//===== Hercules Script ======================================
//= Dewata Dungeon Monster Spawn Script
//===== By: ==================================================
//= Chilly
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Official kRO monster spawns
//===== Additional Comments: =================================
diff --git a/npc/re/mobs/dungeons/dic_dun.txt b/npc/re/mobs/dungeons/dic_dun.txt
index e259f0465..f173fec0e 100644
--- a/npc/re/mobs/dungeons/dic_dun.txt
+++ b/npc/re/mobs/dungeons/dic_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script ========================================
+//===== Hercules Script ======================================
//= El Dicastes Dungeon Monster Spawn Script
//===== By: ==================================================
//= Kisuka
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Official monster spawns in El Dicastes Dungeon.
//===== Additional Comments: =================================
diff --git a/npc/re/mobs/dungeons/ein_dun.txt b/npc/re/mobs/dungeons/ein_dun.txt
index 587e3df60..3efcd52f6 100644
--- a/npc/re/mobs/dungeons/ein_dun.txt
+++ b/npc/re/mobs/dungeons/ein_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Einbech Mine Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.0 spawn N and spawn delays aren't yet correct, so I set
//= respawn delays quite big for now [Lupus]
diff --git a/npc/re/mobs/dungeons/gef_dun.txt b/npc/re/mobs/dungeons/gef_dun.txt
index babb96d55..d6da72c1c 100644
--- a/npc/re/mobs/dungeons/gef_dun.txt
+++ b/npc/re/mobs/dungeons/gef_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Geffen Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.2 Official kRO 10.1 spawns [Playtester]
//= 1.3 More accurate spawns [Playtester]
diff --git a/npc/re/mobs/dungeons/gefenia.txt b/npc/re/mobs/dungeons/gefenia.txt
index b10f90e34..89e943312 100644
--- a/npc/re/mobs/dungeons/gefenia.txt
+++ b/npc/re/mobs/dungeons/gefenia.txt
@@ -1,7 +1,7 @@
//===== Hercules Script ======================================
//= Geffenia Dungeon Monster Spawn Script
//===== By: ==================================================
-//= Muad_Dib, rAthena Dev Team
+//= Muad_Dib, Hercules Dev Team
//===== Current Version: =====================================
//= 1.1
//===== Additional Comments: =================================
diff --git a/npc/re/mobs/dungeons/glastheim.txt b/npc/re/mobs/dungeons/glastheim.txt
index cbe5a31b7..d23154de2 100644
--- a/npc/re/mobs/dungeons/glastheim.txt
+++ b/npc/re/mobs/dungeons/glastheim.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Glast Heim Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 [Lupus]
//= 1.2 Updated to ep 8.5 aegis spawns [MasterOfMuppets]
diff --git a/npc/re/mobs/dungeons/gld_dun.txt b/npc/re/mobs/dungeons/gld_dun.txt
index cb06564e2..7ac2d9f9f 100644
--- a/npc/re/mobs/dungeons/gld_dun.txt
+++ b/npc/re/mobs/dungeons/gld_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Guild Dungeons Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.2 Official kRO 10.1 spawns [Playtester]
//= 1.3 Corrected MVP spawn variance. [Gepard]
diff --git a/npc/re/mobs/dungeons/gld_dunSE.txt b/npc/re/mobs/dungeons/gld_dunSE.txt
index 488875380..52d5bd0e5 100644
--- a/npc/re/mobs/dungeons/gld_dunSE.txt
+++ b/npc/re/mobs/dungeons/gld_dunSE.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Guild Dungeons Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.0 First version
//= 1.1 Updated spawns to official. [L0ne_W0lf]
diff --git a/npc/re/mobs/dungeons/gon_dun.txt b/npc/re/mobs/dungeons/gon_dun.txt
index 98958a4dc..19e7ee3db 100644
--- a/npc/re/mobs/dungeons/gon_dun.txt
+++ b/npc/re/mobs/dungeons/gon_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Gonryun Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 Official kRO 10.1 spawns [Playtester]
//= 1.2 Corrected MVP spawn variance. [L0ne_W0lf]
diff --git a/npc/re/mobs/dungeons/ice_dun.txt b/npc/re/mobs/dungeons/ice_dun.txt
index 418006267..11513ecd5 100644
--- a/npc/re/mobs/dungeons/ice_dun.txt
+++ b/npc/re/mobs/dungeons/ice_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Ice Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.0 First version from jAthena [Playtester]
//= 1.1 More accurate spawns [Playtester]
diff --git a/npc/re/mobs/dungeons/in_sphinx.txt b/npc/re/mobs/dungeons/in_sphinx.txt
index 7263f38d9..c93a13cdc 100644
--- a/npc/re/mobs/dungeons/in_sphinx.txt
+++ b/npc/re/mobs/dungeons/in_sphinx.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Morocc Sphinx Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 Official kRO 10.1 spawns [Playtester]
//= 1.2 Replaced Marduk with Anubis on F4 and F5 [Playtester]
diff --git a/npc/re/mobs/dungeons/iz_dun.txt b/npc/re/mobs/dungeons/iz_dun.txt
index 8518d020d..8d4fad684 100644
--- a/npc/re/mobs/dungeons/iz_dun.txt
+++ b/npc/re/mobs/dungeons/iz_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Byalan Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 Official kRO 10.1 spawns for 1-4 [Playtester]
//= 1.2 More accurate spawns [Playtester]
diff --git a/npc/re/mobs/dungeons/juperos.txt b/npc/re/mobs/dungeons/juperos.txt
index efa7bece7..28c53f174 100644
--- a/npc/re/mobs/dungeons/juperos.txt
+++ b/npc/re/mobs/dungeons/juperos.txt
@@ -1,7 +1,7 @@
//===== Hercules Script ======================================
//= Juperos Dungeon Monster Spawn Script
//===== By: ==================================================
-// The Prometheus Project, rAthena Dev Team
+// The Prometheus Project, Hercules Dev Team
//===== Current Version: =====================================
//= 1.4
//===== Additional Comments: =================================
diff --git a/npc/re/mobs/dungeons/kh_dun.txt b/npc/re/mobs/dungeons/kh_dun.txt
index 9965585dd..a882550c8 100644
--- a/npc/re/mobs/dungeons/kh_dun.txt
+++ b/npc/re/mobs/dungeons/kh_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Kiel Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.0 First version [MasterOfMuppets]
//= 1.1 Added official mob types [Playtester]
diff --git a/npc/re/mobs/dungeons/lhz_dun.txt b/npc/re/mobs/dungeons/lhz_dun.txt
index be3e34989..d723a8d67 100644
--- a/npc/re/mobs/dungeons/lhz_dun.txt
+++ b/npc/re/mobs/dungeons/lhz_dun.txt
@@ -1,7 +1,7 @@
//===== Hercules Script ======================================
//= Lighthalzen Dungeon(Biolabs) Monster Spawn Script
//===== By: ==================================================
-// The Prometheus Project, rAthena Dev Team
+// The Prometheus Project, Hercules Dev Team
//===== Current Version: =====================================
//= 1.9
//===== Additional Comments: =================================
diff --git a/npc/re/mobs/dungeons/lou_dun.txt b/npc/re/mobs/dungeons/lou_dun.txt
index 46c40fa30..f5e276757 100644
--- a/npc/re/mobs/dungeons/lou_dun.txt
+++ b/npc/re/mobs/dungeons/lou_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Louyang Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 Updated by MasterOfMuppets
//= 1.2 Added Bacsojin and Chung E [MasterOfMuppets]
diff --git a/npc/re/mobs/dungeons/ma_dun.txt b/npc/re/mobs/dungeons/ma_dun.txt
index 0794e0d59..f7028e579 100644
--- a/npc/re/mobs/dungeons/ma_dun.txt
+++ b/npc/re/mobs/dungeons/ma_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script ========================================
+//===== Hercules Script ======================================
//= Malaya Port Dungeon Monster Spawn Script
//===== By: ==================================================
//= Chilly
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Official kRO monster spawns
//===== Additional Comments: =================================
diff --git a/npc/re/mobs/dungeons/mag_dun.txt b/npc/re/mobs/dungeons/mag_dun.txt
index 7fce2de53..562633a5d 100644
--- a/npc/re/mobs/dungeons/mag_dun.txt
+++ b/npc/re/mobs/dungeons/mag_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Magma Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 fixed 2,3,4 tabs instead of 1... and wrong mob names [Lupus]
//= 1.2 Official jRO 10.3 spawns [Playtester]
diff --git a/npc/re/mobs/dungeons/mal_dun.txt b/npc/re/mobs/dungeons/mal_dun.txt
index 79efeecbf..9bcfc8132 100644
--- a/npc/re/mobs/dungeons/mal_dun.txt
+++ b/npc/re/mobs/dungeons/mal_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script ========================================
+//===== Hercules Script ======================================
//= Malangdo Dungeon Monster Spawn Script
//===== By: ==================================================
//= Chilly
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Official kRO monster spawns
//===== Additional Comments: =================================
diff --git a/npc/re/mobs/dungeons/mjo_dun.txt b/npc/re/mobs/dungeons/mjo_dun.txt
index 435678446..4e100d161 100644
--- a/npc/re/mobs/dungeons/mjo_dun.txt
+++ b/npc/re/mobs/dungeons/mjo_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Coal Mine(Dead pit) Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 Official kRO 10.1 spawns [Playtester]
//============================================================
diff --git a/npc/re/mobs/dungeons/moc_pryd.txt b/npc/re/mobs/dungeons/moc_pryd.txt
index e082fec52..dcd5197f1 100644
--- a/npc/re/mobs/dungeons/moc_pryd.txt
+++ b/npc/re/mobs/dungeons/moc_pryd.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Morocc Pryamid Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 Official kRO 10.1 spawns [Playtester]
//= 1.2 More accurate spawns [Playtester]
diff --git a/npc/re/mobs/dungeons/mosk_dun.txt b/npc/re/mobs/dungeons/mosk_dun.txt
index b340ccb12..64dbc9245 100644
--- a/npc/re/mobs/dungeons/mosk_dun.txt
+++ b/npc/re/mobs/dungeons/mosk_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Moscovia Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.0 Added spawns [Playtester]
//= 1.1 Swapped named according to mob db. [L0ne_W0lf]
diff --git a/npc/re/mobs/dungeons/nyd_dun.txt b/npc/re/mobs/dungeons/nyd_dun.txt
index 8d10e2631..7b8dbd156 100644
--- a/npc/re/mobs/dungeons/nyd_dun.txt
+++ b/npc/re/mobs/dungeons/nyd_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Yggdrasil Root Dungeon
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.0 First version
//============================================================
diff --git a/npc/re/mobs/dungeons/odin.txt b/npc/re/mobs/dungeons/odin.txt
index b7a9038ca..cf9f046bb 100644
--- a/npc/re/mobs/dungeons/odin.txt
+++ b/npc/re/mobs/dungeons/odin.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Odin Temple Monster Spawn Script
//===== By: ==================================================
//= Poki#3 (0.1)
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.0 Updated by using Tharis' Homun AI, by Tharis [Vicious]
//= 1.1 More accurate spawns [Playtester]
diff --git a/npc/re/mobs/dungeons/orcsdun.txt b/npc/re/mobs/dungeons/orcsdun.txt
index 3a011ec5d..6c0ecee54 100644
--- a/npc/re/mobs/dungeons/orcsdun.txt
+++ b/npc/re/mobs/dungeons/orcsdun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Orc Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.2 Official kRO 10.1 spawns [Playtester]
//============================================================
diff --git a/npc/re/mobs/dungeons/pay_dun.txt b/npc/re/mobs/dungeons/pay_dun.txt
index eade9ece2..83639ca2c 100644
--- a/npc/re/mobs/dungeons/pay_dun.txt
+++ b/npc/re/mobs/dungeons/pay_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Payon Cave Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 Official kRO 10.1 spawns [Playtester]
//= 1.2 Small spawn update [Playtester]
diff --git a/npc/re/mobs/dungeons/prt_maze.txt b/npc/re/mobs/dungeons/prt_maze.txt
index 169127050..6feea8a0a 100644
--- a/npc/re/mobs/dungeons/prt_maze.txt
+++ b/npc/re/mobs/dungeons/prt_maze.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Prontera Maze(Hidden Temple) Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.2 Official kRO 10.1 spawns [Playtester]
//= 1.3 Some small fixes [Playtester]
diff --git a/npc/re/mobs/dungeons/prt_sew.txt b/npc/re/mobs/dungeons/prt_sew.txt
index 23a10de97..6fd21922d 100644
--- a/npc/re/mobs/dungeons/prt_sew.txt
+++ b/npc/re/mobs/dungeons/prt_sew.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Prontera Sewers(Culvert) Dungeon Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 Official kRO 10.1 spawns [Playtester]
//= 1.2 Corrected MVP spawn variance. [L0ne_W0lf]
diff --git a/npc/re/mobs/dungeons/ra_san.txt b/npc/re/mobs/dungeons/ra_san.txt
index 46b4f255b..b5f764b70 100644
--- a/npc/re/mobs/dungeons/ra_san.txt
+++ b/npc/re/mobs/dungeons/ra_san.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Rachel Sanctuary Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.0 First version with guessed amounts [Playtester]
//= 1.1 More accurate spawns [Playtester]
diff --git a/npc/re/mobs/dungeons/tha_t.txt b/npc/re/mobs/dungeons/tha_t.txt
index 681f086d8..789a71cdd 100644
--- a/npc/re/mobs/dungeons/tha_t.txt
+++ b/npc/re/mobs/dungeons/tha_t.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Thanatos Tower Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.0 Real spawns by Poki#3 [Nexon]
//= 1.1 More official spawns [Playtester]
diff --git a/npc/re/mobs/dungeons/thor_v.txt b/npc/re/mobs/dungeons/thor_v.txt
index 077ada870..2d3867f5b 100644
--- a/npc/re/mobs/dungeons/thor_v.txt
+++ b/npc/re/mobs/dungeons/thor_v.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script ========================================
+//===== Hercules Script ======================================
//= Thor Volcano Monster Spawn Script
//===== By: ==================================================
//= Playtester
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Description: =========================================
//= Official monster spawn in Thor Volcano Dungeon.
//===== Additional Comments: =================================
diff --git a/npc/re/mobs/dungeons/treasure.txt b/npc/re/mobs/dungeons/treasure.txt
index e4073cfba..25d8caf60 100644
--- a/npc/re/mobs/dungeons/treasure.txt
+++ b/npc/re/mobs/dungeons/treasure.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Sunken Ship Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 Official kRO 10.1 spawns [Playtester]
//= 1.2 More accurate spawns [Playtester]
diff --git a/npc/re/mobs/dungeons/tur_dun.txt b/npc/re/mobs/dungeons/tur_dun.txt
index 467bee819..a73fc3d1b 100644
--- a/npc/re/mobs/dungeons/tur_dun.txt
+++ b/npc/re/mobs/dungeons/tur_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Turtle Island Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.2 Official kRO 10.1 spawns [Playtester]
//============================================================
diff --git a/npc/re/mobs/dungeons/xmas_dun.txt b/npc/re/mobs/dungeons/xmas_dun.txt
index eeca02eef..f3c6d8859 100644
--- a/npc/re/mobs/dungeons/xmas_dun.txt
+++ b/npc/re/mobs/dungeons/xmas_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Toy Factory Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.1 added Garm Baby according to May 10 patch
//= 1.2 Official kRO 10.1 spawns [Playtester]
diff --git a/npc/re/mobs/dungeons/yggdrasil.txt b/npc/re/mobs/dungeons/yggdrasil.txt
index b3d401ac5..9fb13a6b6 100644
--- a/npc/re/mobs/dungeons/yggdrasil.txt
+++ b/npc/re/mobs/dungeons/yggdrasil.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Yggdrasil Tree Monster Spawn Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Additional Comments: =================================
//= 1.0 Splitted from Nifflheim fields [DracoRPG]
//= 1.1 Official kRO 10.1 spawns [Playtester]
diff --git a/npc/re/mobs/fields/bifrost.txt b/npc/re/mobs/fields/bifrost.txt
index b8c28bf49..04667acb0 100644
--- a/npc/re/mobs/fields/bifrost.txt
+++ b/npc/re/mobs/fields/bifrost.txt
@@ -9,27 +9,28 @@
//===== Additional Comments: =================================
//= 1.0 First Release
//= 1.1 Added more accurate 1@mist monsters
+//= 1.2 Renewal spawn update. [Euphy]
//============================================================
//==================================================
// bif_fild01 - Bifrost South
//==================================================
-bif_fild01,0,0,0,0 monster Luciola Vespa 1994,25,0,0,0
-bif_fild01,0,0,0,0 monster Cornus 1992,15,0,0,0
-bif_fild01,0,0,0,0 monster Pom Spider 2132,5,0,0,0
-bif_fild01,0,0,0,0 monster Angra Mantis 2133,5,0,0,0
-bif_fild01,0,0,0,0 monster Little Fatum 2136,30,0,0,0
-bif_fild01,0,0,0,0 monster Miming 2137,50,0,0,0
+bif_fild01,0,0,0,0 monster Luciola Vespa 1994,29,5000,0,0
+bif_fild01,0,0,0,0 monster Cornus 1992,17,5000,0,0
+bif_fild01,0,0,0,0 monster Miming 2137,58,5000,0,0
+bif_fild01,0,0,0,0 monster Little Fatum 2136,34,5000,0,0
+bif_fild01,0,0,0,0 monster Angra Mantis 2133,5,5000,0,0
+bif_fild01,0,0,0,0 monster Pom Spider 2132,5,5000,0,0
//==================================================
// bif_fild02 - Bifrost North
//==================================================
-bif_fild02,0,0,0,0 monster Luciola Vespa 1994,25,0,0,0
-bif_fild02,0,0,0,0 monster Cornus 1992,15,0,0,0
-bif_fild02,0,0,0,0 monster Pom Spider 2132,5,0,0,0
-bif_fild02,0,0,0,0 monster Angra Mantis 2133,5,0,0,0
-bif_fild02,0,0,0,0 monster Little Fatum 2136,50,0,0,0
-bif_fild02,0,0,0,0 monster Miming 2137,30,0,0,0
+bif_fild02,0,0,0,0 monster Luciola Vespa 1994,27,5000,0,0
+bif_fild02,0,0,0,0 monster Cornus 1992,16,5000,0,0
+bif_fild02,0,0,0,0 monster Miming 2137,33,5000,0,0
+bif_fild02,0,0,0,0 monster Little Fatum 2136,55,5000,0,0
+bif_fild02,0,0,0,0 monster Angra Mantis 2133,5,5000,0,0
+bif_fild02,0,0,0,0 monster Pom Spider 2132,5,5000,0,0
//==================================================
// 1@mist - Forest Maze of Mists
diff --git a/npc/re/mobs/fields/lighthalzen.txt b/npc/re/mobs/fields/lighthalzen.txt
index 8a9dbead3..92cbad659 100644
--- a/npc/re/mobs/fields/lighthalzen.txt
+++ b/npc/re/mobs/fields/lighthalzen.txt
@@ -1,7 +1,7 @@
//===== Hercules Script ======================================
//= Lighthalzen Fields Monster Spawn Script
//===== By: ==================================================
-//= Muad_Dib, rAthena Dev Team
+//= Muad_Dib, Hercules Dev Team
//===== Current Version: =====================================
//= 1.6
//===== Additional Comments: =================================
diff --git a/npc/re/other/mercenary_rent.txt b/npc/re/other/mercenary_rent.txt
index 0b065208d..0e92f8fc2 100644
--- a/npc/re/other/mercenary_rent.txt
+++ b/npc/re/other/mercenary_rent.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Mercenary related NPCs
//===== By: ==================================================
//= Daegaladh
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Sells Lancer, Sword, and Archer mercenaries,
//= along with related mercenary items.
diff --git a/npc/re/quests/cupet.txt b/npc/re/quests/cupet.txt
index ac19d237d..c2ba9fec7 100644
--- a/npc/re/quests/cupet.txt
+++ b/npc/re/quests/cupet.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Cute Pet Manager
//===== By: ==================================================
//= Z3R0
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Aegis Conversion]
//= Exchanges Hunted Items for Tames
diff --git a/npc/re/quests/eden/56-70.txt b/npc/re/quests/eden/56-70.txt
index d4599c557..c503a274b 100644
--- a/npc/re/quests/eden/56-70.txt
+++ b/npc/re/quests/eden/56-70.txt
@@ -3,7 +3,7 @@
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
-//= 1.4
+//= 2.1
//===== Description: =========================================
//= Repetable Quests for Players between Baselevel 56 - 70.
//===== Additional Comments: =================================
@@ -12,1076 +12,355 @@
//= 1.2 Added checkquest confirmation for -1. [Euphy]
//= 1.3 Fixed Puppet Master's Agony Quest (12217 -> 3259). [Joseph]
//= 1.4 Fixed invalid check (Magic Wand Quest). [Joseph]
+//= 2.0 Optimised [Zopokx]
+//= 2.1 Fixed some errors using Euphy's reference [Zopokx]
//============================================================
moc_para01,42,38,3 script Mission [56 - 70] 857,{
- if (checkquest(12217) > -1) erasequest 12217;
- if (countitem(6219)) {
- mes "Here is the list of various adventures for level 55~70 adventurers.";
- next;
- mes "Lots of missions such as a Monster Hunting, Delivery Goods, Finding People.";
- next;
- switch (select("Mission Numbers 1~5:Mission Numbers 6~10:Mission Numbers 11~15")) {
+ if (countitem(6219) < 1) {
+ mes "To get these missions, I need to Join the Eden Group first. I must find Secretary Lime Evenor and become a member.";
+ close;
+ }
+ mes "Here is the list of various adventures for level 56~70 adventurers.";
+ next;
+ mes "Lots of missions such as a Monster Hunting, Delivery Goods, Finding People.";
+ next;
+ switch (select("Mission Numbers 1~5:Mission Numbers 6~10:Mission Numbers 11~15")) {
case 1:
switch (select("What is this Bandage?:Dangerous Alligators.:That wasn't a mermaid...:My country is calling me!")) {
- case 1:
- if (checkquest(3250) <= 0) {
- mes "This mission is assigned by the Rekenber corporation from Lighthalzen. Below are the details.";
- next;
- mes "Rekenber corporation is about to launch a new project called 'Green Medical Center'. For the first product of the project, we are preparing well-being Bandages.";
- next;
- mes "Regarding the project, we need to research monster's reactions when they are wrapped with Rotten Bandages.";
- next;
- mes "If you are interested, please hunt 30 Mummies and bring 30 Rotten Bandages. You can find them in the Pyramid West of Morroc.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "- Rekenber corporation chief director 'Julie E Delph' -";
- next;
- mes " ";
- next;
- mes "Would you like to accept this mission?";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3250;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3250,HUNTING) == 1) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by the Rekenber corporation from Lighthalzen. Below are the details.";
- next;
- mes "Rekenber corporation is about to launch a new project called 'Green Medical Center'. For the first product of the project, we are preparing well-being Bandages.";
- next;
- mes "Regarding the project, we need to research monster's reactions when they are wrapped with Rotten Bandages.";
- next;
- mes "If you are interested, please hunt 30 Mummies and bring 30 Rotten Bandages. You can find them in the Pyramid West of Morroc.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "- Rekenber corporation chief director 'Julie E Delph' -";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3250,HUNTING) == 2) && (countitem(930) > 19)) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- delitem 930,20; //Rotten_Bandage
- getexp 15000,5000;
- erasequest 3250;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
- case 2:
- if (checkquest(3251) <= 0) {
- mes "This mission is assigned by the Comodo cooperative society. Below are the details.";
- next;
- mes "Alligators have gone wild these days, they attack women and drunken people who hang out near the beach.";
- next;
- mes "This is a very shameful situation for us, the most wonderful vacation spot in Rune-Midgard.";
- next;
- mes "So, it would be very helpful if you hunt 30 Alligators to clean out this situation.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes " ";
- next;
- mes "Would you like to accept this mission?";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3251;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3251,HUNTING) == 1) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by the Comodo cooperative society. Below are the details.";
- next;
- mes "Alligators have gone wild these days, they attack women and drunken people who hang out near the beach.";
- next;
- mes "This is a very shameful situation for us, the most wonderful vacation spot in Rune-Midgard.";
- next;
- mes "So, it would be very helpful if you hunt 30 Alligators to clean out this situation.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3251,HUNTING) == 2) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- getexp 16000,6000;
- erasequest 3251;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
- case 3:
- if (checkquest(3252) <= 0) {
- mes "This mission is assigned by an unknown client from Izlude.";
- next;
- mes "I have admired the beach of Izlude, ever since I was born.";
- next;
- mes "When I was young, I found a mysterious creature in the Izlude dungeon, I had never seen something like that before...";
- next;
- mes "I instantly thought it was a mermaid. I was so supprised, I have studied about mermaids in whole my life.";
- next;
- mes "But, as I studied harder, I found that the creature was not a mermaid... yes, It wasn't beautiful at all like other mermaids...";
- next;
- mes "I finally tracked down the fact that it was a Merman, not a Mermaid!";
- next;
- mes "Merman... I have wasted my life studying this monster! So please hunt 30 Mermans to make me feel better.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Izlude 'The Lost dream mermaid' --";
- next;
- mes " ";
- next;
- mes "Would you like to accept this mission?";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3252;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3252,HUNTING) == 1) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by an unknown client from Izlude.";
- next;
- mes "I have admired the beach of Izlude, ever since I was born.";
- next;
- mes "When I was young, I found a mysterious creature in the Izlude dungeon, I had never seen something like that before.";
- next;
- mes "I instantly thought it was a mermaid. I was so supprised, I have studied about mermaids in whole my life.";
- next;
- mes "But, as I studied harder, I found that the creature was not a mermaid... yes, It wasn't beautiful at all like other mermaids...";
- next;
- mes "I finally tracked down the fact that it was a Merman, not a Mermaid!";
- next;
- mes " Merman... I have wasted my life studying this monster! So please hunt 30 Mermans to make me feel better.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Izlude 'The Lost dream mermaid' --";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3252,HUNTING) == 2) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- getexp 17000,8000;
- erasequest 3252;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
- case 4:
- if (checkquest(3254) <= 0) {
- mes "This mission is assigned by the government officer of the Rune-Midgarts Kingdom.";
- next;
- mes "To prevent a flood in Prontera, we decided to build a huge dam to regulate the water supply.";
- next;
- mes "But, we are shorthanded on supplies and we need to collect Fine Sand and Grit.";
- next;
- mes "So, we would like to ask for help. People, please bring us 10 Fine Sand and 30 Grit each so we can build the dam.";
- next;
- mes "You can get those materials from Sand Man, I wish you good luck!";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Government officer of the Rune-Midgarts Kingdom, Dufre Kent --";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3254;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3254) == 1) && (countitem(7043) < 10) && (countitem(1056) < 30)) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by the government officer of the Rune-Midgarts Kingdom.";
- next;
- mes "To prevent a flood in Prontera, we decided to build a huge dam to regulate the water supply.";
- next;
- mes "But, we are shorthanded on supplies and we need to collect Fine Sand and Grit.";
- next;
- mes "So, we would like to ask for help. People, please bring us 10 Fine Sand and 30 Grit each so we can build the dam.";
- next;
- mes "You can get those materials from Sand Man, I wish you good luck!";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Government officer of the Rune-Midgarts Kingdom, Dufre Kent --";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3254) == 1) && (countitem(7043) > 9) && (countitem(1056) > 29)) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- delitem 7043,10; //Fine_Sand
- delitem 1056,30; //Grit
- getexp 18000,8000;
- erasequest 3254;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3254) == 2) {
- mes "This mission is assigned by the government officer of the Rune-Midgarts Kingdom.";
- next;
- mes "To prevent a flood in Prontera, we decided to build a huge dam to regulate the water supply.";
- next;
- mes "But, we are shorthanded on supplies and we need to collect Fine Sand and Grit.";
- next;
- mes "So, we would like to ask for help. People, please bring us 10 Fine Sand and 30 Grit each so we can build the dam.";
- next;
- mes "You can get those materials from Sand Man, I wish you good luck!";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Government officer of the Rune-Midgarts Kingdom, Dufre Kent --";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3254;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- close;
+ case 1: callsub L_HuntingQuest,3250,15000,5000,930,30;
+ case 2: callsub L_HuntingQuest,3251,16000,6000;
+ case 3: callsub L_HuntingQuest,3252,17000,8000;
+ case 4: callsub L_Quest,3254,18000,8000,7043,10,1056,30;
}
+ break;
case 2:
switch (select("Hunt Wild Boar:Preparing the Summer:A Woman's Grudge:Special ingredients:Puppet Master's Agony")) {
- case 1:
- if (checkquest(3255) <= 0) {
- mes "This mission is assigned by the Payon town hall.";
- next;
- mes "Wild animals are always annoyances to farmers.";
- next;
- mes "They attack our farm and ruin whole crops!! We can't stand it anymore!";
- next;
- mes "So, we would like to ask for the help from brave adventurers.";
- next;
- mes "Please, hunt 30 Savages to save our crops!";
- next;
- mes "You can easily find those monsters around our town and field.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Payon town hall members --";
- next;
- mes " ";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3255;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3255,HUNTING) == 1) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by the Payon town hall.";
- next;
- mes "Wild animals are always an annoyance to farmers.";
- next;
- mes "They attack our farm and ruin whole crops!! We can't stand it anymore!";
- next;
- mes "So, we would like to ask for the help from brave adventurers.";
- next;
- mes "Please, hunt 30 Savages to save our crops!";
- next;
- mes "You can easily find those monsters around our town and field.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Payon town hall members --";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3255,HUNTING) == 2) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- getexp 16000,7000;
- erasequest 3255;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
- case 2:
- if (checkquest(3256) <= 0) {
- mes "This mission is assigned by the Morroc blacksmith Aragham.";
- next;
- mes "Hello~~~~, Adventurers! This is Aragham, the hottest blacksmith in Morroc!";
- next;
- mes "Anyway, I have a son named Aragam Junior, the cute one. Haha.";
- next;
- mes "He will be attending summer camp this summer, but he doesn't know how to swim.";
- next;
- mes "I want to teach him, but as you know I am a blacksmith, a far cry from swimming! Hehe.";
- next;
- mes "But, I figured that if I make swim fins, it will be great for his confidence~!";
- next;
- mes "To make it, I need 30 Sticky Webfoots from a Roda Frog. Can you bring them to me?";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "PS. Do not compare me with Hollgrehenn or Antonio!!!!";
- next;
- mes "-- The hottest blacksmith, Morroc blacksmith Aragham --";
- next;
- mes " ";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3256;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3256) == 1) && (countitem(918) < 30)) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by the Morroc blacksmith Aragham.";
- next;
- mes "Hello~~~~, Adventurers! This is Aragham, the hottest blacksmith in Morroc!";
- next;
- mes "Anyway, I have a son named Aragam Junior, the cute one. Haha.";
- next;
- mes "He will be attending summer camp this summer, but he doesn't know how to swim.";
- next;
- mes "I want to teach him, but as you know I am a blacksmith, a far cry from swimming! Hehe.";
- next;
- mes "But, I figured that if I make swim fins, it will be great for his confidence~!";
- next;
- mes "To make it, I need 30 Sticky Webfoots from a Roda Frog. Can you bring them to me?";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "PS. Do not compare me with Hollgrehenn or Antonio!!!!";
- next;
- mes "-- The hottest blacksmith, Morroc blacksmith Aragham --";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3256) == 1) && (countitem(918) > 29)) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- delitem 918,30; //Sticky_Webfoot
- getexp 15000,5000;
- erasequest 3256;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3256) == 2) {
- mes "This mission is assigned by the Morroc blacksmith Aragham.";
- next;
- mes "Hello~~~~, Adventurers! This is Aragham, the hottest blacksmith in Morroc!";
- next;
- mes "Anyway, I have a son named Aragam Junior, the cute one. Haha.";
- next;
- mes "He will be attending summer camp this summer, but he doesn't know how to swim.";
- next;
- mes "I want to teach him, but as you know I am a blacksmith, a far cry from swimming! Hehe.";
- next;
- mes "But, I figured that if I make swim fins, it will be great for his confidence~!";
- next;
- mes "To make it, I need 30 Sticky Webfoots from a Roda Frog. Can you bring them to me?";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "PS. Do not compare me with Hollgrehenn or Antonio!!!!";
- next;
- mes "-- The hottest blacksmith, Morroc blacksmith Aragham --";
- next;
- mes " ";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3256;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- close;
- case 3:
- if (checkquest(3257) <= 0) {
- mes "This mission is assigned by an inventor Dorian from Izlude.";
- next;
- mes "Have you heard the story that if women have a grudge on their mind, it will bring natural disasters.";
- next;
- mes "Wow, so guys must watch out for those sensitive women! Make sure they don't have any grudges on you.";
- next;
- mes "Women can bring strange phenomenons with them!";
- next;
- mes "I am so intrigued with that story that I'm trying to prove that it can be true.";
- next;
- mes "So I need to make women upset! Haha, I know what a mean idea, right?";
- next;
- mes "But this is seriously just for studying... So please hunt 30 Sohee's who seems to be revived from victimized souls.";
- next;
- mes "So I can keep observing the case.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Elegance inventor Dorian --";
- next;
- mes " ";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3257;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3257,HUNTING) == 1) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by an inventor Dorian from Izlude.";
- next;
- mes "Have you heard the story that if women have a grudge on their mind, it will bring natural disasters.";
- next;
- mes "Wow, so guys must watch out for those sensitive women! Make sure they don't have any grudges on you.";
- next;
- mes "Women can bring strange phenomenons with them!";
- next;
- mes "I am so intrigued with that story that I'm trying to prove that it can be true.";
- next;
- mes "So I need to make women upset! Haha, I know what a mean idea, right?";
- next;
- mes "But this is seriously just for studying... So please hunt 30 Sohee's who seems to be revived from victimized souls.";
- next;
- mes "So I can keep observing the case.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Elegance inventor Dorian --";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3257,HUNTING) == 2) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- getexp 17000,8000;
- erasequest 3257;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
- case 4:
- if (checkquest(3258) <= 0) {
- mes "This mission is assigned by Wallah from Payon.";
- next;
- mes "Hello, adventurer. How are you? How is your health?";
- next;
- mes "I am a pharmacist and I am having a hard time getting special ingredients lately.";
- next;
- mes "Because I am a little sensitive girl, how can I possibly get those things by myself.";
- next;
- mes "So, please help me. Just bring 40 Huge Leafs to me, that will be enough to complete my special medicine!";
- next;
- mes "Please bring it as soon as possible, people need my medicine.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Wallah --";
- next;
- mes " ";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3258;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3258) == 1) && (countitem(7198) < 40)) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by Wallah from Payon.";
- next;
- mes "Hello, adventurer. How are you? How is your health?";
- next;
- mes "I am a pharmacist and I am having a hard time getting special ingredients lately.";
- next;
- mes "Because I am a little sensitive girl, how can I possibly get those things by myself.";
- next;
- mes "So, please help me. Just bring 40 Huge Leafs to me, that will be enough to complete my special medicine!";
- next;
- mes "Please bring it as soon as possible, people need my medicine.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Wallah --";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3258) == 1) && (countitem(7198) > 39)) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- delitem 7198,40; //Great_Leaf
- getexp 16000,7000;
- erasequest 3258;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3258) == 2) {
- mes "This mission is assigned by Wallah from Payon.";
- next;
- mes "Hello, adventurer. How are you? How is your health?";
- next;
- mes "I am a pharmacist and I am having a hard time getting special ingredients lately.";
- next;
- mes "Because I am a little sensitive girl, how can I possibly get those things by myself.";
- next;
- mes "So, please help me. Just bring 40 Huge Leafs to me, that will be enough to complete my special medicine!";
- next;
- mes "Please bring it as soon as possible, people need my medicine.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Wallah --";
- next;
- mes " ";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3258;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- close;
- case 5:
- if (checkquest(3259) <= 0) {
- mes "This mission is assigned by puppet master Woonute from Geffen.";
- next;
- mes "You know being a puppet master is kind of a hard job to satisfy people.";
- next;
- mes "People can search and see so many different things on their own thesedays.";
- next;
- mes "Their expectations are getting high, I can't satisfy them anymore.";
- next;
- mes "But if I can make new toy concepts, like living toys, it will be ground breaking.";
- next;
- mes "I heard that there are live dolls called Marionettes. Can you hunt 30 Marionettes for me? And also bring 30 Golden Hair, those will be great materials for the new toys.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Puppet Master Woonute --";
- next;
- mes " ";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3259;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3259,HUNTING) == 1) && (countitem(1060) < 30)) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by puppet master Woonute from Geffen.";
- next;
- mes "You know being a puppet master is kind of a hard job to satisfy people.";
- next;
- mes "People can search and see so many different things on their own thesedays.";
- next;
- mes "Their expectations are getting high, I can't satisfy them anymore.";
- next;
- mes "But if I can make new toy concepts, like living toys, it will be ground breaking.";
- next;
- mes "I heard that there are live dolls called Marionettes. Can you hunt 30 Marionettes for me? And also bring 30 Golden Hair, those will be great materials for the new toys.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Puppet Master Woonute --";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3259,HUNTING) == 2) && (countitem(1060) > 29)) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- delitem 1060,30; //Golden_Hair
- getexp 17000,7000;
- erasequest 3259;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
+ case 1: callsub L_HuntingQuest,3255,16000,7000;
+ case 2: callsub L_Quest,3256,15000,5000,918,30;
+ case 3: callsub L_HuntingQuest,3257,17000,8000;
+ case 4: callsub L_Quest,3258,16000,7000,7198,40;
+ case 5: callsub L_HuntingQuest,3259,17000,7000,1060,30;
}
+ break;
case 3:
switch (select("Tiresome Flies:Dangerous Munak:Make the World green:Magic Wand")) {
- case 1:
- if (checkquest(3260) <= 0) {
- mes "This mission is assigned by an exterminator from Prontera.";
- next;
- mes "As the weather gets warmer, insects multiply more and more. It is already out of control.";
- next;
- mes "People in Prontera cannot sleep because of all the bugs in their house.";
- next;
- mes "So, please help us, hunt 30 Hunter Flies. Then the flies can be reduced slowly.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- The Prontera exterminator --";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3260;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3260,HUNTING) == 1) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by an exterminator from Prontera.";
- next;
- mes "As the weather gets warmer, insects multiply more and more. It is already out of control.";
- next;
- mes "People in Prontera cannot sleep because of all the bugs in their house.";
- next;
- mes "So, please help us, hunt 30 Hunter Flies. Then the flies can be reduced slowly.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- The Prontera exterminator --";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3260,HUNTING) == 2) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- getexp 16000,6000;
- erasequest 3260;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
- case 2:
- if (checkquest(3261) <= 0) {
- mes "This mission is assigned by Cheese Dongja from Payon.";
- next;
- mes "Have you heard about Munak?";
- next;
- mes "The ugly monster Munak is threatening people in Payon.";
- next;
- mes "So we need brave adventurers like you!";
- next;
- mes "Please hunt 30 Munaks then Payon will be in peace.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "- Payon Cheese Dongja -";
- next;
- mes " ";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3261;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3261,HUNTING) == 1) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by Cheese Dongja from Payon.";
- next;
- mes "Have you heard about Munak?";
- next;
- mes "The ugly monster Munak is threatening people in Payon.";
- next;
- mes "So we need brave adventurers like you!";
- next;
- mes "Please hunt 30 Munaks then Payon will be in peace.";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "- Payon Cheese Dongja -";
- close;
- case 2:
- close;
- }
- }
- if (checkquest(3261,HUNTING) == 2) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- getexp 16000,7000;
- erasequest 3261;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
- case 3:
- if (checkquest(3262) <= 0) {
- mes "This mission is assigned by a gem dealer, Ibraham from Morroc.";
- next;
- mes "A small beautiful flower in the barren desert... What an incredible scene it would be!";
- next;
- mes "Planting flowers can make the world green and it will be so pretty everywhere.";
- next;
- mes "I plan to plant strong flowers in the Morroc desert so the soil gets better.";
- next;
- mes "I need 40 Maneater Blossom from Flora, I know Maneater Blossom is an ugly flower, but still it is a plant.";
- next;
- mes "I hope you can hunt Flora and get me 40 Maneater Blossoms. You are making the world green! Be proud!";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Morroc Ibraham --";
- next;
- mes " ";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3262;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3262) == 1) && (countitem(1032) < 40)) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by a gem dealer, Ibraham from Morroc.";
- next;
- mes "A small beautiful flower in the barren desert... What an incredible scene it would be!";
- next;
- mes "Planting flowers can make the world green and it will be so pretty everywhere.";
- next;
- mes "I plan to plant strong flowers in the Morroc desert so the soil gets better.";
- next;
- mes "I need 40 Maneater Blossom from Flora, I know Maneater Blossom is an ugly flower, but still it is a plant.";
- next;
- mes "I hope you can hunt Flora and get me 40 Maneater Blossoms. You are making the world green! Be proud!";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Morroc Ibraham --";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3262) == 1) && (countitem(1032) > 39)) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- delitem 1032,40; //Blossom_Of_Maneater
- getexp 17000,7000;
- erasequest 3262;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
- case 4:
- if (checkquest(3263) <= 0) {
- mes "This mission is assigned by the Payon blacksmith Antonio.";
- next;
- mes "Magic wand! Have you heard about it? It is an incredible wand!";
- next;
- mes "If you say the magic words and swing the wand, it will make your wishes come true.";
- next;
- mes "So, I decided to make it by myself. Then I will be rich and powerful~! Haha!!";
- next;
- mes "To make the wand, I need some special materials.";
- next;
- mes "Please bring me 30 Dokebi Horns and 30 Bamboo Cut. If you do so, I will lend you my magic wand once. Haha, good deal?";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Payon blacksmith Antonio --";
- next;
- mes " ";
- next;
- switch (select("Accept the mission.:Do not accept the mission.")) {
- case 1:
- if ((BaseLevel > 54) && (BaseLevel < 71)) {
- setquest 3263;
- mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
- next;
- mes "This mission doesn't have time limits.";
- close;
- }
- mes "These missions are not fit for my level. I should look for other missions.";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3263) == 1) && ((countitem(1021) < 30) || (countitem(7150) < 30))) {
- mes "You have an on-going mission. Would you like to check the details?";
- next;
- switch (select("Check the details.:Cancel.")) {
- case 1:
- mes "This mission is assigned by the Payon blacksmith Antonio.";
- next;
- mes "Magic wand! Have you heard about it? It is an incredible wand!";
- next;
- mes "If you say the magic words and swing the wand, it will make your wishes come true.";
- next;
- mes "So, I decided to make it by myself. Then I will be rich and powerful~! Haha!!";
- next;
- mes "To make the wand, I need some special materials.";
- next;
- mes "Please bring me 30 Dokebi Horns and 30 Bamboo Cut. If you do so, I will lend you my magic wand once. Haha, good deal?";
- next;
- mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
- next;
- mes "-- Payon blacksmith Antonio --";
- close;
- case 2:
- close;
- }
- }
- if ((checkquest(3263) == 1) && (countitem(1021) > 29) && (countitem(7150) > 29)) {
- mes "I have done pretty well for the mission. Should I report it now?";
- next;
- switch (select("Report the mission.:Do not report it yet.")) {
- case 1:
- delitem 1021,30; //Dokkaebi_Horn
- delitem 7150,30; //Bamboo_Cut
- getexp 18000,8000;
- erasequest 3263;
- mes "You have completed the mission. Get rewards.";
- close;
- case 2:
- close;
- }
- }
+ case 1: callsub L_HuntingQuest,3260,16000,6000;
+ case 2: callsub L_HuntingQuest,3261,16000,7000;
+ case 3: callsub L_Quest,3262,17000,7000,1032,40;
+ case 4: callsub L_Quest,3263,18000,8000,1021,30,7150,30;
+ }
+ break;
+ }
+ end;
+
+L_Quest:
+ if (checkquest(getarg(0)) <= 0) {
+ callsub L_CheckDetails, getarg(0);
+ mes " ";
+ next;
+ mes "Would you like to accept this mission?";
+ next;
+ if(select("Accept the mission.:Do not accept the mission.") == 1) {
+ if ((BaseLevel < 56) || (BaseLevel > 70)) {
+ mes "These missions are not fit for my level. I should look for other missions.";
+ close;
+ }
+ setquest getarg(0);
+ mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
+ next;
+ mes "This mission doesn't have time limits.";
+ }
+ close;
+ }
+ if (checkquest(getarg(0)) == 1) {
+ if (getargcount() > 5) {
+ if ((countitem(getarg(3)) >= getarg(4)) && (countitem(getarg(5)) >= getarg(6))) { set .@complete, 1; }
+ else { set .@complete, 0; }
+ } else {
+ if (countitem(getarg(3)) >= getarg(4)) { set .@complete, 1; }
+ else { set .@complete, 0; }
+ }
+ if (.@complete) {
+ mes "I have done pretty well for the mission. Should I report it now?";
+ next;
+ if(select("Report the mission.:Do not report it yet.") == 2) { close; }
+ delitem getarg(3),getarg(4);
+ if (getarg(5,0) > 0) { delitem getarg(5),getarg(6); }
+ getexp getarg(1),getarg(2);
+ erasequest getarg(0);
+ mes "You have completed the mission. Get rewards.";
+ } else {
+ mes "You have an on-going mission. Would you like to check the details?";
+ next;
+ if(select("Check the details.:Cancel.") == 1)
+ callsub L_CheckDetails, getarg(0);
+ }
+ }
+ close;
+ end;
+
+L_HuntingQuest:
+ if (checkquest(getarg(0)) <= 0) {
+ callsub L_CheckDetails, getarg(0);
+ next;
+ mes " ";
+ next;
+ mes "Would you like to accept this mission?";
+ next;
+ if(select("Accept the mission.:Do not accept the mission.") == 1) {
+ if ((BaseLevel < 56) || (BaseLevel > 70)) {
+ mes "These missions are not fit for my level. I should look for other missions.";
+ close;
}
+ setquest getarg(0);
+ mes "I have successfully accepted the mission. I have to come back and confirm my work after I complete the mission.";
+ next;
+ mes "This mission doesn't have time limits.";
+ }
+ }
+ else if (checkquest(getarg(0),HUNTING) == 1) {
+ mes "You have an on-going mission. Would you like to check the details?";
+ next;
+ if(select("Check the details.:Cancel.") == 1)
+ callsub L_CheckDetails, getarg(0);
+ }
+ else if (checkquest(getarg(0),HUNTING) == 2) {
+ if (getargcount() > 3) {
+ if (countitem(getarg(3)) >= getarg(4)) { set .@complete, 1; }
+ else { set .@complete, 0; }
+ } else { set .@complete, 1; }
+ if (.@complete) {
+ mes "I have done pretty well for the mission. Should I report it now?";
+ next;
+ if(select("Report the mission.:Do not report it yet.") == 2) { close; }
+ if (getarg(3,0) > 0) { delitem getarg(3),getarg(4); }
+ getexp getarg(1),getarg(2);
+ erasequest getarg(0);
+ mes "You have completed the mission. Get rewards.";
+ } else {
+ mes "I don't have enough "+getitemname(getarg(3))+".";
+ mes "I need to gather "+getarg(4)+" "+getitemname(getarg(3))+" to complete this mission.";
}
}
- mes "To get these missions, I need to Join the Eden Group first. I must find Secretary Lime Evenor and become a member.";
close;
+ end;
+
+L_CheckDetails:
+ switch(getarg(0)){
+ case 3250:
+ mes "This mission is assigned by the Rekenber corporation from Lighthalzen. Below are the details.";
+ next;
+ mes "Rekenber corporation is about to launch a new project called 'Green Medical Center'. For the first product of the project, we are preparing well-being Bandages.";
+ next;
+ mes "Regarding the project, we need to research monster's reactions when they are wrapped with Rotten Bandages.";
+ next;
+ mes "If you are interested, please hunt 30 Mummies and bring 30 Rotten Bandages. You can find them in the Pyramid West of Morroc.";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "- Rekenber corporation chief director 'Julie E Delph' -";
+ break;
+ case 3251:
+ mes "This mission is assigned by the Comodo cooperative society. Below are the details.";
+ next;
+ mes "Alligators have gone wild these days, they attack women and drunken people who hang out near the beach.";
+ next;
+ mes "This is a very shameful situation for us, the most wonderful vacation spot in Rune-Midgard.";
+ next;
+ mes "So, it would be very helpful if you hunt 30 Alligators to clean out this situation.";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ break;
+ case 3252:
+ mes "This mission is assigned by an unknown client from Izlude.";
+ next;
+ mes "I have admired the beach of Izlude, ever since I was born.";
+ next;
+ mes "When I was young, I found a mysterious creature in the Izlude dungeon, I had never seen something like that before...";
+ next;
+ mes "I instantly thought it was a mermaid. I was so supprised, I have studied about mermaids in whole my life.";
+ next;
+ mes "But, as I studied harder, I found that the creature was not a mermaid... yes, It wasn't beautiful at all like other mermaids...";
+ next;
+ mes "I finally tracked down the fact that it was a Merman, not a Mermaid!";
+ next;
+ mes "Merman... I have wasted my life studying this monster! So please hunt 30 Mermans to make me feel better.";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "-- Izlude 'The Lost dream mermaid' --";
+ break;
+ case 3254:
+ mes "This mission is assigned by the government officer of the Rune-Midgarts Kingdom.";
+ next;
+ mes "To prevent a flood in Prontera, we decided to build a huge dam to regulate the water supply.";
+ next;
+ mes "But, we are shorthanded on supplies and we need to collect Fine Sand and Grit.";
+ next;
+ mes "So, we would like to ask for help. People, please bring us 10 Fine Sand and 30 Grit each so we can build the dam.";
+ next;
+ mes "You can get those materials from Sand Man, I wish you good luck!";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "-- Government officer of the Rune-Midgarts Kingdom, Dufre Kent --";
+ break;
+ case 3255:
+ mes "This mission is assigned by the Payon town hall.";
+ next;
+ mes "Wild animals are always annoyances to farmers.";
+ next;
+ mes "They attack our farm and ruin whole crops!! We can't stand it anymore!";
+ next;
+ mes "So, we would like to ask for the help from brave adventurers.";
+ next;
+ mes "Please, hunt 30 Savages to save our crops!";
+ next;
+ mes "You can easily find those monsters around our town and field.";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "-- Payon town hall members --";
+ break;
+ case 3256:
+ mes "This mission is assigned by the Morroc blacksmith Aragham.";
+ next;
+ mes "Hello~~~~, Adventurers! This is Aragham, the hottest blacksmith in Morroc!";
+ next;
+ mes "Anyway, I have a son named Aragam Junior, the cute one. Haha.";
+ next;
+ mes "He will be attending summer camp this summer, but he doesn't know how to swim.";
+ next;
+ mes "I want to teach him, but as you know I am a blacksmith, a far cry from swimming! Hehe.";
+ next;
+ mes "But, I figured that if I make swim fins, it will be great for his confidence~!";
+ next;
+ mes "To make it, I need 30 Sticky Webfoots from a Roda Frog. Can you bring them to me?";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "PS. Do not compare me with Hollgrehenn or Antonio!!!!";
+ next;
+ mes "-- The hottest blacksmith, Morroc blacksmith Aragham --";
+ break;
+ case 3257:
+ mes "This mission is assigned by an inventor Dorian from Izlude.";
+ next;
+ mes "Have you heard the story that if women have a grudge on their mind, it will bring natural disasters.";
+ next;
+ mes "Wow, so guys must watch out for those sensitive women! Make sure they don't have any grudges on you.";
+ next;
+ mes "Women can bring strange phenomenons with them!";
+ next;
+ mes "I am so intrigued with that story that I'm trying to prove that it can be true.";
+ next;
+ mes "So I need to make women upset! Haha, I know what a mean idea, right?";
+ next;
+ mes "But this is seriously just for studying... So please hunt 30 Sohee's who seems to be revived from victimized souls.";
+ next;
+ mes "So I can keep observing the case.";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "-- Elegance inventor Dorian --";
+ break;
+ case 3258:
+ mes "This mission is assigned by Wallah from Payon.";
+ next;
+ mes "Hello, adventurer. How are you? How is your health?";
+ next;
+ mes "I am a pharmacist and I am having a hard time getting special ingredients lately.";
+ next;
+ mes "Because I am a little sensitive girl, how can I possibly get those things by myself.";
+ next;
+ mes "So, please help me. Just bring 40 Huge Leafs to me, that will be enough to complete my special medicine!";
+ next;
+ mes "Please bring it as soon as possible, people need my medicine.";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "-- Wallah --";
+ break;
+ case 3259:
+ mes "This mission is assigned by puppet master Woonute from Geffen.";
+ next;
+ mes "You know being a puppet master is kind of a hard job to satisfy people.";
+ next;
+ mes "People can search and see so many different things on their own thesedays.";
+ next;
+ mes "Their expectations are getting high, I can't satisfy them anymore.";
+ next;
+ mes "But if I can make new toy concepts, like living toys, it will be ground breaking.";
+ next;
+ mes "I heard that there are live dolls called Marionettes. Can you hunt 30 Marionettes for me? And also bring 30 Golden Hair, those will be great materials for the new toys.";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "-- Puppet Master Woonute --";
+ break;
+ case 3260:
+ mes "This mission is assigned by an exterminator from Prontera.";
+ next;
+ mes "As the weather gets warmer, insects multiply more and more. It is already out of control.";
+ next;
+ mes "People in Prontera cannot sleep because of all the bugs in their house.";
+ next;
+ mes "So, please help us, hunt 30 Hunter Flies. Then the flies can be reduced slowly.";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "-- The Prontera exterminator --";
+ break;
+ case 3261:
+ mes "This mission is assigned by Cheese Dongja from Payon.";
+ next;
+ mes "Have you heard about Munak?";
+ next;
+ mes "The ugly monster Munak is threatening people in Payon.";
+ next;
+ mes "So we need brave adventurers like you!";
+ next;
+ mes "Please hunt 30 Munaks then Payon will be in peace.";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "- Payon Cheese Dongja -";
+ break;
+ case 3262:
+ mes "This mission is assigned by a gem dealer, Ibraham from Morroc.";
+ next;
+ mes "A small beautiful flower in the barren desert... What an incredible scene it would be!";
+ next;
+ mes "Planting flowers can make the world green and it will be so pretty everywhere.";
+ next;
+ mes "I plan to plant strong flowers in the Morroc desert so the soil gets better.";
+ next;
+ mes "I need 40 Maneater Blossom from Flora, I know Maneater Blossom is an ugly flower, but still it is a plant.";
+ next;
+ mes "I hope you can hunt Flora and get me 40 Maneater Blossoms. You are making the world green! Be proud!";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "-- Morroc Ibraham --";
+ break;
+ case 3263:
+ mes "This mission is assigned by the Payon blacksmith Antonio.";
+ next;
+ mes "Magic wand! Have you heard about it? It is an incredible wand!";
+ next;
+ mes "If you say the magic words and swing the wand, it will make your wishes come true.";
+ next;
+ mes "So, I decided to make it by myself. Then I will be rich and powerful~! Haha!!";
+ next;
+ mes "To make the wand, I need some special materials.";
+ next;
+ mes "Please bring me 30 Dokebi Horns and 30 Bamboo Cut. If you do so, I will lend you my magic wand once. Haha, good deal?";
+ next;
+ mes "Please confirm it to us after you complete the mission, then we will give you proper rewards.";
+ next;
+ mes "-- Payon blacksmith Antonio --";
+ break;
+ }
+ return;
}
diff --git a/npc/re/quests/eden/eden_common.txt b/npc/re/quests/eden/eden_common.txt
index 1b05030c8..8570fd39e 100644
--- a/npc/re/quests/eden/eden_common.txt
+++ b/npc/re/quests/eden/eden_common.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Eden Group Quests - Common NPCs
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.6
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Eden Group Headquarter NPC's.
//===== Additional Comments: =================================
diff --git a/npc/re/quests/eden/eden_quests.txt b/npc/re/quests/eden/eden_quests.txt
index 3c9d421a7..4a85bdc79 100644
--- a/npc/re/quests/eden/eden_quests.txt
+++ b/npc/re/quests/eden/eden_quests.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Eden Group Quest - Quests NPCs
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.4b
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Eden Group Headquarter NPC's.
//===== Additional Comments: =================================
diff --git a/npc/re/quests/eden/eden_service.txt b/npc/re/quests/eden/eden_service.txt
index 041395861..fd6e9a47f 100644
--- a/npc/re/quests/eden/eden_service.txt
+++ b/npc/re/quests/eden/eden_service.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Eden Group Quests - Service NPCs
//===== By: ==================================================
//= L0ne_W0lf
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= Any rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Paradise Group storage access.
//===== Additional Comments: =================================
diff --git a/npc/re/quests/homu_s.txt b/npc/re/quests/homu_s.txt
index 1881a97ca..66e2b5c3d 100644
--- a/npc/re/quests/homu_s.txt
+++ b/npc/re/quests/homu_s.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Homunculus S Quest
//===== By: ==================================================
//= Masao
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Evolves an Homunculus which is at least Level 99 to the
//= new Homunculus S Class.
diff --git a/npc/re/quests/magic_books.txt b/npc/re/quests/magic_books.txt
index 943d0c8dd..9f9ccec1f 100644
--- a/npc/re/quests/magic_books.txt
+++ b/npc/re/quests/magic_books.txt
@@ -1,4 +1,4 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Magic Book Seller
//===== By: ==================================================
//= Masao
@@ -6,7 +6,7 @@
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena
+//= Hercules
//===== Description: =========================================
//= An NPC which sells you different kinds of Magic Books.
//===== Additional Comments: =================================
diff --git a/npc/re/quests/mrsmile.txt b/npc/re/quests/mrsmile.txt
index c36ecf91a..029633437 100644
--- a/npc/re/quests/mrsmile.txt
+++ b/npc/re/quests/mrsmile.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Mr. Smile Quest
//===== By: ==================================================
//= Daegaladh, Masao
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= [Aegis Conversion]
//= Trade Clover, Fluff and Jellopy for a Mr. Smile mask.
diff --git a/npc/re/quests/pile_bunker.txt b/npc/re/quests/pile_bunker.txt
index 31b36c82b..c2c979430 100644
--- a/npc/re/quests/pile_bunker.txt
+++ b/npc/re/quests/pile_bunker.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Pile Bunker Quest
//===== By: ==================================================
//= JayPee Mateo
//===== Current Version: =====================================
//= 2.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= 1.0 A Pile Bunker quest based on iRO WiKi. [JayPee Mateo]
//= 2.0 Rewrited the Script a little so it looks a bit better. [Masao]
diff --git a/npc/re/quests/quests_brasilis.txt b/npc/re/quests/quests_brasilis.txt
index 88b021a0f..2e1cbe75a 100644
--- a/npc/re/quests/quests_brasilis.txt
+++ b/npc/re/quests/quests_brasilis.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Brasilis Qiests
//===== By ===================================================
//= L0ne_W0lf
//===== Version ==============================================
//= 1.2
//===== Compatible With ======================================
-//= rAthena SVN
+//= Hercules
//===== Description ==========================================
//= [Translated from the Official]
//= Lost Puppies (Repeatable, 24 hours.)
diff --git a/npc/re/quests/quests_dewata.txt b/npc/re/quests/quests_dewata.txt
index ad986da6c..f0f6fef1e 100644
--- a/npc/re/quests/quests_dewata.txt
+++ b/npc/re/quests/quests_dewata.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Dewata Quest NPCs
//===== By: ==================================================
//= Gennosuke Kouga, Muad_Dib
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Quest NPCs related to Dewata:
//== "Dewata Legend"
diff --git a/npc/re/quests/quests_dicastes.txt b/npc/re/quests/quests_dicastes.txt
index e55ed80a6..20320b078 100644
--- a/npc/re/quests/quests_dicastes.txt
+++ b/npc/re/quests/quests_dicastes.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= El Dicastes Quest NPCs
//===== By: ==================================================
//= Gennosuke Kouga, Muad_Dib
//===== Current Version: =====================================
-//= 1.8a
+//= 1.9a
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Quest NPCs related to Dewata:
//== Sapha's Visit, Doha's Secrect Order, Frede's Request,
@@ -25,6 +25,9 @@
//= 1.7 Updated to match the official script. [Joseph]
//= 1.8 Optimized and fixed invalid checkquest. [Joseph]
//= 1.8a Disabled "Fish Tails" until Izlude RE coordinates are found. [Euphy]
+//= 1.8b Updated "Calyon" NPC and fixed a check. [Euphy]
+//= 1.9 Updated "Fish Tails" with RE coordinates.
+//= 1.9a Minor fix. [Joseph]
//============================================================
// Entrance
@@ -436,7 +439,7 @@ function script que_dic {
delitem getarg(3), getarg(4);
}
else if (getarg(0) == 2) {
- for(.@i = 1; .@i < getargcount(); .@i++) {
+ for(set .@i,1; .@i<getargcount(); set .@i,.@i+1) {
if (checkquest(getarg(.@i)) >= 0)
erasequest getarg(.@i);
}
@@ -1027,7 +1030,7 @@ dic_in01,40,193,1 script Papyrus#0001 453,{
else if (.@doc == 11) eldicastes_dp(12169,"Stem","There is nothing like Midgard plants in Manuk.","These plants are used for food and medicine and some are even poisonous.");
else if (.@doc == 12) eldicastes_dp(12170,"Pointed Scale","Stem from a bumpy life form. Research required as the usage is unknown.","");
else if (.@doc == 13) eldicastes_dp(12171,"Resin","Sap from an old tree collected and solidified. Very valuable in the human world.","");
- //else if (.@doc == 14) eldicastes_dp(12174,"Fish Tail","Humans eat meat called fish.","Can be used as important food supply for foreign adventurers visiting in the city.");
+ else if (.@doc == 14) eldicastes_dp(12174,"Fish Tail","Humans eat meat called fish.","Can be used as important food supply for foreign adventurers visiting in the city.");
else if (.@doc == 15) eldicastes_dp(12175,"Worm Peeling","They say some Worm Peelings are valuable.","But this is based on the human's standard of value. Research required.");
else if (.@doc == 16) eldicastes_dp(12176,"Gill","There are Midgard creatures that live in the sea and breathe through gills.","Further research on their ecology will be useful.");
else if (.@doc == 17) eldicastes_dp(12177,"Tooth of Bat","Traces of a nocturnal creature unknown to Manuk. Not a strong creature from the size of its teeth.","");
@@ -1090,7 +1093,7 @@ dic_in01,25,187,0 duplicate(Document Package#main) Document Package#0004 844
function script unknown_d {
if (checkquest(getarg(0)) == -1) {
- mes "You see some traces of digging";
+ mes "You see some traces of digging.";
close;
}
specialeffect2 EF_SPRINKLESAND;
@@ -1115,7 +1118,7 @@ pay_fild02,105,113,0 script Pointed Scales 844,{ unknown_d(12170,906); }
pay_fild01,152,171,0 script Resin 844,{ unknown_d(12171,907); }
gef_fild01,104,111,0 script Spawn 844,{ unknown_d(12172,908); }
prt_fild08,299,332,0 script Jellopy 844,{ unknown_d(12173,909); }
-//izlude,132,136,0 script Fish Tails 844,{ unknown_d(12174,1023); }
+izlude,136,160,0 script Fish Tails 844,{ unknown_d(12174,1023); } // Pre-RE: izlude (132,136)
prt_fild05,303,169,0 script Worm Peelings 844,{ unknown_d(12175,955); }
iz_dun03,155,165,0 script Gills 844,{ unknown_d(12176,956); }
mjo_dun01,222,226,0 script Tooth of Bat 844,{ unknown_d(12177,913); }
@@ -2279,159 +2282,175 @@ dic_in01,158,188,3 script Jarute HesLanta#ep133_2 451,{
}
dicastes01,223,190,1 script Calyon#pa8029 453,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of items. Let's try again after you reduce the number of items.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "Cannot proceed because the weight of your items is too heavy. Let's try again after you get rid of some weight.";
+ close;
+ }
+ if (!isequipped(2782)) {
+ mes "¡õ¢£¡ô";
+ mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£";
+ next;
+ mes "I don't feel confident in talking since you wouldn't understand anything.";
+ close;
+ }
+ if (ep13_3_invite < 6) {
+ mes "Sapha keeps a distance from you even when you try to talk. Looks like he called on Guard Galten. Time to go.";
+ close;
+ }
mes "[Calyon]";
- if (isequipped(2782)) {
- if (ep13_3_invite == 5) {
- if (BaseLevel < 80) {
- mes "Sorry, a minimum base level of 80 or higher is required to obtain my request.";
- close; }
- if (checkquest(12163,PLAYTIME) == 2) {
- mes "Calculate your request activities with the ^800080Transport Dept. 1 Manager^000000 at Operations and then come back.";
- close;
- } else if (checkquest(12163,PLAYTIME) != -1) {
- mes "We're done for the day. You can report back to the ^800080Transport Dept. 1 Manager^000000 at Operations. Good luck.";
- close; }
- mes "Welcome.";
- mes "What brings you here?";
- next;
- if(select("Please explain the request to me.", "Please give me a request.")==1) {
- mes "[Calyon]";
- mes "The Transport Dept. 1 and 2 brings in rare items that are not available here.";
- next;
- mes "[Calyon]";
- mes "It is one of the key departments that obtains the rich supplies mostly from the Midgard Continent.";
- next;
- mes "[Calyon]";
- mes "Please see me any time once you are ready.";
- close;
- }
- set .@calyonrequest,rand(1,11);
- mes "[Calyon]";
- mes "Finally, I have a request for you. It is an important one so I need you to be focused.";
- next;
- mes "[Calyon]";
- if (.@calyonrequest == 1) {
- setquest 12139;
- setquest 12163;
- mes "The high minister is looking for the Midgard product, Witherless Roses these days.";
- mes "Not sure if it's a good gift but some have seen him with it on his head and showing it off.";
- next;
- mes "[Calyon]";
- mes "So... I know this is difficult to ask for but please bring me 1 Witherless Rose. This is just between you and me.";
- next;
- mes "You have received a request named ^800080Respect for Taste^000000.";
- } else if (.@calyonrequest == 2) {
- setquest 12137;
- setquest 12163;
- mes "The industrial research center researches ways of refining Bradium efficiently but they are always short on test materials.";
- next;
- mes "[Calyon]";
- mes "I heard there is a merchant in the adventurer's city who sells Glass Tubes. I will need 4 of them.";
- next;
- mes "You have received a request named ^800080Tools for Experiment^000000.";
- } else if (.@calyonrequest == 3) {
- setquest 12138;
- setquest 12163;
- mes "The pub owner said he wants to give a gift to all his regular Sapha customers.";
- next;
- mes "[Calyon]";
- mes "But doesn't know what to give. If you see any interesting gifts in Midgard, can bring back 5 of them?";
- next;
- mes "You have received a request named ^800080Fine Gift Samples^000000.";
- } else if (.@calyonrequest == 4) {
- setquest 12140;
- setquest 12163;
- mes "A request from the pub owner. He says he can't use disposable leaf plates for regular customers.";
- next;
- mes "[Calyon]";
- mes "He is asking for 15 solid, white chinas from Midgard.";
- next;
- mes "You have received a request named ^800080Courtesy for Regular^000000.";
- } else if (.@calyonrequest == 5) {
- setquest 12141;
- setquest 12163;
- mes "I have a personal request. I heard there is a round transparent handicraft in Midgard.";
- mes "I think they are called Glass Beads.";
- next;
- mes "[Calyon]";
- mes "We have similar manufactured items here but nothing compared to the elaborate sphere there.";
- mes "Please get me 10 of them.";
- next;
- mes "You have received a request named ^800080Special Package^000000.";
- } else if (.@calyonrequest == 6) {
- setquest 12142;
- setquest 12163;
- mes "Hmm... I don't know how to start. The high minister is requesting for puppets from Midgard.";
- mes "I don't know what it is but since the high minister is asking for it, it must be used for a very important purpose.";
- next;
- mes "[Calyon]";
- mes "Please bring 15 of them.";
- next;
- mes "You have received a request named ^800080Dangerous Request^000000.";
- } else if (.@calyonrequest == 7) {
- setquest 12143;
- setquest 12163;
- mes "I heard there is a trend among many of my colleagues here about a musical accessory made from a Bill of Birds from Midgard.";
- next;
- mes "[Calyon]";
- mes "I'm thinking of distributing them within the Operations building.";
- mes "Can you buy and bring back 50 of them?";
- next;
- mes "You have received a request named ^800080Strange Trend^000000.";
- } else if (.@calyonrequest == 8) {
- setquest 12144;
- setquest 12163;
- mes "The pub owner said he wanted to decorate the pub with something called Clam Shells.";
- mes "Please bring back about 50 of them.";
- next;
- mes "[Calyon]";
- mes "I have no idea how he will use them but I think he has a very unique taste after being acquainted with many adventurers.";
- next;
- mes "You have received a request named ^800080Unknown Usage^000000.";
- } else if (.@calyonrequest == 9) {
- setquest 12145;
- setquest 12163;
- mes "We don't have cuisine for ourselves but many adventurers seem to enjoy the art of eating.";
- mes "So the pub owner needs a plate for his new cuisine.";
- next;
- mes "[Calyon]";
- mes "He asked for 20 Crab Shells.";
- mes "I have no idea where you can get them but... good luck.";
- next;
- mes "You have received a request named ^800080Other World Cuisine^000000.";
- } else if (.@calyonrequest == 10) {
- setquest 12146;
- setquest 12163;
- mes "I think the most useful Midgard item is Scells.";
- next;
- mes "[Calyon]";
- mes "Use Scells to fill any crack or holes in a building and then mix and plaster grinded Garlet to it and the building is maintained quick and simple.";
- mes "Can you bring back 30 of them?";
- next;
- mes "You have received a request named ^800080Filling in Cracks^000000.";
- } else if (.@calyonrequest == 11) {
- setquest 12147;
- setquest 12163;
- mes "Garlets are an element in building maintenance.";
- mes "It is one of the most important materials in buildings.";
- next;
- mes "[Calyon]";
- mes "Before Garlets were available, we crushed and used Zargons but they have become difficult to come by.";
- mes "Please bring back 40 of them.";
- next;
- mes "You have received a request named ^800080Adhesive Material^000000."; }
- mes "You can check details of the request and who to report back to by opening the ^800080Quest Window^000000.";
- mes "You have 23 hours to complete this mission.";
- close;
- }
- mes "- The Sapha keeps a distance from you even when you try to talk.";
- mes "It looks like he is calling for a Galten. Time to go. -";
- close;
+ if (BaseLevel < 80) {
+ mes "Ha ha, come back again after you are trained more. I have no request that fits you.";
+ close;
+ }
+ if (checkquest(12163,PLAYTIME) == 2) {
+ mes "Calculate your request activities with the ^800080Transport Dept. 1 Manager^000000 at Operations and then come back.";
+ close;
+ } else if (checkquest(12163,PLAYTIME) != -1) {
+ mes "We're done for the day. You can report back to the ^800080Transport Dept. 1 Manager^000000 at Operations. Good luck.";
+ close;
}
- mes "¡õ¢£¡ô";
- mes "¡ö¡ø¡ó ¢£ ¡ö¡ñ¡ï ¡ù ¡ð¢²¢£";
+ mes "Welcome.";
+ mes "What brings you here?";
next;
- mes "- I can't understand him... -";
+ if(select("Please explain the request to me.", "Please give me a request.") == 1) {
+ mes "[Calyon]";
+ mes "The Transport Dept. 1 and 2";
+ mes "brings in rare items";
+ mes "that are not available";
+ mes "here.";
+ next;
+ mes "[Calyon]";
+ mes "It is one of the";
+ mes "key departments that";
+ mes "obtains the rich supplies";
+ mes "mostly from the Midgard Continent.";
+ next;
+ mes "[Calyon]";
+ mes "Please see me any time";
+ mes "once you are ready.";
+ close;
+ }
+ mes "[Calyon]";
+ mes "Finally, I have a request for you. It is an important one so I need you to be focused.";
+ next;
+ set .@calyonrequest,rand(1,11);
+ mes "[Calyon]";
+ if (.@calyonrequest == 1) {
+ setquest 12139;
+ setquest 12163;
+ mes "The high minister is looking for the Midgard product, Witherless Roses these days.";
+ mes "Not sure if it's a good gift but some have seen him with it on his head and showing it off.";
+ next;
+ mes "[Calyon]";
+ mes "So... I know this is difficult to ask for but please bring me 1 Witherless Rose. This is just between you and me.";
+ next;
+ mes "You have received a request named ^800080Respect for Taste^000000.";
+ } else if (.@calyonrequest == 2) {
+ setquest 12137;
+ setquest 12163;
+ mes "The industrial research center researches ways of refining Bradium efficiently but they are always short on test materials.";
+ next;
+ mes "[Calyon]";
+ mes "I heard there is a merchant in the adventurer's city who sells Glass Tubes. I will need 4 of them.";
+ next;
+ mes "You have received a request named ^800080Tools for Experiment^000000.";
+ } else if (.@calyonrequest == 3) {
+ setquest 12138;
+ setquest 12163;
+ mes "The pub owner said he wants to give a gift to all his regular Sapha customers.";
+ next;
+ mes "[Calyon]";
+ mes "But doesn't know what to give. If you see any interesting gifts in Midgard, can bring back 5 of them?";
+ next;
+ mes "You have received a request named ^800080Fine Gift Samples^000000.";
+ } else if (.@calyonrequest == 4) {
+ setquest 12140;
+ setquest 12163;
+ mes "A request from the pub owner. He says he can't use disposable leaf plates for regular customers.";
+ next;
+ mes "[Calyon]";
+ mes "He is asking for 15 solid, white chinas from Midgard.";
+ next;
+ mes "You have received a request named ^800080Courtesy for Regular^000000.";
+ } else if (.@calyonrequest == 5) {
+ setquest 12141;
+ setquest 12163;
+ mes "I have a personal request. I heard there is a round transparent handicraft in Midgard.";
+ mes "I think they are called Glass Beads.";
+ next;
+ mes "[Calyon]";
+ mes "We have similar manufactured items here but nothing compared to the elaborate sphere there.";
+ mes "Please get me 10 of them.";
+ next;
+ mes "You have received a request named ^800080Special Package^000000.";
+ } else if (.@calyonrequest == 6) {
+ setquest 12142;
+ setquest 12163;
+ mes "Hmm... I don't know how to start. The high minister is requesting for puppets from Midgard.";
+ mes "I don't know what it is but since the high minister is asking for it, it must be used for a very important purpose.";
+ next;
+ mes "[Calyon]";
+ mes "Please bring 15 of them.";
+ next;
+ mes "You have received a request named ^800080Dangerous Request^000000.";
+ } else if (.@calyonrequest == 7) {
+ setquest 12143;
+ setquest 12163;
+ mes "I heard there is a trend among many of my colleagues here about a musical accessory made from a Bill of Birds from Midgard.";
+ next;
+ mes "[Calyon]";
+ mes "I'm thinking of distributing them within the Operations building.";
+ mes "Can you buy and bring back 50 of them?";
+ next;
+ mes "You have received a request named ^800080Strange Trend^000000.";
+ } else if (.@calyonrequest == 8) {
+ setquest 12144;
+ setquest 12163;
+ mes "The pub owner said he wanted to decorate the pub with something called Clam Shells.";
+ mes "Please bring back about 50 of them.";
+ next;
+ mes "[Calyon]";
+ mes "I have no idea how he will use them but I think he has a very unique taste after being acquainted with many adventurers.";
+ next;
+ mes "You have received a request named ^800080Unknown Usage^000000.";
+ } else if (.@calyonrequest == 9) {
+ setquest 12145;
+ setquest 12163;
+ mes "We don't have cuisine for ourselves but many adventurers seem to enjoy the art of eating.";
+ mes "So the pub owner needs a plate for his new cuisine.";
+ next;
+ mes "[Calyon]";
+ mes "He asked for 20 Crab Shells.";
+ mes "I have no idea where you can get them but... good luck.";
+ next;
+ mes "You have received a request named ^800080Other World Cuisine^000000.";
+ } else if (.@calyonrequest == 10) {
+ setquest 12146;
+ setquest 12163;
+ mes "I think the most useful Midgard item is Scells.";
+ next;
+ mes "[Calyon]";
+ mes "Use Scells to fill any crack or holes in a building and then mix and plaster grinded Garlet to it and the building is maintained quick and simple.";
+ mes "Can you bring back 30 of them?";
+ next;
+ mes "You have received a request named ^800080Filling in Cracks^000000.";
+ } else if (.@calyonrequest == 11) {
+ setquest 12147;
+ setquest 12163;
+ mes "Garlets are an element in building maintenance.";
+ mes "It is one of the most important materials in buildings.";
+ next;
+ mes "[Calyon]";
+ mes "Before Garlets were available, we crushed and used Zargons but they have become difficult to come by.";
+ mes "Please bring back 40 of them.";
+ next;
+ mes "You have received a request named ^800080Adhesive Material^000000.";
+ }
+ mes "You can check details of the request and who to report back to by opening the ^800080Quest Window^000000.";
close;
}
@@ -6669,7 +6688,7 @@ man_in01,315,52,3 script Guard Captain Avalanche 450,{
}
else if (ep13_3_invite == 6) {
mes "[Avalanche]";
- mes "Oh.. You have the Light of El Dicastes.";
+ mes "Oh... You have the Light of El Dicastes.";
mes "it would be helpful for your travel.";
next;
mes "[Avalanche]";
@@ -6687,7 +6706,8 @@ man_in01,315,52,3 script Guard Captain Avalanche 450,{
next;
mes "[Avalanche]";
mes "Always take care of yourself at all times.";
- mes "Haha.. but then you humans are very strong.";
+ mes "Haha... but then you humans are very strong.";
+ close;
}
dic_in01,42,264,3 script Adventurer Clerk#ep133 453,{
@@ -6941,7 +6961,7 @@ dic_in01,42,264,3 script Adventurer Clerk#ep133 453,{
mes "But of course, since this is adding spells on top of its original magic, I cannot guarantee that you will get what you want on one try.";
close;
}
- if (countitem(2844) < 1) { //Light of El Dicastes
+ if (countitem(2844) < 1) {
mes "[Kareka]";
mes "Either you are not wearing or don't have the equipment to upgrade on you.";
close;
@@ -7318,8 +7338,9 @@ dic_fild01,228,159,4 script Jahbong#pa0829 496,{
mes "Why are you here?";
mes "Jahbong will exchange ^8000801 Sapha Certification^000000 for ^8000801 item^000000!";
next;
- switch(select("Just came to see what you have.:I want the Feral Boots!:Give me the Feral Tail!:Give me the Golden Bell!:How much to buy you?")) {
- case 1:
+ set .@i, select("Just came to see what you have.:I want the Feral Boots!:Give me the Feral Tail!:Give me the Golden Bell!:How much to buy you?")-1;
+ switch (.@i) {
+ case 0:
mes "[Jahbong]";
mes "Meow!";
next;
@@ -7335,47 +7356,8 @@ dic_fild01,228,159,4 script Jahbong#pa0829 496,{
mes "[Jahbong]";
mes "There are some crazy adventurers asking if they can purchase me! Jahbong is not for sale! I'll just bite you if you ask!!";
close;
- case 2:
- mes "[Jahbong]";
- mes "Are you really buying something?!";
- next;
- if(select("Nope:Give me!!!")==1) {
- mes "[Jahbong]";
- mes "Okay!";
- close; }
- mes "[Jahbong]";
- mes "Here you go!";
- delitem 6304,1;
- getitem 2463,1;
- close;
- case 3:
- mes "[Jahbong]";
- mes "Are you really buying something?!";
- next;
- if(select("Nope:Give me!!!")==1) {
- mes "[Jahbong]";
- mes "Okay!";
- close; }
- mes "[Jahbong]";
- mes "Here you go!";
- delitem 6304,1;
- getitem 2564,1;
- close;
case 4:
mes "[Jahbong]";
- mes "Are you really buying something?!";
- next;
- if(select("Nope:Give me!!!")==1) {
- mes "[Jahbong]";
- mes "Okay!";
- close; }
- mes "[Jahbong]";
- mes "Here you go!";
- delitem 6304,1;
- getitem 2843,1;
- close;
- case 5:
- mes "[Jahbong]";
mes "Meooooooooooow!!!!!!!!~~ Meooooooooow!!!!!";
next;
mes "- ^800080Jahbong goes wild^000000. -";
@@ -7385,7 +7367,23 @@ dic_fild01,228,159,4 script Jahbong#pa0829 496,{
next;
mes "- He may react extremely, but Jahbong doesn't seem to be really angry. -";
close;
- }
+ default:
+ break;
+ }
+ mes "[Jahbong]";
+ mes "Are you really buying something?!";
+ next;
+ if (select("Nope:Give me!!!") == 1) {
+ mes "[Jahbong]";
+ mes "Okay!";
+ close;
+ }
+ setarray .@items[1],2463,2564,2843;
+ mes "[Jahbong]";
+ mes "Here you go!";
+ delitem 6304,1;
+ getitem .@items[.@i],1;
+ close;
}
// Cat Hand Agent
@@ -7411,7 +7409,7 @@ moc_para01,44,19,3 script Cat Hand Agent#gekk 496,{
mes "It breaks my heart to think my colleagues will be shivering in the blizzard. I hope I don't get into trouble since I can't do anything about it, right?";
next;
if (select ("Why don't you collect it yourself?:I'm sorry to hear that.") == 1) {
- emotion ET_HUK;
+ emotion e_omg;
mes "[Cat Hand Agent]";
mes "Human!! You're a genius!!";
mes "How did you come up with that?";
@@ -7453,7 +7451,7 @@ moc_para01,44,19,3 script Cat Hand Agent#gekk 496,{
next;
input .@inputstr$;
mes "[Agent Geck]";
- mes "" + name + "? Human names are strange to me.";
+ mes "" + strcharinfo(0) + "? Human names are strange to me.";
next;
mes "[Agent Geck]";
mes "Now you are Geck's personal slav... sponsor.";
@@ -7538,7 +7536,7 @@ moc_fild20,368,197,3 script Cat#to22 876,{
mes "The small body isn't as tall as your ankle and its small but thick paws look like little cushions. The ears that bent backwards when it looked at how big you were stirred up your protective instinct.";
next;
mes "You don't seem to have the nerve to step on the Cat Hand Agent.";
- emotion ET_CRY;
+ emotion e_sob;
close;
}
mes "You look at the Cat Hand Agent's small back and climb over the wall as quick as possible so that it wouldn't notice your weight.";
diff --git a/npc/re/quests/quests_izlude.txt b/npc/re/quests/quests_izlude.txt
index 8855ef2d1..0286baca0 100644
--- a/npc/re/quests/quests_izlude.txt
+++ b/npc/re/quests/quests_izlude.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Quest NPCs related to Izlude
//===== By: ==================================================
//= Daegaladh, Masao
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Edgar's Offer
//===== Additional Comments: =================================
diff --git a/npc/re/quests/quests_mora.txt b/npc/re/quests/quests_mora.txt
new file mode 100644
index 000000000..f1d8e5784
--- /dev/null
+++ b/npc/re/quests/quests_mora.txt
@@ -0,0 +1,5315 @@
+//===== rAthena Script =======================================
+//= Mora Quest NPCs
+//===== By: ==================================================
+//= Euphy
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= rAthena SVN
+//===== Description: =========================================
+//= Quest NPCs related to Mora:
+//== Theore's Request, Chesire's New Day,
+//== Helping Lope and Euridi, Mora Daily Quests,
+//== Find the Research Tools, Knights of the Neighborhood
+//===== Additional Comments: =================================
+//= 0.1 NPCs are currently placeholders. [Euphy]
+//= 1.0 Implemented all official quests. [Euphy]
+//============================================================
+
+// Theore's Request :: bs
+//============================================================
+mid_camp,148,222,4 script Theore#ep14_1_bs 982,3,3,{
+ if (BaseLevel < 100) {
+ mes "- A person with a white gown -";
+ mes "- is pulling at his hair. -";
+ close;
+ }
+ if (ep14_1_bs == 0) {
+ mes "[Theore]";
+ mes "Aaaarrrggghh!!!";
+ mes "Darn it!!!!";
+ mes "I'm finished!!!";
+ next;
+ mes "[Theore]";
+ mes "How am I supposed to submit a report that's so bad!!! A 5-year-old could do better!!!";
+ mes "Noooo!!!";
+ set ep14_1_bs,1;
+ close;
+ } else if (ep14_1_bs == 1) {
+ mes "- A person with a white gown -";
+ mes "- is pulling at his hair. -";
+ next;
+ if(select("Try talking to him.:How noisy.") == 2) {
+ mes "[Theore]";
+ mes "Oh, of course, I'm sorry.";
+ mes "I'll keep it down.";
+ close;
+ }
+ mes "["+strcharinfo(0)+"]";
+ mes "Sir... Are you okay?";
+ mes "You will lose all your hair like that.";
+ mes "Calm down.";
+ next;
+ mes "[Theore]";
+ mes "Sob.......";
+ next;
+ mes "[Theore]";
+ mes ".......";
+ next;
+ mes "[Theore]";
+ mes "Odin!!!";
+ mes "Freyja!!!!";
+ mes "Sazarim!!!";
+ mes "Thank you!!";
+ mes "It's not all over!!";
+ next;
+ mes "[Theore]";
+ mes "There's always hope! I, Theore, will persevere and go on!!";
+ next;
+ mes "[Theore]";
+ mes "Dear Adventurer!!!";
+ mes "No, no, dear Warrior!!!!";
+ mes "Are you busy at the moment?";
+ mes "If you spare me a little time, I will see to it that you're rewarded handsomely!";
+ next;
+ switch(select("I'm busy.:Listen to him more.")) {
+ case 1:
+ mes "[Theore]";
+ mes ".......";
+ mes "I see, I suppose it can't be helped.";
+ mes "I'll probably lose all my hair and be on the ad for hair growth solutions. But I won't hold it against you, Warrior.";
+ next;
+ mes "[Theore]";
+ mes "Dear God! My luck ends here. *sob*";
+ mes "Even though the world is turning its back on me, I won't blame anyone!!!";
+ close;
+ case 2:
+ mes "[Theore]";
+ mes "Ahhh!";
+ mes "I feel like I was saved.";
+ mes "So the thing is.......";
+ next;
+ mes "[Theore]";
+ mes "Oh! Oh dear!";
+ mes "How rude of me, I haven't even introduced myself.";
+ mes "My name is Theore, and I work for 'Bazett Teablack's Institute of Culture of the Other World.' ";
+ next;
+ mes "[Theore]";
+ mes "I'm currently working on researching Laphines in the Splendide Basecamp.";
+ mes "Might be because I've been working soooo hard, but these days the Laphines all run away as soon as they see me.";
+ next;
+ mes "[Theore]";
+ mes "The deadline is approaching, and I still haven't figured out the most critical part. ";
+ mes "My professor will be very disappointed .......";
+ next;
+ mes "[Theore]";
+ mes "So won't you give me a hand?!";
+ mes "Your help will be acknowledged fully - I will tell the professor myself!";
+ next;
+ switch(select("Help.:Don't help.")) {
+ case 1:
+ mes "[Theore]";
+ mes "Sob sob Warrior, you're the best!";
+ mes "I will not forget this!!!";
+ mes "I'm going to write about it in my diary!!";
+ mes "And in the report!!!";
+ mes "And in a letter I'm sending home!!";
+ next;
+ mes "[Theore]";
+ mes "I'll tell my buddies at the lab!!!";
+ mes "I'll tell Lugen!!!";
+ mes "I'll write it in the bulletin board!!!";
+ mes "Let's see!!! Where else?";
+ next;
+ mes "- The man seems to be in a manic state. -";
+ mes "- Wait until he calms down -";
+ mes "- and try speaking to him again. -";
+ set ep14_1_bs,2;
+ setquest 11182;
+ close;
+ case 2:
+ mes "[Theore]";
+ mes ".......";
+ mes "You bad person, making me all worked up.";
+ mes "*sob*";
+ close;
+ }
+ }
+ } else if (ep14_1_bs == 2) {
+ if (checkquest(11182,PLAYTIME) < 2) {
+ mes "[Theore]";
+ mes "......";
+ switch(rand(1,4)) {
+ case 1:
+ mes "I must tell my next-door neighbor Pico!!!";
+ mes "And Kachua!!!";
+ break;
+ case 2:
+ mes "Tell the merchant across the street!!!";
+ mes "And also tell the administrator!!!";
+ break;
+ case 3:
+ mes "Tell Mr. Holgren!!!";
+ mes "Write up a report for the King!!!";
+ break;
+ case 4:
+ mes "Tell the people around here!!!";
+ mes "Shout it out loud from the observatory so the whole world hears!!!";
+ break;
+ }
+ next;
+ mes "- He is still manic. -";
+ mes "- Wait until he calms down -";
+ mes "- and try speaking to him again. -";
+ close;
+ }
+ mes "[Theore]";
+ mes "My apologies.";
+ mes "I got a little excited.";
+ mes "I do apologize.";
+ next;
+ mes "[Theore]";
+ mes "I'm usually a calm and rational person, but it feels like I've been everywhere - heaven AND hell - today!";
+ next;
+ mes "[Theore]";
+ mes "To the point: what I would like to ask you is not a hard task.";
+ next;
+ mes "[Theore]";
+ mes "As you probably know, the Laphines are at war with the Saphas.";
+ mes "Until recently, they attacked the Saphas mercilessly.";
+ next;
+ mes "[Theore]";
+ mes "But lately, the frequency of attacks has decreased significantly.";
+ mes "I can't figure out why, they are single-minded creatures and it's not likely that they just took pity on the Saphas' situation.";
+ next;
+ mes "[Theore]";
+ mes "Also, there are rumors of unarmed Laphines flying through the fields.";
+ next;
+ mes "[Theore]";
+ mes "I have seen it once, but he ran away as soon as he spotted me and I didn't get a chance to ask him.";
+ mes "I'm sure that he went back to the village. But as desperately as I want to ask, I was banned from entering the Splendide Basecamp.";
+ next;
+ select("Banned?");
+ mes "[Theore]";
+ mes "Well...";
+ mes "I got so excited after the professor assigned me to this research project.......";
+ mes "that I combed through Splendide night and day, and they finally kicked me out.";
+ mes "Ha ha ha!";
+ next;
+ mes "[Theore]";
+ mes "The Laphines may look cute, but they are combat specialists.......";
+ mes "So here I am, without the courage to sneak in, but with the report half-finished.......";
+ next;
+ mes "[Theore]";
+ mes "Tell me, is there a life more unfortunate than mine?";
+ mes "*chuckle*";
+ next;
+ mes "[Theore]";
+ mes "So Warrior, would you please find the Laphines who are coming to the Splendide field, and find out what they're up to?";
+ next;
+ mes "[Theore]";
+ mes "They may run away if you try to speak to them, so pay close attention when you find one.";
+ next;
+ mes "[Theore]";
+ mes "The Laphines are such a rowdy crew, and it's very unsettling to see how quiet they've been - almost like a period of calm before a giant thunderstorm.";
+ set ep14_1_bs,3;
+ changequest 11182,11183;
+ close;
+ } else if (ep14_1_bs == 3) {
+ mes "[Theore]";
+ mes "So Warrior, would you please find the Laphines who are coming to the Splendide field, and ask them what they're up to?";
+ next;
+ mes "[Theore]";
+ mes "They may run away if you try to speak to them, so pay close attention when you find one.";
+ next;
+ mes "[Theore]";
+ mes "The Laphines are such a rowdy crew, and it's very unsettling to see how quiet they've been - almost like a period of calm before a giant thunderstorm.";
+ close;
+ } else if (ep14_1_bs < 10) {
+ if (ep14_1_bs2 == 0) {
+ mes "- He is in no state for conversations. You should take the pouch to Splendide and look for its owner. -";
+ close;
+ } else if (ep14_1_bs2 < 4) {
+ mes "[Theore]";
+ mes "Hmm...... They were rummaging through the bushes?";
+ mes "Hmm... Hmm...";
+ next;
+ mes "[Theore]";
+ mes "They may have left a clue, can you please look around the area?";
+ mes "If they were looking through the bushes, they may have been looking for something they've lost.";
+ mes "Or they may have left something behind.";
+ close;
+ } else if (ep14_1_bs2 < 7) {
+ if (countitem(6390) == 0) {
+ mes "[Theore]";
+ mes "They may have left a clue, can you please look around the area?";
+ mes "If they were looking through the bushes, they may have been looking for something they've lost.";
+ mes "Or they may have left something behind.";
+ close;
+ }
+ mes "[Theore]";
+ mes "A pouch that a Laphine dropped as it fled?";
+ mes "Hmm... Hmm... A soft leather pouch with a string made by soaking dried vines in oil.... too small for humans or Saphas to use...";
+ next;
+ mes "[Theore]";
+ mes "Could... Could it be??!!";
+ mes "that object?!";
+ mes "that I've only heard about, but never came across!!!";
+ next;
+ mes "[Theore]";
+ mes "In the ancient times, Laphines used to carry fairy dust - such as the flying dust, minimizing dust - in a small pouch like this.";
+ next;
+ mes "[Theore]";
+ mes "They usually enjoy extravagant designs, but this 'fairy dust pouch' is something that they always carry around, and it is made simply without extravagant ornaments, keeping in line with tradition.";
+ next;
+ mes "[Theore]";
+ mes "I'm not sure what it'll be like nowadays, but if this is the 'fairy dust pouch,' the owner should be anxious to find it.";
+ next;
+ mes "[Theore]";
+ mes "We can't give it back for free though. In exchange for some information - that's a fair deal!";
+ next;
+ mes "[Theore]";
+ mes "And perhaps they won't be too upset if we look inside the pouch!";
+ mes "Wooow!!";
+ mes "I always believed when I was little that a fairy would come and sprinkle me with flying dust to make me fly!!!";
+ next;
+ mes "- Before I can stop him, -";
+ mes "- he opened the small pouch. -";
+ next;
+ mes "[Theore]";
+ mes ".......";
+ next;
+ mes "[Theore]";
+ mes "Oh...";
+ mes "Berries......and leaves?";
+ mes ".......";
+ next;
+ mes "[Theore]";
+ mes "......What about the flying dust?";
+ mes "Noooo!";
+ mes "My poor innocent imagination!!!!";
+ next;
+ mes "- He is in no state for conversations. You should take the pouch to Splendide and look for its owner. -";
+ set ep14_1_bs2, ep14_1_bs2+3; //4,5,6 -> 7,8,9
+ changequest 11185,11186;
+ close;
+ } else {
+ mes "- He is in no state for conversations. You should take the pouch to Splendide and look for its owner. -";
+ close;
+ }
+ } else if (ep14_1_bs < 18) {
+ mes "- He appears to be busy. You should finish the task at hand and come back. -";
+ close;
+ } else if (ep14_1_bs == 18) {
+ mes "[Theore]";
+ mes "At last, you're back!!!!";
+ mes "How did the investigation go?!";
+ next;
+ mes "[Theore]";
+ mes "Wow!!!";
+ mes "Incredible!!!!!!";
+ mes "Unbelievable!!!";
+ next;
+ mes "[Theore]";
+ mes "The best!!!!";
+ mes "This is surely enough to write an excellent report on!!";
+ mes "All thanks to you, Warrior!!";
+ next;
+ mes "[Theore]";
+ mes "I'll never, EVER forget what you've done for me!";
+ mes "No!!";
+ mes "My grandchildren's grandchildren will remember!!!!";
+ mes "*Sob*";
+ next;
+ mes "[Theore]";
+ mes "Then I'm off to put the finishing touches on the report!!!!!!!";
+ mes "Oh yeah!!!!";
+ set ep14_1_bs,19;
+ getexp 0,200000;
+ getitem 6380,5; //Mora_Coin
+ close;
+ } else if (ep14_1_bs > 18) {
+ mes "[Theore]";
+ mes "I'll write the report with lightning speed!!!!!!!";
+ mes "Oh yeah!!!!";
+ close;
+ }
+ end;
+OnTouch:
+ if (BaseLevel > 99) {
+ if (ep14_1_bs == 0) {
+ mes "[Theore]";
+ mes "Aaaarrrggghh!!!";
+ mes "Darn it!!!!";
+ mes "I'm finished!!!";
+ next;
+ mes "[Theore]";
+ mes "How am I supposed to submit a report that's so bad!!! A 5-year-old could do better!!!";
+ mes "Noooo!!!";
+ set ep14_1_bs,1;
+ close;
+ }
+ }
+ end;
+}
+
+- script #mora_bush -1,{
+ if (ep14_1_bs != 3 || rand(5)) {
+ mes "- It's just an ordinary bush. -";
+ close;
+ }
+ set .@i, atoi(charat(strnpcinfo(2),9));
+ set .@rand, rand(1,3);
+ mes "[Unarmed Laphine]";
+ mes "Aaaarrrrrggggghhhhh!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
+ donpcevent "Fairy#cmd"+.@i+.@rand+"::OnEnable";
+ set ep14_1_bs, .@i+3;
+ set ep14_1_bs2, .@rand;
+ changequest 11183,11184;
+ next;
+ mes "- You try to talk to the Laphine, -";
+ mes "- who is looking around the bushes, -";
+ mes "- but it flew away -";
+ mes "- while yelling fearfully. -";
+ next;
+ mes "- What was the fairy doing? -";
+ mes "- You decide to look around. -";
+ donpcevent "Bush"+.@i+"Timer::OnEnable";
+ close;
+OnEnable:
+ enablenpc strnpcinfo(0);
+ donpcevent "Bush"+charat(strnpcinfo(2),9)+"Timer::OnDisable";
+ end;
+OnDisable:
+ disablenpc strnpcinfo(0);
+ end;
+}
+
+- script #mora_pouch -1,{
+ end;
+OnTouch:
+ set .@i, atoi(charat(strnpcinfo(2),9));
+ if (ep14_1_bs == .@i+3) {
+ if (countitem(6390) == 0) {
+ if (checkweight(1201,1) == 0) {
+ mes " - Hang on there !! -";
+ mes " - You are carrying too many kinds of items - ";
+ mes " - to receive any more items. - ";
+ mes " - Please lighten your load - ";
+ mes " - and try again. - ";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes " - Hang on there !! -";
+ mes " - You are carrying too much weight - ";
+ mes " - Please lighten your load - ";
+ mes " - and try again. - ";
+ close;
+ }
+ mes "- Jumble Fumble -";
+ mes "- Rustle Bustle -";
+ next;
+ if (rand(1,5) == 4) {
+ mes "- You've found a Small pouch. -";
+ if (ep14_1_bs2 > 0 && ep14_1_bs2 < 4)
+ set ep14_1_bs2, ep14_1_bs2+3;
+ changequest 11184,11185;
+ getitem 6390,1; //Small_Pocket
+ close;
+ } else {
+ mes "- You didn't find anything. -";
+ close;
+ }
+ }
+ }
+ end;
+}
+
+- script #mora_fairy -1,{
+ end;
+OnInit:
+ disablenpc strnpcinfo(0);
+ end;
+OnEnable:
+ enablenpc strnpcinfo(0);
+ initnpctimer;
+ end;
+OnDisable:
+ disablenpc strnpcinfo(0);
+ stopnpctimer;
+ end;
+OnTimer5000:
+ donpcevent strnpcinfo(0)+"::OnDisable";
+ stopnpctimer;
+ end;
+}
+
+spl_fild02,79,104,0 duplicate(#mora_bush) Bush#ep14_1_bs1 111
+spl_fild02,79,104,0 duplicate(#mora_pouch) #ep14_1_bs1 139,2,2
+spl_fild02,79,104,6 duplicate(#mora_fairy) Fairy#cmd11 440
+spl_fild02,79,104,6 duplicate(#mora_fairy) Fairy#cmd12 445
+spl_fild02,79,104,6 duplicate(#mora_fairy) Fairy#cmd13 439
+
+spl_fild02,103,344,0 duplicate(#mora_bush) Bush#ep14_1_bs2 111
+spl_fild02,103,344,0 duplicate(#mora_pouch) #ep14_1_bs2 139,2,2
+spl_fild02,103,344,6 duplicate(#mora_fairy) Fairy#cmd21 440
+spl_fild02,103,344,6 duplicate(#mora_fairy) Fairy#cmd22 445
+spl_fild02,103,344,6 duplicate(#mora_fairy) Fairy#cmd23 439
+
+spl_fild02,261,323,0 duplicate(#mora_bush) Bush#ep14_1_bs3 111
+spl_fild02,261,323,0 duplicate(#mora_pouch) #ep14_1_bs3 139,2,2
+spl_fild02,261,323,6 duplicate(#mora_fairy) Fairy#cmd31 440
+spl_fild02,261,323,6 duplicate(#mora_fairy) Fairy#cmd32 445
+spl_fild02,261,323,6 duplicate(#mora_fairy) Fairy#cmd33 439
+
+spl_fild02,137,305,0 duplicate(#mora_bush) Bush#ep14_1_bs4 111
+spl_fild02,137,305,0 duplicate(#mora_pouch) #ep14_1_bs4 139,2,2
+spl_fild02,137,305,6 duplicate(#mora_fairy) Fairy#cmd41 440
+spl_fild02,137,305,6 duplicate(#mora_fairy) Fairy#cmd42 445
+spl_fild02,137,305,6 duplicate(#mora_fairy) Fairy#cmd43 439
+
+spl_fild02,23,196,0 duplicate(#mora_bush) Bush#ep14_1_bs5 111
+spl_fild02,23,196,0 duplicate(#mora_pouch) #ep14_1_bs5 139,2,2
+spl_fild02,23,196,6 duplicate(#mora_fairy) Fairy#cmd51 440
+spl_fild02,23,196,6 duplicate(#mora_fairy) Fairy#cmd52 445
+spl_fild02,23,196,6 duplicate(#mora_fairy) Fairy#cmd53 439
+
+spl_fild02,186,260,0 duplicate(#mora_bush) Bush#ep14_1_bs6 111
+spl_fild02,186,260,0 duplicate(#mora_pouch) #ep14_1_bs6 139,2,2
+spl_fild02,186,260,6 duplicate(#mora_fairy) Fairy#cmd61 440
+spl_fild02,186,260,6 duplicate(#mora_fairy) Fairy#cmd62 445
+spl_fild02,186,260,6 duplicate(#mora_fairy) Fairy#cmd63 439
+
+- script #mora_bush_timer -1,{
+ end;
+OnInit:
+ disablenpc strnpcinfo(0);
+ end;
+OnEnable:
+ enablenpc strnpcinfo(0);
+ initnpctimer;
+ end;
+OnDisable:
+ stopnpctimer;
+ disablenpc strnpcinfo(0);
+ end;
+OnTimer1000:
+ donpcevent "Bush#ep14_1_bs"+charat(strnpcinfo(0),4)+"::OnDisable";
+ end;
+OnTimer600000:
+ donpcevent "Bush#ep14_1_bs"+charat(strnpcinfo(0),4)+"::OnEnable";
+ donpcevent strnpcinfo(0)+"::OnDisable";
+ end;
+}
+spl_fild02,180,1,0 duplicate(#mora_bush_timer) Bush1Timer 440
+spl_fild02,181,1,0 duplicate(#mora_bush_timer) Bush2Timer 440
+spl_fild02,182,1,0 duplicate(#mora_bush_timer) Bush3Timer 440
+spl_fild02,183,1,0 duplicate(#mora_bush_timer) Bush4Timer 440
+spl_fild02,184,1,0 duplicate(#mora_bush_timer) Bush5Timer 440
+spl_fild02,186,1,0 duplicate(#mora_bush_timer) Bush6Timer 440
+
+/*
+spl_fild02,187,1,0 script Field Bush Switch 440,{
+ donpcevent "Bush#ep14_1_bs1::OnEnable";
+ end;
+}
+*/
+
+splendide,183,117,4 script Tired-looking Fairy 438,{
+ if (!isequipped(2782)) {
+ mes "[Tired-looking Fairy]";
+ mes "VeOsaRiveh No ModAsh";
+ next;
+ mes "- You can't understand the fairy's words. -";
+ mes "- You need something to help you interpret them. -";
+ close;
+ }
+ if (ep14_1_bs < 4) {
+ mes "[Tired-looking Fairy]";
+ mes "I'm tired, don't talk to me.";
+ close;
+ } else if (ep14_1_bs < 10) {
+ if (checkquest(11187) == -1) {
+ mes "[Tired-looking Fairy]";
+ mes "I'm tired, don't talk to me.";
+ next;
+ select("Show the pouch.");
+ mes "[Tired-looking Fairy]";
+ mes "Huh?!";
+ mes "Where did you get this from?!";
+ next;
+ select("I found it in the bushes.");
+ mes "[Tired-looking Fairy]";
+ mes "It may not look like much, but it is an important object for us. I suppose I should say thanks.";
+ next;
+ mes "[Tired-looking Fairy]";
+ mes "But it won't be easy to find its owner with just the pouch...";
+ changequest 11186,11187;
+ next;
+ if(select("I think I saw a fairy that might be the owner.:I'll think about it.") == 2) {
+ mes "[Tired-looking Fairy]";
+ mes "Then tell me if you remember anything.";
+ close;
+ }
+ } else if (checkquest(11187) == 2) {
+ mes "[Tired-looking Fairy]";
+ mes "I hope you can find the owner.";
+ close;
+ }
+ mes "[Tired-looking Fairy]";
+ mes "Do you remember how the fairy looked?";
+ next;
+
+ setarray .@Hair$[0],"blonde","grassy-green","woody-brown","sea-blue";
+ setarray .@Skin$[0],"dark","light";
+ setarray .@Clothing$[0],"snow-white","grape","sky-blue","grassy-green";
+ setarray .@Wings$[0],"round","two pairs of","characteristic";
+
+ setarray .@i[1],
+ select("Blonde hair:Grassy-green hair:Woody-brown hair:Sea-blue hair"),
+ select("Dark-skinned:Light-skinned"),
+ select("Snow-white clothing:Grape clothing:Sky-blue clothing:Grassy-green clothing"),
+ select("Round wings:Two pairs of wings:Characteristic Wings");
+
+ set .@i[0], (1 << .@i[1]) | (1 << (.@i[2]+4)) | (1 << (.@i[3]+6)) | (1 << (.@i[4]+10));
+
+ mes "[Tired-looking Fairy]";
+ mes "A "+.@Skin$[.@i[2]-1]+"-skinned fairy with "+.@Hair$[.@i[1]-1]+" hair and "+.@Wings$[.@i[4]-1]+" wings, dressed in "+.@Clothing$[.@i[3]-1]+" clothing.......";
+ switch(.@i[0]) {
+ case 4418: // Kusmi: blonde hair, light skin, grape clothing, two pairs of wings
+ mes "Hmm...... That must be Kusmi.";
+ next;
+ mes "[Tired-looking Fairy]";
+ mes "Kusmi must be roaming the area southeast of the village.";
+ mes "Go see if she has lost her pouch.";
+ if (ep14_1_bs2 == 7)
+ set ep14_1_bs2,10;
+ close;
+ case 2212: // Theodore: grassy-green hair, dark skin, snow-white clothing, round wings
+ mes "Hmm......That must be Theodore.";
+ next;
+ mes "[Tired-looking Fairy]";
+ mes "Theodore must be roaming the area northeast of the village.";
+ mes "Go see if he has lost his pouch.";
+ if (ep14_1_bs2 == 8)
+ set ep14_1_bs2,11;
+ close;
+ case 9264: // Pauchon: sea-blue hair, dark skin, grassy-green clothing, characteristic wings
+ mes "Hmm......That must be Pauchon.";
+ next;
+ mes "[Tired-looking Fairy]";
+ mes "Pauchon must be roaming the area north of the village.";
+ mes "Go see if she has lost her pouch.";
+ if (ep14_1_bs2 == 9)
+ set ep14_1_bs2,12;
+ close;
+ default:
+ next;
+ mes "[Tired-looking Fairy]";
+ mes "Hmm...";
+ mes "I don't remember seeing such a fairy.";
+ mes "Are you sure you're not mistaken?";
+ mes "Try to remember it again.";
+ close;
+ }
+ }
+ mes "[Tired-looking Fairy]";
+ mes "What's up?";
+ mes "Did you find the owner of the pouch?";
+ close;
+}
+
+splendide,119,138,4 script Kusmi#ep14_1_bs 440,{
+ if (!isequipped(2782)) {
+ mes "[Kusmi]";
+ mes "DimFusTal Mu Lars";
+ mes "ModAnduLo";
+ mes "Mod";
+ mes "DorDuMe U NohLarsFulo Mu Fus";
+ next;
+ mes "- You can't understand the fairy's words. -";
+ mes "- You need something to help you interpret them. -";
+ close;
+ }
+ if (ep14_1_bs > 3 && ep14_1_bs < 10) {
+ mes "[Kusmi]";
+ mes "And who mayy you be?";
+ next;
+ select("Show the pouch.");
+ if (countitem(6390) == 0) {
+ mes "[Kusmi]";
+ mes "What is it that you want to show mee?";
+ close;
+ }
+ if (ep14_1_bs2 == 10) {
+ mes "[Kusmi]";
+ mes "Ahh!!";
+ mes "My pouch!!!!!";
+ mes "Thank you sirr!!!!!";
+ mes "I've been looking for it all overr!";
+ next;
+ select("Ask about the rumor.");
+ mes "[Kusmi]";
+ mes "That's a difficult questionn!";
+ mes "But you've returned my pouch, so I'll have to answerr......";
+ next;
+ mes "[Kusmi]";
+ mes "Promise me you won't tell anyonee!";
+ mes "If you can promise, please talk to me againn.";
+ delitem 6390,1; //Small_Pocket
+ set ep14_1_bs,10;
+ changequest 11187,11188;
+ close;
+ } else {
+ mes "[Kusmi]";
+ mes "Hmm I don't know who, but must be a slobb to be dropping his pouch like soo.";
+ mes "Huh? Mine??";
+ mes "No, mine is right here safelyy?";
+ next;
+ mes "[Kusmi]";
+ mes "It's a precious object so I hope you'll find the owner itt.";
+ close;
+ }
+ }
+ if (ep14_1_bs2 == 10) {
+ if (ep14_1_bs == 10) {
+ mes "[Kusmi]";
+ mes "You can't say this to anybody okayy~?";
+ mes "Recently,";
+ mes "the supplies from our the mainland have been cutt!";
+ mes "Or rather, the supply route is being blocked and we can't get our suppliess?";
+ next;
+ mes "[Kusmi]";
+ mes "We need to find enough food before we run out of stored goods, that's why we've been rummaging the bushess.";
+ next;
+ mes "[Kusmi]";
+ mes "But this cursed frozen land has no good foods.";
+ mes "We're barely keeping it green using magic, but it takes too much power to make fruit.";
+ next;
+ mes "[Kusmi]";
+ mes "The energy spent in making food is probably twice as much as the energy gained from eatingg.";
+ mes "Those higher up don't want to admit it, but it's going to become a serious problem soonn.";
+ next;
+ mes "[Kusmi]";
+ mes "We can't leave the battleground because we're in war, so we can't go checkk.";
+ mes "I am curiousss.......";
+ next;
+ mes "[Kusmi]";
+ mes "Not just me, but many Laphines are worriedd.";
+ mes "Well that's the situation, so if you meet a Laphine in the bushes please don't talk to himm.";
+ mes "It's embarrassingg!!!";
+ next;
+ mes "[Kusmi]";
+ mes "Oh, and you must never ever tell anyone about what happened todayy!";
+ mes "Unless that person wanted to help uss... spreading the word won't do Splendide any goood.";
+ set ep14_1_bs,11;
+ completequest 11188;
+ setquest 11189;
+ close;
+ } else if (ep14_1_bs == 11) {
+ mes "[Kusmi]";
+ mes "Eh?";
+ mes "You stilll want to talk?";
+ next;
+ select("Supply route from the mainland?");
+ mes "[Kusmi]";
+ mes "Well if you hear that you'll have to helpp!";
+ mes "Still want to knoww?!";
+ next;
+ switch(select("Yes.:No.")) {
+ case 1:
+ mes "[Kusmi]";
+ mes "It's not a special road or anythingg.";
+ mes "Just an old roadd.";
+ mes "Some say it connects different continents. It also connects the Splendide Basecamp and Alfheim through the backk.";
+ next;
+ mes "[Kusmi]";
+ mes "If you're headed that way, please go see that all's okayy.";
+ set ep14_1_bs,12;
+ changequest 11189,11190;
+ close;
+ case 2:
+ mes "[Kusmi]";
+ mes "Thank you for finding my pouchh.";
+ mes "I would give you some fairy dust, but there is none leftt.";
+ close;
+ }
+ } else if (ep14_1_bs == 12) {
+ mes "[Kusmi]";
+ mes "It's not a special road or anythingg.";
+ mes "Just an old roadd.";
+ mes "Some say it connects different continents. It also connects the Splendide Basecamp and Alfheim through the backk.";
+ next;
+ mes "[Kusmi]";
+ mes "If you're headed that way, please go see that all's okayy.";
+ close;
+ } else if (ep14_1_bs == 13) {
+ mes "[Kusmi]";
+ mes "A crevicee?";
+ mes "That's why we couldn't contact the mainland.";
+ mes "Urggg.......";
+ mes "It would be good to know what's going on up theree.";
+ next;
+ mes "[Kusmi]";
+ mes "If you happen to go through Bifrost, please figure out what's going onn.";
+ mes "In the middle of Bifrost is a small village called 'Mora.' All the supplies from the mainland come through that villagee.";
+ next;
+ mes "[Kusmi]";
+ mes "If you go to the warehouse in Mora Village, the manager will tell you moree.";
+ mes "Also, on the way back, will you check to see that my friend Rondo is in Mora Villagee?";
+ next;
+ mes "[Kusmi]";
+ mes "He always used to visit Splendide around this time, but the situation is no good now. I'll have to tell him to come another time.";
+ set ep14_1_bs,14;
+ changequest 11191,11192;
+ close;
+ } else if (ep14_1_bs == 14) {
+ mes "[Kusmi]";
+ mes "If you happen to go through Bifrost, please figure out what's going onn.";
+ mes "In the middle of Bifrost is a small village called 'Mora.' All the supplies from the mainland come through that villagee.";
+ next;
+ mes "[Kusmi]";
+ mes "If you go to the warehouse in Mora Village, the manager will tell you moree.";
+ if (checkquest(11193) > -1 && checkquest(11193) < 2)
+ close;
+ mes "Also, on the way back, will you check to see that my friend Rondo is in Mora Villagee?";
+ next;
+ mes "[Kusmi]";
+ mes "He always used to visit Splendide around this time, but the situation is no good now. I'll have to tell him to come another time.";
+ close;
+ } else if (ep14_1_bs > 14) {
+ if (checkquest(11193) == -1) {
+ mes "[Kusmi]";
+ mes "Will you check to see that my friend Rondo is in Mora Villagee?";
+ next;
+ mes "[Kusmi]";
+ mes "He always used to visit Splendide around this time, but the situation is no good now. I'll have to tell him to come another time.";
+ close;
+ }
+ mes "[Kusmi]";
+ mes "Heee!";
+ mes "You really went through the fog of the Maze of the Hazy Forest?";
+ mes "Wow!!!";
+ mes "That's very impressivee.";
+ next;
+ mes "[Kusmi]";
+ mes "Thank you soooo much.";
+ mes "I hope we'll be able to go through Bifrost againn.";
+ mes "I want to meet Rondo and talk to him againn.";
+ if (ep14_1_bs == 17) {
+ next;
+ mes "[Kusmi]";
+ mes "Oh, And Daphrer is in northwest Splendide.";
+ }
+ if (checkquest(11193) < 2) {
+ completequest 11192;
+ completequest 11193;
+ }
+ close;
+ }
+ }
+ mes "[Kusmi]";
+ mes "This place is always coldd.";
+ mes "So different from my heavenly hometownn.";
+ close;
+}
+
+splendide,304,295,4 script Theodore#ep14_1_bs 445,{
+ if (!isequipped(2782)) {
+ mes "[Theodore]";
+ mes "DimFusTal Mu Lars";
+ mes "ModAnduLo";
+ mes "Mod";
+ mes "DorDuMe U NohLarsFulo Mu Fus";
+ next;
+ mes "- You can't understand the fairy's words. -";
+ mes "- You need something to help you interpret them. -";
+ close;
+ }
+ if (ep14_1_bs > 3 && ep14_1_bs < 10) {
+ mes "[Theodore]";
+ mes "Who are you!";
+ next;
+ select("Show the pouch.");
+ if (countitem(6390) == 0) {
+ mes "[Theodore]";
+ mes "Hmm? What do you mean?";
+ close;
+ }
+ if (ep14_1_bs2 == 11) {
+ mes "[Theodore]";
+ mes "Ahh!!";
+ mes "My pouch!!!!!";
+ mes "I've been looking for it all over the place.";
+ mes "Thanks!";
+ next;
+ select("Ask about the rumor.");
+ mes "[Theodore]";
+ mes "Hrm!!";
+ mes "What a penetrating question!";
+ next;
+ mes "[Theodore]";
+ mes "If you really want to hear the answer, talk to me again.";
+ mes "I need time to think.";
+ delitem 6390,1; //Small_Pocket
+ set ep14_1_bs,10;
+ changequest 11187,11194;
+ close;
+ } else {
+ mes "[Theodore]";
+ mes "What is that dirty pouch!";
+ mes "It is definitely not mine.";
+ next;
+ mes "[Theodore]";
+ mes "But I hope you find its rightful owner.";
+ close;
+ }
+ }
+ if (ep14_1_bs2 == 11) {
+ if (ep14_1_bs == 10) {
+ mes "[Theodore]";
+ mes "You are not to tell anyone what I'm about to tell you.";
+ next;
+ mes "[Theodore]";
+ mes "Recently, there's a big problem in Splendide.";
+ mes "There is no communication with the mainland.";
+ mes "Not just communication, but supplies have been cut off also. People act indifferent but actually there is deep panic.";
+ next;
+ mes "[Theodore]";
+ mes "This frozen land is no use for collecting food, but to farm it would be too much work.";
+ next;
+ mes "[Theodore]";
+ mes "In fact, just maintaining the green is costing an incredible amount of magic power.";
+ mes "No word has come from higher up, but from the rumors it's not an easily fixable problem.";
+ next;
+ mes "[Theodore]";
+ mes "And because there is no easy fix, everybody is worried sick.";
+ mes "By military law, our soldiers cannot leave the battlefield during war, so it's impossible to get more information.";
+ next;
+ mes "[Theodore]";
+ mes "Therefore, if you happen to run into a Laphine, please don't mention any of this.";
+ mes "Everybody is trying as hard as they can, but we are still a proud race.";
+ next;
+ mes "[Theodore]";
+ mes "And as I said before, what I told you is a secret and you must not tell anyone.";
+ mes "We do need help, but we are cornered and we don't want others to know.";
+ set ep14_1_bs,11;
+ completequest 11194;
+ setquest 11195;
+ close;
+ } else if (ep14_1_bs == 11) {
+ mes "[Theodore]";
+ mes "You have further business with me?";
+ next;
+ select("Supply route from the mainland?");
+ mes "[Theodore]";
+ mes "Hmm... if you hear that, you might just have to help us out?";
+ mes "Do you still want to know?";
+ next;
+ switch(select("Yes.:No.")) {
+ case 1:
+ mes "[Theodore]";
+ mes "The supply route comes through Bifrost, and you can get to it from the back of the Splendide Basecamp.";
+ mes "That is why we set up the basecamp here.";
+ mes "The origin of the route is unclear, but it has been known for a long time to be a bridge that connects continents.";
+ next;
+ mes "[Theodore]";
+ mes "If you happen to venture there, please ask a guard what things are like there.";
+ set ep14_1_bs,12;
+ changequest 11195,11196;
+ close;
+ case 2:
+ mes "[Theodore]";
+ mes "Thank you for getting the pouch back to me.";
+ mes "Fairy dust? I don't carry around such a thing.";
+ close;
+ }
+ } else if (ep14_1_bs == 12) {
+ mes "[Theodore]";
+ mes "The supply route comes through Bifrost, and you can get to it from the back of the Splendide Basecamp.";
+ mes "That is why we set up the basecamp here.";
+ mes "The origin of the route is unclear, but it has been known for a long time to be a bridge that connects continents.";
+ next;
+ mes "[Theodore]";
+ mes "If you happen to venture there, please ask a guard what things are like there.";
+ close;
+ } else if (ep14_1_bs == 13) {
+ mes "[Theodore]";
+ mes "A crevice?";
+ mes "So that was why we couldn't reach the mainland.";
+ mes "It would be good to know what's going on up there.";
+ next;
+ mes "[Theodore]";
+ mes "Hmm...";
+ mes "I can't leave here, but you would be able to, no?";
+ mes "The supplies from the mainland come through 'Mora' Village, which is located in the middle of Bifrost.";
+ next;
+ mes "[Theodore]";
+ mes "If you speak to the Warehouse Manager of Mora Village, you'd be able to get more information.";
+ mes "If you're willing, will you go to Bifrost's 'Mora' Village and meet the Warehouse Manager?";
+ next;
+ mes "[Theodore]";
+ mes "And if it's not too much trouble, you could drop by my friend Lilitia's also...";
+ set ep14_1_bs,14;
+ changequest 11197,11198;
+ close;
+ } else if (ep14_1_bs == 14) {
+ mes "[Theodore]";
+ mes "If you speak to the Warehouse Manager of Mora Village, you'd be able to get more information.";
+ mes "If you're willing, will you go to Bifrost's 'Mora' Village and meet the Warehouse Manager?";
+ if (checkquest(11199) > -1 && checkquest(11199) < 2)
+ close;
+ next;
+ mes "[Theodore]";
+ mes "And if it's not too much trouble, you could drop by my friend Lilitia's also...";
+ close;
+ } else if (ep14_1_bs > 14) {
+ if (checkquest(11199) == -1) {
+ mes "[Theodore]";
+ mes "And if it's not too much trouble, you could drop by my friend Lilitia's also...";
+ close;
+ }
+ mes "[Theodore]";
+ mes "Wow!!!";
+ mes "So you went through the Maze of the Hazy Forest and returned from Mora Village.";
+ mes "I made the right decision by asking you!";
+ next;
+ mes "[Theodore]";
+ mes "Thank you.";
+ mes "I hope this gets resolved soon...";
+ mes "I don't want to further upset Lilitia...";
+ if (ep14_1_bs == 17) {
+ next;
+ mes "[Theodore]";
+ mes "Oh, And Daphrer is in northwest Splendide.";
+ }
+ if (checkquest(11199) < 2) {
+ completequest 11198;
+ completequest 11199;
+ }
+ close;
+ }
+ }
+ mes "[Theodore]";
+ mes "Sometimes, I sense a painful beauty in this frozen earth, quite different from the beauty of my hometown.";
+ mes "But this is a difficult environment for us to live in, certainly.";
+ close;
+}
+
+splendide,168,301,4 script Pauchon#ep14_1_bs 439,{
+ if (!isequipped(2782)) {
+ mes "[Pauchon]";
+ mes "DimFusTal Mu Lars";
+ mes "ModAnduLo";
+ mes "Mod";
+ mes "DorDuMe U NohLarsFulo Mu Fus";
+ next;
+ mes "- You can't understand the fairy's words. -";
+ mes "- You need something to help you interpret them. -";
+ close;
+ }
+ if (ep14_1_bs > 3 && ep14_1_bs < 10) {
+ mes "[Pauchon]";
+ mes "What can I do for you, sir?";
+ next;
+ select("Show the pouch.");
+ if (countitem(6390) == 0) {
+ mes "[Pauchon]";
+ mes "Huh? Do you see something?";
+ mes "I don't see anything...";
+ close;
+ }
+ if (ep14_1_bs2 == 12) {
+ mes "[Pauchon]";
+ mes "Good heavens...!";
+ mes "I think this is mine!";
+ mes "Thank you.";
+ mes "I've been worried since I lost it, you lifted a burden off of my mind.";
+ next;
+ select("Ask about the rumor.");
+ mes "[Pauchon]";
+ mes "That's not easy for me to answer...";
+ mes "I do appreciate you finding my pouch.... Hmm...";
+ mes "Please give me some time to think..";
+ delitem 6390,1; //Small_Pocket
+ set ep14_1_bs,10;
+ changequest 11187,11200;
+ close;
+ } else {
+ mes "[Pauchon]";
+ mes "Oh dear. It's not mine.";
+ mes "But to carelessly drop such an important object!";
+ mes "I don't know who it is, but that Laphine needs a lesson!";
+ close;
+ }
+ }
+ if (ep14_1_bs2 == 12) {
+ if (ep14_1_bs == 10) {
+ mes "[Pauchon]";
+ mes "What I'm about to tell you is top secret!";
+ mes "We don't even talk about it amongst ourselves!";
+ mes "How would we say that the supply from the mainland's been cut off like that!";
+ next;
+ mes "[Pauchon]";
+ mes "Ugh?!";
+ mes "Oh boy... I've done it....";
+ mes "It's really a top secret!!";
+ mes "Don't tell anybody!";
+ next;
+ mes "[Pauchon]";
+ mes "Well since I spilled the beans already... oh well, too late.";
+ mes "So it's been a while since we received supplies from the mainland.";
+ next;
+ mes "[Pauchon]";
+ mes "We're not starving, but we're receiving less and less food.";
+ mes "I was hungry so I went to go pick fruit, but in this cold climate there are no fruit trees.";
+ next;
+ mes "[Pauchon]";
+ mes "And the people higher up only tell us to wait... I'm so tired of waiting!";
+ mes "But the instant I leave this place, I'll end up going to prison....";
+ next;
+ mes "[Pauchon]";
+ mes "So I'm stuck here, and I'll be stuck here, suffering from hunger.... *sob*";
+ next;
+ mes "[Pauchon]";
+ mes "I'd eat the bark off of that tree if I could.";
+ mes "If only somebody could help. *sob*";
+ set ep14_1_bs,11;
+ completequest 11200;
+ setquest 11201;
+ close;
+ } else if (ep14_1_bs == 11) {
+ mes "[Pauchon]";
+ mes "What?";
+ mes "What do you want... I'm hungry, don't have energy to talk...";
+ next;
+ select("Supply route from the mainland?");
+ mes "[Pauchon]";
+ mes "Are you going to help me if I tell you?";
+ mes "If not, I won't tell.";
+ next;
+ switch(select("Yes.:No.")) {
+ case 1:
+ mes "[Pauchon]";
+ mes "A giant road leads away from the back of Splendide.";
+ mes "I don't know if it's related to legends and what not, but I've heard that the road's been there forever.";
+ next;
+ mes "[Pauchon]";
+ mes "Oh! The guard there might know something.";
+ mes "If you're headed that way, please go find out what's up.";
+ set ep14_1_bs,12;
+ changequest 11201,11202;
+ close;
+ case 2:
+ mes "[Pauchon]";
+ mes "Thank you for finding the pouch.";
+ mes "Ugh... I'm starving... I suppose I'll have to eat these bitter berries...";
+ close;
+ }
+ } else if (ep14_1_bs == 12) {
+ mes "[Pauchon]";
+ mes "A giant road leads away from the back of Splendide.";
+ mes "I don't know if it's related to legends and what not, but I've heard that the road's been there forever.";
+ next;
+ mes "[Pauchon]";
+ mes "Oh! The guard there might know something.";
+ mes "If you're headed that way, please go find out what's up.";
+ close;
+ } else if (ep14_1_bs == 13) {
+ mes "[Pauchon]";
+ mes "Crevice?!?";
+ mes "Hmm I have heard that crevices are creeping up here and there, but it even infiltrated Bifrost....";
+ mes "It appears to be more serious than I had imagined.";
+ next;
+ mes "[Pauchon]";
+ mes "If you can, would you go to 'Mora' Village in Bifrost and figure out what's going on?";
+ next;
+ mes "[Pauchon]";
+ mes "The supplies from the mainland come through the Village. If you go speak to the Warehouse Manager, he'll be able to tell you something.";
+ mes "Also, please pay a visit to my friend Humming.";
+ next;
+ mes "[Pauchon]";
+ mes "He's such a flighty guy, might have already left, but we were supposed to meet up in Mora Village.";
+ set ep14_1_bs,14;
+ changequest 11203,11204;
+ close;
+ } else if (ep14_1_bs == 14) {
+ mes "[Pauchon]";
+ mes "If you can, would you go to 'Mora' Village in Bifrost and figure out what's going on?";
+ next;
+ mes "[Pauchon]";
+ mes "The supplies from the mainland come through the Village. If you go speak to the Warehouse Manager, he'll be able to tell you something.";
+ if (checkquest(11205) > -1 && checkquest(11205) < 2)
+ close;
+ mes "Also, please pay a visit to my friend Humming.";
+ next;
+ mes "[Pauchon]";
+ mes "He's such a flighty guy, might have already left, but we were supposed to meet up in Mora Village.";
+ close;
+ } else if (ep14_1_bs > 14) {
+ if (checkquest(11205) == -1) {
+ mes "[Pauchon]";
+ mes "Please pay a visit to my friend Humming.";
+ mes "He's such a flighty guy, might have already left, but we were supposed to meet up in Mora Village.";
+ close;
+ }
+ mes "[Pauchon]";
+ mes "I had my doubts...But you really did cross the legendary Maze of the Hazy Forest...";
+ mes "I'm very impressed.";
+ next;
+ mes "[Pauchon]";
+ mes "I really appreciate your help.";
+ mes "I hope this gets resolved soon.";
+ mes "What I'm really afraid of... is hunger. More than war.";
+ if (ep14_1_bs == 17) {
+ next;
+ mes "[Pauchon]";
+ mes "Oh, And Daphrer is in northwest Splendide.";
+ }
+ if (checkquest(11205) < 2) {
+ completequest 11204;
+ completequest 11205;
+ }
+ close;
+ }
+ }
+ mes "[Pauchon]";
+ mes "Ah... I'm hungry.";
+ mes "When I get back to the mainland I'm going to stuff my belly until it bursts.";
+ close;
+}
+
+splendide,262,376,4 script Laphine Soldier#ep14_1 447,{
+ if (!isequipped(2782)) {
+ mes "[Laphine Soldier]";
+ mes "DielFarmar Di RiniIyazser Ha mahAgolAsh U U ";
+ mes "TurNohnar Di DurNeiFar Ra AnuVerNoth Ha AshRivehDor Ha BurWehLars Ur RinimanMod";
+ next;
+ mes "- You can't understand the fairy's words. -";
+ mes "- You need something to help you interpret them. -";
+ close;
+ }
+ mes "[Laphine Soldier]";
+ mes "This is Bifrost, which leads to Alfheim.";
+ mes "Please note that entry is forbidden due to a crevice caused by an unidentified source.";
+ if (ep14_1_bs != 12)
+ close;
+ next;
+ mes "[Laphine Soldier]";
+ mes "The other way leads to the Maze of the Hazy Forest.";
+ next;
+ mes "[Laphine Soldier]";
+ mes "You can get to Alfheim by making it through the Maze of the Hazy Forest. However, nobody has ever come back from the Maze of the Hazy Forest.";
+ if (checkquest(11190) > -1 && checkquest(11190) < 2) {
+ set ep14_1_bs,13;
+ changequest 11190,11191;
+ } else if (checkquest(11196) > -1 && checkquest(11196) < 2) {
+ set ep14_1_bs,13;
+ changequest 11196,11197;
+ } else if (checkquest(11202) > -1 && checkquest(11202) < 2) {
+ set ep14_1_bs,13;
+ changequest 11202,11203;
+ }
+ close;
+}
+
+mora,185,163,2 script Warehouse Manager#ep14_1 516,{
+ if (ep14_1_bs < 15) {
+ mes "[Warehouse Manager]";
+ mes "No, sir!";
+ mes "You cannot enter at will.";
+ mes "This is a warehouse. If you need something, please ask the staff outside.";
+ if (ep14_1_bs < 14)
+ close;
+ next;
+ select("Supplies for Laphine?");
+ mes "[Warehouse Manager]";
+ mes "Ah!";
+ mes "You're from Splendide?";
+ mes "Let's see...";
+ mes "All the supplies from over there to there are destined for Splendide.";
+ next;
+ mes "[Warehouse Manager]";
+ mes "We are quite worried too because the crevice in Bifrost has made it impossible to deliver these goods.";
+ next;
+ mes "[Warehouse Manager]";
+ mes "And the travelers who were heading down are also stuck here. The increasing number of customers is both a blessing and a curse..";
+ next;
+ mes "[Warehouse Manager]";
+ mes "If you plan to go back to Splendide, pay a visit to Jones at the Inn.";
+ mes "He has something that needs to be urgently delivered to the army of Splendide.";
+ set ep14_1_bs,15;
+ setquest 11206;
+ close;
+ } else if (ep14_1_bs == 15) {
+ mes "[Warehouse Manager]";
+ mes "If you plan to go back to Splendide, pay a visit to Jones at the Inn.";
+ mes "He has something that needs to be urgently delivered to the army of Splendide.";
+ close;
+ } else {
+ mes "[Warehouse Manager]";
+ mes "We are quite worried too because the crevice in Bifrost has made it impossible to deliver these goods.";
+ next;
+ mes "[Warehouse Manager]";
+ mes "And the travelers who were heading down are also stuck here. The increasing number of customers is both a blessing and a curse...";
+ close;
+ }
+ end;
+}
+
+mora,35,119,4 script Rondo#ep14_1_bs 513,{
+ mes "[Rondo]";
+ mes "Mora is such a mysterious place.";
+ mes "You can understand any language.";
+ next;
+ mes "[Rondo]";
+ mes "Of course, when we leave this area I won't be able to understand what you say, but I'll be able to remember the conversations we had. And I'll look forward to the day we meet again, here.";
+ if (ep14_1_bs > 13 && ep14_1_bs2 == 10) {
+ next;
+ mes "[Rondo]";
+ mes "Please tell Kusmi";
+ mes "that if he wants to meet, we can meet any time. There is nothing to worry about.";
+ if (checkquest(11193) == -1)
+ setquest 11193;
+ }
+ close;
+}
+
+mora,98,66,4 script Lilitia#ep14_1_bs 518,{
+ if (ep14_1_bs > 13 && ep14_1_bs2 == 11) {
+ mes "[Lilitia]";
+ mes "Boo!!!";
+ mes "He broke his promise again!!!";
+ next;
+ mes "[Lilitia]";
+ mes "He said he'd be here this time for sure!!!";
+ mes "That place is too cold for me to visit!!!!!";
+ mes "My precious leaves will wither there.";
+ next;
+ mes "[Lilitia]";
+ mes "What? Theodore sent you?";
+ mes "Please tell him that I'm so mad!!";
+ if (checkquest(11199) == -1)
+ setquest 11199;
+ close;
+ }
+ mes "[Lilitia]";
+ mes "I really hate the cold.";
+ mes "That's why Mora is a lovely place to live.";
+ next;
+ mes "[Lilitia]";
+ mes "The leaves are always fresh here. And, the stress about languages just disappears.";
+ close;
+}
+
+mora,139,102,2 script Humming#ep14_1_bs 515,{
+ if (ep14_1_bs > 13 && ep14_1_bs2 == 12) {
+ mes "[Humming]";
+ mes "Oh!";
+ mes "You're here because Pauchon sent you?";
+ next;
+ mes "[Humming]";
+ mes "It must've been hard for you to get here. I'm impressed.";
+ mes "The Maze of the Hazy Forest~ It fuels my adventurous spirit!";
+ next;
+ mes "[Humming]";
+ mes "If you reach Splendide before me, please tell Pauchon";
+ mes "that I'm going through the Maze of the Hazy Forest.";
+ if (checkquest(11205) == -1)
+ setquest 11205;
+ close;
+ }
+ mes "[Humming]";
+ mes "I heard that a crevice crept in between Jotunheim and Midgard, so I wanted to check it out. But I got stuck here.";
+ mes "I was looking forward to seeing a new place.";
+ next;
+ mes "[Humming]";
+ mes "Are you from Midgard?";
+ mes "What is it like there?";
+ mes "I've always wanted to see a creature called Poring.";
+ close;
+}
+
+mora,55,124,2 script Jones#ep14_1_bs 495,{
+ if (ep14_1_bs < 15) {
+ mes "[Jones]";
+ mes "Oh.... Darn.......";
+ mes "I can't go down, and I can't go back. My credibility that I've worked so hard on is just crumbling into dust.";
+ close;
+ } else if (ep14_1_bs == 15) {
+ mes "[Jones]";
+ mes "Ah, are you the traveler who came through the Maze of the Hazy Forest from Splendide?";
+ mes "If you plan to go back, can you please deliver this to the Splendide army?";
+ next;
+ mes "[Jones]";
+ mes "A person high up requested it, but I can't cross Bifrost.";
+ next;
+ mes "[Jones]";
+ mes "Deliveries to other places have all stopped also. Ah, my credibility is suffering....";
+ next;
+ switch(select("Yes.:No.")) {
+ case 1:
+ mes "[Jones]";
+ mes "Thank you.";
+ set ep14_1_bs,16;
+ changequest 11206,11207;
+ close;
+ case 2:
+ mes "[Jones]";
+ mes "I'm a bit embarrassed to ask this of a stranger...... Ha ha!";
+ close;
+ }
+ } else if (ep14_1_bs == 16) {
+ if (checkweight(1201,1) == 0) {
+ mes "[Jones]";
+ mes "You have too many kinds of items. Please lighten your load and come back.";
+ close;
+ }
+ if (MaxWeight - Weight < 3500) {
+ mes "[Jones]";
+ mes "You are carrying too much weight. Please lighten your load and come back.";
+ close;
+ }
+ mes "[Jones]";
+ mes "Please take good care of it.";
+ mes "It's for Daphrer in Splendide.";
+ set ep14_1_bs,17;
+ getitem 6391,1; //Splendid_Supply_Kit
+ changequest 11207,11208;
+ close;
+ } else if (ep14_1_bs == 17) {
+ mes "[Jones]";
+ mes "Please take good care of it.";
+ mes "It's for Daphrer in Splendide.";
+ close;
+ } else if (ep14_1_bs > 17) {
+ mes "[Jones]";
+ mes "Thanks to you, the job is well done.";
+ mes "Hehe, I see potential in you as a delivery man.";
+ mes "Interested in the career of delivery?";
+ close;
+ } else {
+ mes "[Jones]";
+ mes "Hehe, I see potential in you as a delivery man.";
+ mes "Interested in the career of delivery?";
+ close;
+ }
+ end;
+}
+
+splendide,121,260,4 script Daphrer#ep14_1_bs 435,{
+ if (!isequipped(2782)) {
+ mes "[Daphrer]";
+ mes "DRHSfhsdfGSDH FGkkmvoifk DFG DFHshfeksmn fgg FDbbd fjnnvk n skncki dfgd F FHdfkdfjkmv";
+ close;
+ }
+ if (countitem(6391)) {
+ mes "[Daphrer]";
+ mes "Oh....";
+ mes "I've been waiting for you.";
+ next;
+ mes "[Daphrer]";
+ mes "This was urgently needed so thank you for bringing it here, I hope I haven't caused you too much trouble..";
+ next;
+ mes "[Daphrer]";
+ mes "This is probably too small to be a reward, but please accept this as a sign of my gratitude.";
+ delitem 6391,1; //Splendid_Supply_Kit
+ if (ep14_1_bs == 17) {
+ set ep14_1_bs,18;
+ completequest 11208;
+ getexp 0,500000;
+ getitem 6380,5; //Mora_Coin
+ } else
+ getitem 6380,2; //Mora_Coin
+ close;
+ }
+ if (ep14_1_bs == 17) {
+ mes "[Daphrer]";
+ mes "Oh....";
+ mes "So you lost the item on the way.";
+ next;
+ mes "[Daphrer]";
+ mes "I knew that it was probably a stretch......";
+ mes "Perhaps I've been unrealistic.";
+ mes "But I thank you for your trouble anyway. Please accept this as a sign of my gratitude.";
+ set ep14_1_bs,18;
+ completequest 11208;
+ getexp 0,200000;
+ getitem 6380,2; //Mora_Coin
+ close;
+ }
+ mes "[Daphrer]";
+ mes "For me, a drop of water to make a flower blossom is more important than a sword for war.";
+ close;
+}
+
+// Chesire's New Day :: cheshir2
+//============================================================
+dic_in01,262,191,0 script #ep14_1_xq02 139,0,3,{
+ end;
+OnTouch:
+ if (ep13_3_secret > 22 && checkquest(7206) == -1) {
+ enablenpc "Cheshire#ep14_1_xq01";
+ cutin "ep13_cheshire_h",1;
+ mes "[Cheshire]";
+ mes "Oh, wait!";
+ mes "There's another thing I'd like you to do.";
+ mes "There's not enough time to go into details...";
+ next;
+ mes "- Cheshire glanced at the guard standing close to you, and leaned close and whispered into your ear.-";
+ next;
+ mes "[Cheshire]";
+ mes "You'll find cat caravans in the middle of ^4d4dffKamidal Tunnel^000000.";
+ mes "There is ^4d4dffa marked box among the caravans' goods to the west of the entrance to the Scaraba Hole^000000.";
+ next;
+ mes "[Cheshire]";
+ mes "I'd like you to bring it to me.";
+ mes "You'll see where you should bring it by looking at the box.";
+ mes "This is an important matter.";
+ next;
+ mes "[Cheshire]";
+ mes "I have something to get done in advance...";
+ mes "Good luck!";
+ setquest 7206;
+ close2;
+ disablenpc "Cheshire#ep14_1_xq01";
+ cutin "",255;
+ }
+ end;
+}
+
+dic_in01,260,194,4 script Cheshire#ep14_1_xq01 498,{
+ end;
+OnInit:
+ disablenpc "Cheshire#ep14_1_xq01";
+ end;
+}
+
+dic_dun01,274,114,0 script Stacked Boxes of Goods 844,{
+ if (checkweight(1201,1) == 0 || MaxWeight - Weight < 1000) {
+ mes "- You have too many items to do this quest. -";
+ close;
+ }
+ set .@playtime, checkquest(7208,PLAYTIME);
+ if (.@playtime == 0 || .@playtime == 1) {
+ mes "Boxes with all kinds of goods in them are stacked to the ceiling.";
+ mes "The marked box Cheshire was talking about doesn't seem to be here yet.";
+ close;
+ } else if (.@playtime == 2) {
+ mes "Boxes with all kinds of goods in them are stacked to the ceiling.";
+ mes "Looking closely, you find a box with a small piece of paper stuck to it.";
+ mes "You've found the box of goods Cheshire was talking about.";
+ next;
+ switch(select("Move the box.:Give up.")) {
+ case 1:
+ mes "You promised to take the box of Bradium to Cheshire, who will be waiting for you near the Crevice of Bifrost.";
+ erasequest 7208;
+ setquest 7210;
+ getitem 6392,1; //Bradium_Box
+ close;
+ case 2:
+ mes "You decided to give up delivering the box.";
+ mes "You left the box as it is.";
+ erasequest 7208;
+ close;
+ }
+ } else {
+ if (checkquest(7207) == -1) {
+ if (checkquest(7206) > -1) {
+ mes "Boxes with all kinds of goods in them are stacked to the ceiling.";
+ mes "Looking closely, you find a box with a small piece of paper stuck to it.";
+ next;
+ mes "The piece of paper is marked with some mysterious symbol, and below it is written ^4d4dffTo: The Crevice of Bifrost^000000 in small letters.";
+ next;
+ mes "This must the box Cheshire was talking about.";
+ mes "You decide to take it to the location shown on the piece of paper.";
+ completequest 7206;
+ setquest 7207;
+ getitem 6392,1; //Bradium_Box
+ close;
+ }
+ } else if (checkquest(7207) < 2) {
+ mes "You've already obtained the box Cheshire was talking about.";
+ mes "Now you only have to take it to the Crevice of Bifrost.";
+ close;
+ }
+ mes "Boxes with all kinds of goods in them are stacked to the ceiling.";
+ close;
+ }
+ end;
+}
+
+bif_fild01,335,168,3 script Cheshire#ep14_1_xq04 497,{
+ if (checkweight(1201,1) == 0 || MaxWeight - Weight < 1000) {
+ mes "- You have too many items to do this quest. -";
+ close;
+ }
+ cutin "ep13_cheshire",1;
+ if (checkquest(7209) > -1) {
+ if (countitem(6090) < 20) {
+ mes "[Cheshire]";
+ mes "Bring me 20 pieces of refined Bradium.";
+ mes "In exchange for the box, which you carelessly and irresponsibly sold to somebody.";
+ mes "Have I made myself clear?!";
+ close2;
+ cutin "",255;
+ end;
+ }
+ mes "[Cheshire]";
+ mes "So you've brought it?";
+ mes "The amount is less than it was, but I guess I can't help it.";
+ mes "Next time, you must bring the box to me intact.";
+ next;
+ mes "- Cheshire threw the Bradium into the Crevice. -";
+ next;
+ mes "[Cheshire]";
+ mes "You made a mistake of losing the box, you have to be content with this.";
+ mes "And starting tomorrow, get the box here intact.";
+ mes "Every day.";
+ delitem 6090,20; //Purified_Bradium
+ erasequest 7209;
+ setquest 7208;
+ getitem 6304,1; //Sapa_Feat_Cert
+ close2;
+ cutin "",255;
+ end;
+ }
+ callsub L_CheckPlaytime;
+ if (checkquest(7210) > -1) {
+ if (countitem(6392) == 0)
+ callsub L_LostQuest,7210;
+ else {
+ mes "[Cheshire]";
+ mes "You've come at just the right time.";
+ mes "And I see the box is intact!";
+ mes "Well done.";
+ next;
+ mes "[Cheshire]";
+ mes "Well, I'll be counting on you, tomorrow as well.";
+ mes "Get it?";
+ mes "Now, leave this place before the Laphines grow suspicious.";
+ erasequest 7210;
+ setquest 7208;
+ delitem 6392,1; //Bradium_Box
+ getitem 6304,1; //Sapa_Feat_Cert
+ getexp 50000,40000;
+ close2;
+ cutin "",255;
+ end;
+ }
+ }
+ if (ep13_3_secret > 22) {
+ if (checkquest(7207) == -1) {
+ if (checkquest(7206) == -1) {
+ mes "[Cheshire]";
+ mes "...Hmm? Huh?";
+ mes "It's "+strcharinfo(0)+"!";
+ mes "What are you doing here?";
+ next;
+ select("Huh? Cheshire?");
+ mes "[Cheshire]";
+ mes "What makes you so surprised?";
+ mes "Does it surprise you to see me here?";
+ next;
+ select("Nothing, it's just the hood...");
+ mes "[Cheshire]";
+ mes "Oh... This. Because it's bothersome.";
+ mes "And here, I don't have to mind others.";
+ mes "Oh, and well met!";
+ mes "I was going to put you to work when you came to Diel.";
+ next;
+ mes "[Cheshire]";
+ mes ".......What? Why are you staring at me like that?";
+ mes "his is all for Ahat's good.";
+ next;
+ switch(select("I guess I have no choice.:I have a lot of things to do!")) {
+ case 1:
+ mes "["+strcharinfo(0)+"]";
+ mes "(He will be suspicious if I refuse to do it... I guess I should play along for now.)";
+ mes "Okay.";
+ mes "I'll do anything for Ahat's pleasure.";
+ mes "So, what do you need me for?";
+ next;
+ break;
+ case 2:
+ mes "[Cheshire]";
+ mes "Things to do?";
+ mes "What things?";
+ mes "This is one of the things you must do.";
+ mes "Don't forget you're are loyal to Ahat.";
+ next;
+ break;
+ }
+ mes "[Cheshire]";
+ mes "Great! Now I will tell you what to do.";
+ mes "You know there is an entrance to Scaraba Hole in the middle of Kamidal Tunnel?";
+ mes "You will find cat caravans around there who sell supplies and some simple tools.";
+ next;
+ mes "[Cheshire]";
+ mes "There is a marked box among the goods stacked there.";
+ mes "I'd like you to bring the box to me.";
+ next;
+ mes "[Cheshire]";
+ mes "It's a simple job of picking up and delivering a box.";
+ mes "Do it ^4d4dff quickly and quietly, without being noticed^000000.";
+ setquest 7206;
+ next;
+ mes "[Cheshire]";
+ mes "Now, move!";
+ close2;
+ cutin "",255;
+ end;
+ } else {
+ mes "[Cheshire]";
+ mes "Bring the box from Kamidal Tunnel.";
+ mes "Quickly and quietly!";
+ mes "No, get a move on!";
+ close2;
+ cutin "",255;
+ end;
+ }
+ } else if (checkquest(7207) < 2) {
+ if (countitem(6392) == 0)
+ callsub L_LostQuest,7207;
+ else {
+ mes "[Cheshire]";
+ mes "........That box!";
+ mes "Oh, yes. It's the right one!";
+ mes "You've done a good job.";
+ mes "This is very important.";
+ mes "Ahat will be pleased.";
+ next;
+ mes "[Cheshire]";
+ mes "The boxes will be at the same place every day.";
+ mes "I'll leave the job to you.";
+ next;
+ select("Why don't you do it yourself?");
+ mes "[Cheshire]";
+ mes "........ Hmm...";
+ mes "It's only you humans that have free access to any place.";
+ mes "Plus, this place is Laphine territory.";
+ next;
+ mes "[Cheshire]";
+ mes "I don't attract their attention much, looking like this,";
+ mes "but what would Saphas think?";
+ mes "To see Ahat's man in a Laphine territory?";
+ next;
+ mes "[Cheshire]";
+ mes "They will grow suspicious.";
+ mes "But you humans are free from such troubles, so that's why you're the right one for the job.";
+ next;
+ mes "["+strcharinfo(0)+"]";
+ mes "(... I don't buy his story, but he believes I'm on his side, so I guess I should play along.)";
+ mes "What happens to this Bradium, then?";
+ next;
+ mes "[Cheshire]";
+ mes "That thing?";
+ mes "Hand it to me.";
+ next;
+ mes "- Cheshire opened the box, checked the Bradium in it, threw them into the Crevice,";
+ mes "and looked back, dusting his hands off, and with a triumphant look on his face. -";
+ next;
+ mes "[Cheshire]";
+ mes "This is what happens.";
+ mes "*laugh* Beyond the Crevice lies a path unknown to you.";
+ next;
+ mes "[Cheshire]";
+ mes "Well, I'll leave the matter to you.";
+ mes "Try to bring the box to me every day.";
+ mes "Okay?";
+ delitem 6392,1; //Bradium_Box
+ completequest 7207;
+ setquest 7208;
+ getitem 6304,1; //Sapa_Feat_Cert
+ getexp 50000,40000;
+ next;
+ mes "[Cheshire]";
+ mes "In compensation for your efforts, I'll give you an Exploit Certification of Sapha and a little cash.";
+ mes "Now, leave this place before the Laphines grow suspicious.";
+ close2;
+ cutin "",255;
+ end;
+ }
+ } else {
+ callsub L_CheckPlaytime;
+ mes "[Cheshire]";
+ mes "Huh? What's up?";
+ mes "You haven't brought the box today?";
+ next;
+ mes "[Cheshire]";
+ mes "Hmm, this is unexpected...";
+ mes "Well, I have no choice then.";
+ mes "I'll have another guy do it today.";
+ mes "But you must do it starting tomorrow, okay?";
+ setquest 7208;
+ close2;
+ cutin "",255;
+ end;
+ }
+ } else if (ep13_3_secret > 15) {
+ mes "[Cheshire]";
+ mes "... Huh? I think I've seen you somewhere...";
+ mes "..........Oh!";
+ mes strcharinfo(0)+"...?!";
+ mes "What brings you here?";
+ next;
+ mes "[Cheshire]";
+ mes "You say you've forgotten what to do?";
+ mes "You're not supposed to be here.";
+ mes "You're supposed to be at the crevice to the south of Dicastes.";
+ next;
+ mes "[Cheshire]";
+ mes "Whoa.";
+ mes "What was Ahat thinking when he sent such an idiot to me?";
+ mes "Now, get a move on and do your job.";
+ close2;
+ cutin "",255;
+ end;
+ }
+ mes "[Cheshire]";
+ mes "...Why isn't this fellow showing up?";
+ mes "Should be here by now...";
+ mes "Lost the way back perhaps...?";
+ mes "....? Eh? Who, who are you? How long have you been standing here?";
+ next;
+ select("A cat?!");
+ mes "[Cheshire]";
+ mes "Who... who's a cat?!";
+ mes "Get lost!";
+ close2;
+ cutin "",255;
+ end;
+L_LostQuest:
+ mes "[Cheshire]";
+ mes "Oh, have you been there?";
+ mes "What happened to the box?";
+ mes "Why are you empty-handed?";
+ next;
+ switch(select("I'll look for it again!:I lost it...")) {
+ case 1:
+ mes "[Cheshire]";
+ mes "Make sure you do a good job!";
+ mes "And keep looking for it.";
+ mes "You must not lose it.";
+ break;
+ case 2:
+ mes "[Cheshire]";
+ mes "Where?";
+ mes "Which merchant did you sell it to?";
+ mes "Can't you distinguish between what to sell and what not to sell?";
+ mes "Were you asleep when you made the deal?";
+ next;
+ mes "[Cheshire]";
+ mes "This is utterly ridiculous.";
+ mes "Make up for what you lost!";
+ mes "^4d4dff20 pieces of refined Bradium^000000!!!";
+ erasequest getarg(0);
+ setquest 7209;
+ break;
+ }
+ close2;
+ cutin "",255;
+ end;
+L_CheckPlaytime:
+ set .@playtime, checkquest(7208,PLAYTIME);
+ if (.@playtime == 0 || .@playtime == 1) {
+ mes "[Cheshire]";
+ mes "Each day, one of these boxes is sent to Kamidal Tunnel.";
+ mes "It's smuggled in among other items.";
+ next;
+ mes "[Cheshire]";
+ mes "Sneak into the place on time, and bring the box to me. The boxes will be at the same place every day.";
+ mes "You'll be doing it every day.";
+ close2;
+ cutin "",255;
+ end;
+ } else if (.@playtime == 2) {
+ mes "[Cheshire]";
+ mes "It's about time.";
+ mes "Now go get the box.";
+ mes "It should be lying near the entrance to Scaraba Hole in the Kamidal Tunnel.";
+ mes "You've done this before, so you must be familiar with it?";
+ close2;
+ cutin "",255;
+ end;
+ } else
+ return;
+}
+
+dicastes02,125,192,0 script #call_cheshir_ep14 139,0,3,{
+ end;
+OnTouch:
+ if (ep13_3_secret > 22) {
+ if (rand(2)) {
+ emotion e_ho,1;
+ mes "..........?";
+ mes "You sense someone moving around.";
+ mes "There must be someone down there.";
+ if ($@cheshire_on == 0) {
+ donpcevent "Cheshire#ep14_extra::OnEnable";
+ set $@cheshire_on,1;
+ }
+ close;
+ }
+ }
+ end;
+}
+
+dicastes02,103,190,3 script Cheshire#ep14_extra 497,{
+ if (ep13_3_secret > 22) {
+ cutin "ep13_cheshire",1;
+ mes "[Cheshire]";
+ mes "...Eh?";
+ mes "What a surprise. What are you doing here?";
+ next;
+ switch(select("And what are YOU doing here?:Those ears...?")) {
+ case 1:
+ mes "[Cheshire]";
+ mes "Out for a walk?";
+ mes "I came out with Ahat, but he went back in to take care of an urgent matter.";
+ next;
+ mes "[Cheshire]";
+ mes ".. ..............";
+ next;
+ select("....:Wha... What a pretty tree.");
+ mes "[Cheshire]";
+ mes "This tree... it's white, transparent, and shiny.";
+ mes "It's a Sapha's body.";
+ next;
+ mes "[Cheshire]";
+ mes "You know Saphas slowly turn to stone throughout their lives.";
+ mes "So when they die, they turn to stony trees.";
+ mes "This forest is... their cemetery, so to speak.";
+ next;
+ mes "[Cheshire]";
+ mes "....... Look closely, and you can make out his arms and legs.";
+ mes "Interesting, isn't it?";
+ next;
+ mes "[Cheshire]";
+ mes "... .. ...";
+ next;
+ mes "[Cheshire]";
+ mes "Oh, this is so annoying.";
+ mes "I'm off!";
+ next;
+ mes "- Cheshire stormed off... -";
+ break;
+ case 2:
+ mes "[Cheshire]";
+ mes "What? The ears?";
+ mes "Well, it's no wonder because I'm a beastman.";
+ mes "... Why... Why are you staring me like that?";
+ next;
+ select("Are you responsible for the report?!");
+ mes "[Cheshire]";
+ mes "What are you talking about?";
+ mes "I don't know such a thing!";
+ next;
+ mes "- Cheshire ran away... -";
+ break;
+ }
+ disablenpc "Cheshire#ep14_extra";
+ stopnpctimer;
+ close2;
+ cutin "",255;
+ end;
+ }
+ mes "A boy dressed in unusual clothing is standing, with a fierce look in his eyes.";
+ mes "You guess you'd better leave him alone.";
+ close;
+OnInit:
+ disablenpc "Cheshire#ep14_extra";
+ end;
+OnEnable:
+ enablenpc "Cheshire#ep14_extra";
+ initnpctimer;
+ end;
+OnDisable:
+ disablenpc "Cheshire#ep14_extra";
+ stopnpctimer;
+ end;
+OnTimer600000:
+ disablenpc "Cheshire#ep14_extra";
+ set $@cheshire_on,0;
+ stopnpctimer;
+ end;
+}
+
+// Helping Lope and Euridi :: rofe
+//============================================================
+mora,117,66,3 script Euridi#pa 521,{
+ if (BaseLevel < 100) {
+ mes "[Euridi]";
+ mes "You are very delicate.";
+ mes "It's true that I need help,";
+ mes "but I don't think you can help.";
+ close;
+ }
+ if (ep14_1_rope == 0) {
+ mes "[Euridi]";
+ mes "I hear you passed through the Hazy Forest.";
+ mes "Did you...";
+ mes "Did you happen to see";
+ mes "Lope, my fiance, there?";
+ next;
+ switch(select("Yes, I did.:No, I didn't.")) {
+ case 1:
+ mes "[Euridi]";
+ mes "Are you sure? Where did you see him?";
+ mes "Take me there, quick!";
+ mes "...";
+ next;
+ mes "[Euridi]";
+ mes "What?";
+ mes "You're kidding...?";
+ mes "How could you?";
+ close;
+ case 2:
+ mes "[Euridi]";
+ mes "Please find my Lope.";
+ mes "I came here to the Village of Mora";
+ mes "after asking all around,";
+ mes "but there is nothing more I can do.";
+ next;
+ mes "[Euridi]";
+ mes "My heart aches at the thought of Lope...";
+ mes "He will be desperately looking for me...";
+ next;
+ switch(select("Sorry, I'm busy!:I'll help you!")) {
+ case 1:
+ mes "[Euridi]";
+ mes "How heartless!";
+ close;
+ case 2:
+ mes "[Euridi]";
+ mes "I heard that he had gone into the Hazy Forest,";
+ mes "while guiding tourists around the village.";
+ mes "One of the tourists who went with Lope";
+ mes "must still be at the inn.";
+ next;
+ mes "[Euridi]";
+ mes "He wouldn't see me and locked himself in the room.";
+ mes "But he might be willing to see you, because you've been to the Hazy Forest.";
+ setquest 1109;
+ set ep14_1_rope,1;
+ close;
+ }
+ }
+ } else if (ep14_1_rope == 1) {
+ mes "[Euridi]";
+ mes "The tourist is at the inn,";
+ mes "not in front of me!";
+ close;
+ } else if (ep14_1_rope == 2) {
+ mes "[Euridi]";
+ mes "So you've seen Pitt!";
+ mes "I knew he would be willing to see you.";
+ mes "What did he say?";
+ next;
+ mes "[Euridi]";
+ mes "...No way....!";
+ mes "That is utter nonsense.";
+ mes "To blame Lope for it!";
+ mes "I found this piece of paper";
+ mes "near the Hazy Forest.";
+ mes "I'm sure it's Lope's.";
+ next;
+ mes "[Euridi]";
+ mes "If you find the rest of ^0000FFLope's Clues^000000,";
+ mes "you'll be able to find out";
+ mes "where he is.";
+ mes "I'm counting on you, "+strcharinfo(0)+".";
+ changequest 1110,1111;
+ set ep14_1_rope,3;
+ close;
+ } else if (ep14_1_rope == 3) {
+ mes "[Euridi]";
+ mes "If you come across a ^0000FFLope's Clue^000000, please show it to Pitt.";
+ mes "I hope he will tell the truth soon.";
+ close;
+ } else if (ep14_1_rope == 4) {
+ mes "[Euridi]";
+ mes "I don't understand it.";
+ mes "I'm now suspicious of his motives.";
+ mes "Why is he trying so hard to accuse Lope?";
+ mes "Wait... those clues...";
+ next;
+ mes "[Euridi]";
+ mes "Those seem to be more than simple notes.";
+ mes "Can I have a look at them?";
+ mes "...";
+ mes "These fit together like a puzzle.";
+ mes "... Oh!... This is...";
+ next;
+ mes "[Lope's Letter]";
+ mes "...We've been wandering around the Forest for days.";
+ mes "...So we're not protecting the tourists,";
+ mes "I got sick from deadly poison, and became a burden to everyone.";
+ mes "How pathetic...";
+ next;
+ mes "[Lope's Letter]";
+ mes "No wonder I was kicked out of";
+ mes "the Splendide Expedition.";
+ mes "...But I managed to protect at least one tourist.";
+ mes "He will deliver this letter and the ring to you.";
+ next;
+ mes "[Lope's Letter]";
+ mes "...I wanted to propose to you";
+ mes "as a proud member of the Expedition.";
+ mes "I'm sorry, Euridi.";
+ mes "See you soon.";
+ next;
+ mes "Having read the letter,";
+ mes "Euridi is standing staring blankly like someone who wasn't all there.";
+ mes "Let's go show the letter to Pitt.";
+ changequest 1112,1113;
+ delitem 6383,30; //Clue_Of_Lope
+ set ep14_1_rope,5;
+ close;
+ } else if (ep14_1_rope == 5) {
+ mes "[Euridi]";
+ mes "No, Lope must be safe.";
+ mes "He will come back no matter what...";
+ close;
+ } else if (ep14_1_rope == 6) {
+ mes "[Euridi]";
+ mes "......";
+ next;
+ mes "You hear a song coming from the girl who is hanging her head low.";
+ mes "Her friend seems to have something to say.";
+ close;
+ } else if (ep14_1_rope == 7 || ep14_1_rope == 8) {
+ mes "You hear a quiet singing voice.";
+ mes "You can't make the words out.";
+ close;
+ } else if (ep14_1_rope == 9) {
+ mes "[Euridi]";
+ mes "Have you found Lope?";
+ mes "Is he safe?";
+ next;
+ switch(select("Tell her you can't possibly find him.:Tell her he is dead.")) {
+ case 1:
+ mes "[Euridi]";
+ mes "I'll go look for him myself.";
+ mes "Hopefully... it's not too late, yet.";
+ mes "Let me go, there's no time to lose!";
+ close;
+ case 2:
+ mes "[Euridi]";
+ mes "I don't believe it.";
+ mes "He told me he would come back soon...";
+ mes "He told me to hang on.";
+ mes "It can't be... It just can't be...";
+ next;
+ mes "You hand her Lope's Ring, which Pitt gave you.";
+ mes "With the ring in her hand, Euridi bursts into tears.";
+ mes "She starts to sing in a strained voice, still crying.";
+ changequest 1116,1117;
+ set ep14_1_rope,10;
+ delitem 6384,1; //Ring_Of_Lope
+ close;
+ }
+ } else if (ep14_1_rope > 9) {
+ mes "You stand frozen.";
+ mes "You hear a quiet singing voice.";
+ close;
+ }
+}
+
+mora,115,68,3 script Euridi's Friend#pa 520,{
+ if (ep14_1_rope < 2) {
+ mes "[Euridi's Friend]";
+ mes "Please stop Euridi.";
+ mes "She is desperate to find her missing fiance.";
+ close;
+ } else if (ep14_1_rope == 2) {
+ mes "[Euridi's Friend]";
+ mes "Pitt is definitely suspicious.";
+ mes "I think he is avoiding Euridi...";
+ mes "He must be hiding something.";
+ close;
+ } else if (ep14_1_rope == 3) {
+ mes "[Euridi's Friend]";
+ mes "To tell the truth, I don't think";
+ mes "that Lope is alive.";
+ mes "I'm just worried about Euridi.";
+ next;
+ mes "[Euridi]";
+ mes "Aaarrrggghhh!!!!!!!!";
+ next;
+ mes "[Euridi's Friend]";
+ mes "...";
+ mes "To tell the truth, I really believe";
+ mes "that Lope is alive.";
+ mes "...";
+ mes "*sigh*";
+ close;
+ } else if (ep14_1_rope == 4) {
+ mes "[Euridi's Friend]";
+ mes "How's Pitt doing?";
+ mes "I think I should go visit him";
+ mes "and make him feel worse!";
+ mes "He's so disgusting!";
+ close;
+ } else if (ep14_1_rope == 5) {
+ mes "[Euridi's Friend]";
+ mes "Go to Pitt, quick.";
+ close;
+ } else if (ep14_1_rope == 6) {
+ mes "[Euridi's Friend]";
+ mes "Euridi is singing a song of healing";
+ mes "to protect her weakened body and mind.";
+ mes "At this rate, something's going to happen to her too.";
+ next;
+ mes "[Euridi's Friend]";
+ mes "Oh, I remember a traveler telling me";
+ mes "that he had seen a suspicious man";
+ mes "near the entrance to the Hazy Forest.";
+ next;
+ mes "[Euridi's Friend]";
+ mes "The traveler says he looked creepy standing there staring blankly,";
+ mes "but he couldn't see clearly";
+ mes "because of the thick fog.";
+ mes "I think it's worth investigating.";
+ changequest 1114,1115;
+ set ep14_1_rope,7;
+ close;
+ } else if (ep14_1_rope == 7) {
+ mes "[Euridi's Friend]";
+ mes "I hear that a suspicious man was seen";
+ mes "near the entrance to the Hazy Forest.";
+ mes "The traveler says he looked creepy standing there staring blankly,";
+ mes "but he couldn't see clearly";
+ mes "because of the thick fog.";
+ mes "I think it's worth investigating.";
+ close;
+ } else if (ep14_1_rope == 8 || ep14_1_rope == 9) {
+ mes "[Euridi's Friend]";
+ mes "Your face is dark.";
+ mes "Bad news?";
+ close;
+ } else if (ep14_1_rope == 10) {
+ mes "[Euridi's Friend]";
+ mes "There is a Laphine saying that";
+ mes "desperation invites disaster.";
+ mes "Maybe we're responsible";
+ mes "for what happened.";
+ next;
+ if (checkweight(6380,1) == 0) {
+ mes "[Euridi's Friend]";
+ mes "You have too many things with you.";
+ mes "Can you throw out some of them?";
+ close;
+ }
+ mes "[Euridi's Friend]";
+ mes "Lope will be able to rest in peace now.";
+ mes "Thank you. I won't forget what you've done for me.";
+ completequest 1117;
+ set ep14_1_rope,11;
+ getexp 1000000,2000000;
+ getitem 6380,10; //Mora_Coin
+ close;
+ } else if (ep14_1_rope > 10) {
+ mes "[Euridi's Friend]";
+ mes "Thank you. I won't forget your help.";
+ close;
+ }
+}
+
+mora,65,145,3 script Pitt#pa 519,{
+ if (ep14_1_rope == 0) {
+ mes "[Pitt]";
+ mes "So you're quite good,";
+ mes "since you passed through the Hazy Forest alive.";
+ mes "I'm completely messed up, you see,";
+ mes "so I can't afford to listen to the tales of your exploits.";
+ mes "Now leave.";
+ close;
+ } else if (ep14_1_rope == 1) {
+ mes "[Pitt]";
+ mes "You have a knack for pestering people, don't you?";
+ mes "Euridi sent you, eh?";
+ mes "The Laphine couple is";
+ mes "anxious to kill me.";
+ next;
+ mes "[Pitt]";
+ mes "Go and tell her!";
+ mes "That the stupid guide";
+ mes "pushed us reluctant tourists into the forest,";
+ mes "and ran off to save his own skin!";
+ next;
+ mes "[Pitt]";
+ mes "So you're sorry that it's me, not him, that's here?";
+ mes "He will be alive somewhere,";
+ mes "so go and try to find him! Just stop bothering me!";
+ changequest 1109,1110;
+ set ep14_1_rope,2;
+ close;
+ } else if (ep14_1_rope == 2) {
+ mes "[Pitt]";
+ mes "This is all because of";
+ mes "the stupid guide!";
+ mes "I hate Laphines!";
+ close;
+ } else if (ep14_1_rope == 3) {
+ if (countitem(6383) < 30) {
+ mes "[Pitt]";
+ mes "This is all because of";
+ mes "the stupid guide!";
+ mes "I hate Laphines!";
+ close;
+ }
+ mes "[Pitt]";
+ mes "That thing you have in your hand...";
+ mes "It looks very strange.";
+ mes "I've never seen such a thing before.";
+ mes "You'd better not keep that.";
+ mes "Can I have it?";
+ next;
+ switch(select("Give it to him.:Don't give it to him.")) {
+ case 1:
+ mes "[Pitt]";
+ mes "So I swallow it like this,";
+ mes "and voila! Evidence gone!";
+ mes "Now I can sleep soundly, thank you!";
+ delitem 6383,5; //Clue_Of_Lope
+ close;
+ case 2:
+ mes "[Pitt]";
+ mes "Why are you showing me such a thing?";
+ mes "I don't know anything! I'm the victim here!";
+ mes "I'm a victim of the schemes of the Laphine couple.";
+ mes "It's unfair...";
+ next;
+ mes "It's no use trying to talk to him any more.";
+ mes "Try talking to Euridi.";
+ changequest 1111,1112;
+ set ep14_1_rope,4;
+ close;
+ }
+ } else if (ep14_1_rope == 4) {
+ mes "[Pitt]";
+ mes "This is unfair!";
+ mes "This is so totally unfair!";
+ close;
+ } else if (ep14_1_rope == 5) {
+ if (checkweight(6384,1) == 0) {
+ mes "[Pitt]";
+ mes "What are you, a professional mover?";
+ mes "Stomping about with a ton of stuff on your back!";
+ mes "I can't rest because of the noise!";
+ mes "Throw away all that stuff!";
+ close;
+ }
+ mes "[Pitt]";
+ mes "I never imagined you'd find them all";
+ mes "and piece them together.";
+ mes "Is this a divine punishment...?";
+ mes "Or Laphines' curse?";
+ mes "Whew...";
+ next;
+ mes "[Pitt]";
+ mes "That guide fellow,";
+ mes "he opened the gate out";
+ mes "when he was hit hard";
+ mes "by the poison.";
+ next;
+ mes "[Pitt]";
+ mes "When I was hesitating whether to take him with me,";
+ mes "he handed me that letter and the ring.";
+ mes "Laphines' jewelry...";
+ mes "It's rumored that nobody could ever have it except Laphines,";
+ mes "including the Gods themselves.";
+ next;
+ mes "[Pitt]";
+ mes "So I had in my hands";
+ mes "a treasure among treasures!";
+ mes "How...! Just how on earth";
+ mes "could I have let it pass through!";
+ next;
+ mes "[Pitt]";
+ mes "I was going to leave this place";
+ mes "as soon as I pulled myself together.";
+ mes "But now I'm stuck here,";
+ mes "affected by the poison myself.";
+ next;
+ mes "[Pitt]";
+ mes "I'll give you the ring back,";
+ mes "so please leave me alone!";
+ next;
+ mes "["+strcharinfo(0)+"]";
+ mes "Then where could Lope...?";
+ next;
+ mes "[Pitt]";
+ mes "If he died near the exit of the forest,";
+ mes "he must be somewhere around there,";
+ mes "in whatever form he might be in.";
+ changequest 1113,1114;
+ set ep14_1_rope,6;
+ getitem 6384,1; //Ring_Of_Lope
+ close;
+ } else if (ep14_1_rope == 6 || ep14_1_rope == 7) {
+ mes "[Pitt]";
+ mes "I'm a victim, too!";
+ mes "So leave me alone! I beg you!";
+ close;
+ } else if (ep14_1_rope == 8) {
+ mes "[Pitt]";
+ mes "...";
+ close;
+ } else if (ep14_1_rope > 8) {
+ mes "He's sleeping.";
+ mes "He seems to be in a very deep sleep.";
+ close;
+ }
+}
+
+bif_fild01,132,338,3 script Lope#pa 461,2,2,{
+ if (ep14_1_rope < 8) {
+ mes "[Suspicious Man]";
+ mes "......";
+ close;
+ } else if (ep14_1_rope == 8) {
+ donpcevent "Lope#pa::OnEnable";
+ mes "[Suspicious Man]";
+ mes "Aaaarrrrrggggghhhh!!!!!!";
+ mes "I can't see anything.";
+ mes "Who's there?";
+ mes "Answer, or I'll take you as an enemy and kill you.";
+ next;
+ mes "["+strcharinfo(0)+"]";
+ mes "Euridi is looking for you.";
+ next;
+ mes "[Suspicious Man]";
+ mes "......";
+ next;
+ mes "[Lope]";
+ mes "Wraith, how can you be so harsh to me?";
+ mes "I asked you to wipe the name off my mind";
+ mes "in return for bearing the curse!";
+ next;
+ mes "["+strcharinfo(0)+"]";
+ mes "Will you please calm down and listen to...";
+ next;
+ mes "[Lope]";
+ mes "My desire to help";
+ mes "led me to my death,";
+ mes "And my desire to survive and take revenge";
+ mes "led me to my rebirth.";
+ mes "I will not side with life any more.";
+ next;
+ mes "[Lope]";
+ mes "As soon as my transformation is over,";
+ mes "I will punish you all with the bloody confusion of the Hazy Forest,";
+ mes "which saved my life!";
+ next;
+ mes "You put the letter Euridi pieced together in Lope's hands.";
+ next;
+ mes "[Lope]";
+ mes "...This is!";
+ mes "I feel Euridi's touch.";
+ mes "So the letter... was delivered to Euridi?";
+ mes "This is unbelievable...";
+ next;
+ mes "[Lope]";
+ mes "Deformed as I am now,";
+ mes "I'm not her love any more.";
+ mes "Go back, and tell her that Lope turned to dust";
+ mes "on the ground of the Hazy Forest long ago.";
+ next;
+ mes "[Lope]";
+ mes "Now go!";
+ mes "This is my last request as a Laphine called Lope...";
+ set ep14_1_rope,9;
+ changequest 1115,1116;
+ close;
+ } else {
+ mes "[Lope]";
+ mes "Deformed as I am now,";
+ mes "I'm not her love any more.";
+ mes "Go back, and tell her that Lope turned to dust";
+ mes "on the ground of the Hazy Forest long ago.";
+ next;
+ mes "[Lope]";
+ mes "Now go!";
+ mes "This is my last request as a Laphine called Lope...";
+ next;
+ mes "You see a ring glowing faintly on his left hand.";
+ close;
+ }
+ end;
+OnEnable:
+ setnpcdisplay "Lope#pa",999;
+ end;
+OnDisable:
+ disablenpc "Lope#pa";
+ initnpctimer;
+ end;
+OnReset:
+ setnpcdisplay "Lope#pa",461;
+ enablenpc "Lope#pa";
+ end;
+OnTimer2000:
+ donpcevent "Lope#pa::OnReset";
+ stopnpctimer;
+ end;
+OnTouch:
+ mes "I see a suspicious man. Should I try talking to him?";
+ next;
+ switch(select("Leave him alone.:Talk to him.")) {
+ case 1:
+ donpcevent "Lope#pa::OnDisable";
+ mes "[Suspicious Man]";
+ mes "......";
+ close;
+ case 2:
+ donpcevent "Lope#pa::OnDisable";
+ if (ep14_1_rope == 7) {
+ mes "[Suspicious Man]";
+ mes ".";
+ mes "...";
+ mes "........!!!";
+ next;
+ mes "[Suspicious Man]";
+ mes "Aaaaarrrrrggghh!!!!!";
+ set ep14_1_rope,8;
+ close;
+ } else {
+ mes "[Suspicious Man]";
+ mes "......";
+ close;
+ }
+ }
+}
+
+// Find the Research Tools :: muk
+//============================================================
+mora,31,138,6 script Raffle Researcher#ep14 522,{
+ if (checkweight(1201,1) == 0 || MaxWeight - Weight < 500) {
+ mes "^FF0000- Warning message -";
+ mes "- Hang on there!! -";
+ mes "- You have too many items -";
+ mes "- to receive any more items. -";
+ mes "- Please lighten your load -";
+ mes "- and try again. -^000000";
+ close;
+ }
+ // NPC disabled from 12am ~ 5am.
+ if (gettime(3) >= 0 && gettime(3) < 5) {
+ if (ep14_1_muk > 0) {
+ mes "[Raffle Researcher]";
+ mes "Don't humans sleep?";
+ mes "People should be sleeping at this hour.";
+ mes "Why on earth are you bothering me?";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I can't get any sleep because of you.";
+ mes "I have to sleep for my research tomorrow.";
+ mes "You should go sleep too.";
+ close;
+ } else {
+ mes "Z z Z z";
+ next;
+ mes "^FF0000He appears to be asleep.^000000";
+ close;
+ }
+ }
+ if (ep14_1_muk == 0) {
+ mes "[Raffle Researcher]";
+ mes "Oh no~ My research tools...";
+ mes "What...... What was it?";
+ emotion e_sob;
+ next;
+ select("What is your business here?");
+ mes "[Raffle Researcher]";
+ mes "Hmm?";
+ emotion e_what;
+ next;
+ mes "[Raffle Researcher]";
+ mes "You're human...? Are you human...?";
+ mes "You... came from the underworld?";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Human beings are incredible...";
+ mes "You survived the crevice and made it here.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "... ... ...";
+ next;
+ mes "[Raffle Researcher]";
+ mes "You, come here for a minute.";
+ mes "It's a simple experiment, so there's no need to be afraid.";
+ emotion e_gg;
+ next;
+ if(select("What a crazy Raffle. I must run away.:... ...") == 1) {
+ mes "[Raffle Researcher]";
+ mes "You said you had made it up from the Crevice,";
+ mes "so I was wondering what race you were,";
+ mes "but a mere human? How did you get up here?";
+ emotion e_lv;
+ close;
+ }
+ if (BaseLevel < 100) {
+ mes "[Raffle Researcher]";
+ mes "What... I thought a human who made it up from the Crevice";
+ mes "would be extraordinary,";
+ mes "but you're no more than a kid.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Go hunt more ^000000Porings^000000";
+ mes "and come back when your level is in the triple digits kid!";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "... ... ...";
+ emotion e_dots;
+ next;
+ mes "[Raffle Researcher]";
+ mes "You... You're not like the other humans.";
+ mes "You're not running away...";
+ next;
+ mes "[Raffle Researcher]";
+ mes "You've got some serious guts...";
+ mes "Now I really want to do some experiments on you...";
+ next;
+ select("Well... that's... um...");
+ mes "[Raffle Researcher]";
+ mes "Ha ha... Just kidding...";
+ mes "I'm a Raffle researcher,";
+ mes "but I don't research humans.";
+ mes "Actually, I have no idea";
+ mes "what to research";
+ mes "about humans...";
+ next;
+ select("Glad to hear that...");
+ mes "[Raffle Researcher]";
+ mes "That's that. You're not busy, are you?";
+ mes "I'd like you to give me a hand...";
+ next;
+ select("Help him.:Help willingly.:Although you feel a little embarrassed, help anyhow.:Help with conviction.:Help adorably.:You're suspicious, but help anyhow.:You have no choice. Help him.");
+ mes "[Raffle Researcher]";
+ mes "I haven't met many humans";
+ mes "but you clearly care about";
+ mes "another person's hardship.";
+ mes "You must be an ^FF0000extremely^000000 nice human.";
+ emotion e_no1;
+ next;
+ mes "[Raffle Researcher]";
+ mes "I'll save my thanks for time's sake.";
+ mes "It's important, so please take care of it quickly.";
+ mes "I can't proceed with the research because of it.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Here at the Mora Inn,";
+ mes "there's a very famous bath.";
+ mes "If anybody, not just us Raffles,";
+ mes "goes into the bath water";
+ mes "their wounds will be healed instantly...";
+ next;
+ mes "[Raffle Researcher]";
+ mes "So being a great researcher, I went into the bath";
+ mes "to check it out further";
+ mes "and... unfortunately...";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I was attacked by a mysterious creature,";
+ mes "and I lost consciousness.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "When I woke up, I realized that";
+ mes "my important research tools were missing...";
+ mes "So I was at a loss for what to do.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "And here you are, a human,";
+ mes "a brave, heroic human that arrived at Mora Village from the Crevice.";
+ mes "Your willingness to help has really taken this load off of my mind.";
+ next;
+ select("... ... ...");
+ mes "[Raffle Researcher]";
+ mes "Please go to the bath house and retrieve my research tools.";
+ mes "The sooner you get them back,";
+ mes "the sooner I can get back to my research.";
+ setquest 5016;
+ set ep14_1_muk,1;
+ next;
+ mes "[Raffle Researcher]";
+ mes "Have a safe trip.";
+ emotion e_paper;
+ close;
+ } else if (ep14_1_muk == 1) {
+ if (checkquest(5016) > -1 && countitem(6385) == 0) {
+ mes "[Raffle Researcher]";
+ mes "You're back? Where are my research tools?";
+ emotion e_what;
+ next;
+ mes "[Raffle Researcher]";
+ mes "You still haven't found the research tools?";
+ mes "I'm disappointed. Get yourself to the bath";
+ mes "and quickly retrieve my research tools";
+ mes "taken away from me.";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "Wow!! You found the research tools...?";
+ mes "You're quite capable.";
+ mes "I really like how you handle your work.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I like you.";
+ mes "Do you want to work on my research with me?";
+ mes "I could use your help here and there,";
+ mes "until I'm done with this research.";
+ next;
+ select("As you wish.");
+ mes "[Raffle Researcher]";
+ mes "Great. Thanks, and when we're done,";
+ mes "I'll pay you handsomely.";
+ mes "Also, for every research project that's completed,";
+ mes "I'll also give you some pocket money.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Young Raffles these days... they are just plain stupid.";
+ mes "I've always wanted a capable research assistant,";
+ mes "but it hasn't been easy to find one.";
+ next;
+ if (checkweight(6380,1) == 0) {
+ mes "[Raffle Researcher]";
+ mes "By the way... Was it that difficult to";
+ mes "reclaim the research tools?";
+ mes "You're carrying some very heavy looking equipment.";
+ mes "Go lighten your load, and I'll pay you for your work.";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "It must've been hard work to retrieve the tools.";
+ mes "Why don't you take this and go to the inn";
+ mes "and rest up? There's nothing for you to do right now.";
+ delitem 6385,1; //Research_Tool_Bag
+ set ep14_1_muk,2;
+ getitem 6380,1; //Mora_Coin
+ erasequest 5016;
+ close;
+ } else if (ep14_1_muk == 2) {
+ // Unofficial check, but it's needed here.
+ if (checkquest(5029,PLAYTIME) == 0 || checkquest(5029,PLAYTIME) == 1) {
+ mes "[Raffle Researcher]";
+ mes "It must've been hard work to retrieve the tools.";
+ mes "Why don't you take this and go to the inn";
+ mes "and rest up? There's nothing for you to do right now.";
+ close;
+ }
+ switch(rand(1,5)) {
+ case 1:
+ mes "[Raffle Researcher]";
+ mes "I'm still preparing for the research.";
+ mes "Unfortunately a few research tools";
+ mes "were damaged.";
+ emotion e_an;
+ close;
+ case 2:
+ mes "[Raffle Researcher]";
+ mes "Come to think of it, I don't think";
+ mes "I told you my name.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "My name is Inffle. If anybody";
+ mes "asks you who you are working with,";
+ mes "you can say ^0000FFI'm working with Researcher Inffle.^000000";
+ mes "That's why I'm telling you my name.";
+ emotion e_ok;
+ close;
+ case 3:
+ mes "[Raffle Researcher]";
+ mes "Why? The inn is closed?";
+ mes "That's strange, it shouldn't be.";
+ mes "Why don't you go try again?";
+ emotion e_what;
+ close;
+ case 4:
+ break;
+ case 5:
+ mes "[Raffle Researcher]";
+ mes "Darn, I get more worked up the more I think about it.";
+ mes "It's not like I went with bad intentions...";
+ mes "I just wanted to do some research...";
+ mes "Can't believe I got attacked...";
+ mes "I just can't believe it...";
+ mes "What do you think?";
+ emotion e_an;
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "Good thing you're here.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I've been thinking about";
+ mes "the unidentified creature in the bath.";
+ mes "He's quite the little devil, to take research tools,";
+ mes "which are as important to a researcher as his life...";
+ next;
+ mes "[Raffle Researcher]";
+ mes "A research assistant's job";
+ mes "is to make sure that the researcher can focus on his research";
+ mes "And not have to worry about anything else... VERY! Important.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I'd like you to take my revenge";
+ mes "on the unidentified creature for me...";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I don't even want anything that drastic.";
+ mes "3 times! Go bully him for just 3 times.";
+ mes "You can draw on his face,";
+ mes "pinch him, tickle him,";
+ mes "whatever you want. Just bully him 3 times.";
+ set ep14_1_muk,3;
+ setquest 5017;
+ close;
+ } else if (ep14_1_muk < 6) {
+ mes "[Raffle Researcher]";
+ mes "How's the work going?";
+ mes "An assistant has to work swiftly and effectively.";
+ mes "Could it be that you have forgotten";
+ mes "what your task is?";
+ next;
+ select("Exactly. What should I do?");
+ mes "[Raffle Researcher]";
+ mes "Go bully the unidentified creature";
+ mes "just 3 times.";
+ mes "You can draw on his face,";
+ mes "pinch him, tickle him, or whatever.";
+ mes "Bully him 3 times.";
+ emotion e_gg;
+ close;
+ } else if (ep14_1_muk == 6) {
+ mes "[Raffle Researcher]";
+ mes "So you taught him a lesson? Great. I feel avenged!";
+ emotion e_heh;
+ next;
+ mes "[Raffle Researcher]";
+ mes "For a while, I couldn't sleep";
+ mes "because I couldn't stop thinking about the lost research tools.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "That's that! We need to begin the bath research now.";
+ mes "I need to finish the research quickly,";
+ mes "so that I can start on a new topic.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Go to the bath water";
+ mes "with the sample tube that I give you,";
+ mes "and gather some samples.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Look around the bath water,";
+ mes "and you will find an area emitting a distinct aura.";
+ mes "You can collect the samples";
+ mes "from that area.";
+ next;
+ if (MaxWeight - Weight < 100 || checkweight(1092,10) == 0) {
+ mes "[Raffle Researcher]";
+ mes "You are carrying too much weight.";
+ mes "I can't give you the sample tube.";
+ mes "Why don't you lighten your load and come back?";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "Here is the sample tube for collecting.";
+ mes "Go and collect 10 samples!";
+ set ep14_1_muk,7;
+ getitem 1092,10; //Empty_Cylinder
+ erasequest 5018;
+ setquest 5019;
+ close;
+ } else if (ep14_1_muk == 7) {
+ if (checkquest(5019) > -1 && countitem(6386) < 10) {
+ mes "[Raffle Researcher]";
+ mes "Have you collected the samples yet?";
+ mes "Please hurry up.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Look around the bath water,";
+ mes "and you will find an area emitting a distinct aura.";
+ mes "You can collect the samples";
+ mes "from that area.";
+ close;
+ }
+ if (checkweight(6380,1) == 0) {
+ mes "[Raffle Researcher]";
+ mes "I know that you've done a lot...";
+ mes "but you are carrying too many things.";
+ mes "Even though I want to give you pocket money, I can't.";
+ mes "Could you lighten your load and come back?";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "You got the bath water sample. Great job.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I'll have to run a few tests";
+ mes "with the bath water samples.";
+ mes "It usually takes about 24 hours.";
+ mes "Why don't you come back then?";
+ delitem 6386,10; //Bathtub_R_Sample
+ getitem 6380,1; //Mora_Coin
+ set ep14_1_muk,8;
+ erasequest 5019;
+ setquest 5020;
+ close;
+ } else if (ep14_1_muk == 8) {
+ if (checkquest(5020,PLAYTIME) == 0 || checkquest(5020,PLAYTIME) == 1) {
+ mes "[Raffle Researcher]";
+ mes "The basic tests have not been completed yet.";
+ mes "There's nothing for you to do now.";
+ mes "Go for a walk.";
+ mes "Spend some money that I gave you.";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "The basic tests are done.";
+ mes "As I thought...";
+ mes "There were many interesting substances in the bath water.";
+ emotion e_ho;
+ next;
+ mes "[Raffle Researcher]";
+ mes "The most notable is this unidentifiable DNA.";
+ mes "I didn't have a chance to compare it to a lot of DNA samples,";
+ mes "but I'm pretty sure that this DNA";
+ mes "has been transformed by the mysterious substances of the bath.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "After much thought,";
+ mes "I concluded that this DNA probably belongs to";
+ mes "the unidentified creature that attacked me.";
+ next;
+ if (rand(2)) {
+ set .@str$,"teeth";
+ set .@quest,5021;
+ } else {
+ set .@str$,"scales";
+ set .@quest,5022;
+ }
+ mes "[Raffle Researcher]";
+ mes "I'd better compare the two.";
+ mes "Please return to the bath";
+ mes "and look for the creature's "+.@str$+".";
+ mes "If you can, please bring me 10 of them.";
+ set ep14_1_muk,9;
+ erasequest 5020;
+ setquest .@quest;
+ close;
+ } else if (ep14_1_muk == 9) {
+ if (checkquest(5021) > -1 || checkquest(5022) > -1) {
+ if (checkquest(5021) > -1) {
+ set .@quest,5021;
+ set .@item,6387; //Teeth_Sample
+ setarray .@str$[0],"tooth","teeth";
+ } else {
+ set .@quest,5022;
+ set .@item,6388; //Scale_Sample
+ setarray .@str$[0],"scale","scales";
+ }
+ if (countitem(.@item) < 10) {
+ mes "[Raffle Researcher]";
+ mes "Haven't you found the unidentified creature's "+.@str$[1]+" yet?";
+ mes "Look carefully!";
+ mes "I'm certain that the creature";
+ mes "dropped his "+.@str$[1]+" somewhere.";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "You've collected all the "+.@str$[0]+" samples, finally.";
+ mes "As humans say,";
+ mes "I've been waiting forever for them.";
+ next;
+ if (checkweight(6380,1) == 0) {
+ mes "[Raffle Researcher]";
+ mes "I know that you've done a lot...";
+ mes "but you are carrying too many things.";
+ mes "Even though I want to give you pocket money, I can't.";
+ mes "Could you lighten your load and come back?";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "OK, I'll get to work right away.";
+ mes "If you have any business to attend to, do so.";
+ mes "The DNA analysis takes about 6 hours.";
+ mes "Why don't you go for a walk";
+ mes "and come back then?";
+ delitem .@item,10;
+ getitem 6380,1; //Mora_Coin
+ erasequest .@quest;
+ setquest 5023;
+ close;
+ } else if (checkquest(5023,PLAYTIME) == 0 || checkquest(5023,PLAYTIME) == 1) {
+ mes "[Raffle Researcher]";
+ mes "I'm still analyzing the DNA.";
+ mes "The DNA analysis takes about 6 hours.";
+ mes "Why don't you go for a walk and come back then?";
+ close;
+ } else {
+ switch(rand(1,6)) {
+ case 1:
+ case 3:
+ set .@quest,5021;
+ set .@item,6387; //Teeth_Sample
+ setarray .@str$[0],"tooth","teeth";
+ break;
+ case 2:
+ case 4:
+ set .@quest,5022;
+ set .@item,6388; //Scale_Sample
+ setarray .@str$[0],"scale","scales";
+ break;
+ case 5:
+ case 6:
+ break;
+ }
+ if (.@quest) {
+ mes "[Raffle Researcher]";
+ mes "This is not it.";
+ mes "The samples that you collected belonged to a normal species.";
+ emotion e_swt2;
+ next;
+ mes "[Raffle Researcher]";
+ mes "Must be because so many species of creatures";
+ mes "have been in the bath.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I'm sorry, but please re-collect the samples.";
+ mes "This time, the "+.@str$[1]+"... Yes.";
+ mes "Please bring the "+.@str$[0]+" samples.";
+ erasequest 5023;
+ setquest .@quest;
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "Great! These samples are surely";
+ mes "from the mysterious creature.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "According to the analysis,";
+ mes "The DNA is a mutant form of fish DNA.";
+ mes "I'm not sure how long this creature";
+ mes "has lived in the bath,";
+ mes "but this DNA is 70% evolved";
+ mes "from the original fish DNA.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Where did this fish come from?";
+ mes "How can it survive in the warm bath water?";
+ mes "After the DNA analysis,";
+ mes "my head is filled with even more questions.";
+ next;
+ mes "... ... ... ... ...";
+ emotion e_dots;
+ emotion e_dots,1;
+ next;
+ mes "[Raffle Researcher]";
+ mes "The village elders say";
+ mes "that the bath water comes from";
+ mes "the puddles around the village.";
+ next;
+ callsub L_CheckWeight;
+ mes "[Raffle Researcher]";
+ mes "If you get me a sample from the puddle";
+ mes "to the east, at 2 o'clock from here,";
+ mes "I'll tell you what to do next.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "You probably don't need to run around";
+ mes "like you did collecting";
+ mes "the bath water samples.";
+ set ep14_1_muk,10;
+ getitem 1092,1; //Empty_Cylinder
+ erasequest 5023;
+ setquest 5024;
+ next;
+ mes "[Raffle Researcher]";
+ mes "If you get all 4 puddle samples at once";
+ mes "it may be more convenient. However,";
+ mes "there's the risk of samples being damaged or mixed up.";
+ mes "Therefore, I'm going to send you one place at a time. Good luck.";
+ close;
+ }
+ } else if (ep14_1_muk == 10) {
+ if (countitem(6389) == 0) {
+ mes "[Raffle Researcher]";
+ mes "You still haven't gone to collect the puddle sample?";
+ mes "Go to the puddle to the east of the village,";
+ mes "and collect a sample.";
+ mes "It's going to be at 2 o'clock from here.";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "You have the sample from the puddle to the east?";
+ mes "Great job, but it's no time to rest -";
+ mes "the research is almost done.";
+ next;
+ callsub L_CheckWeight;
+ mes "[Raffle Researcher]";
+ mes "Get me a sample from the puddle from the west.";
+ mes "It's not completely to the west...";
+ mes "The puddle should be at 7 o'clock";
+ mes "from the village.";
+ delitem 6389,1; //Puddle_R_Sample
+ set ep14_1_muk,11;
+ getitem 1092,1; //Empty_Cylinder
+ changequest 5024,5025;
+ next;
+ mes "[Raffle Researcher]";
+ mes "Take care not to damage the sample.";
+ mes "Good luck!";
+ close;
+ } else if (ep14_1_muk == 11) {
+ if (countitem(6389) == 0) {
+ mes "[Raffle Researcher]";
+ mes "You still haven't gone to collect the puddle sample?";
+ mes "Go to the puddle to the west of the village,";
+ mes "and collect a sample.";
+ mes "It's going to be at 7 o'clock from here.";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "You have the sample from the puddle to the west?";
+ mes "Great job, but it's no time to rest -";
+ mes "the research is almost done.";
+ next;
+ callsub L_CheckWeight;
+ mes "[Raffle Researcher]";
+ mes "Get me a sample from the puddle from the south.";
+ mes "The puddle to the south";
+ mes "should be... at 6 o'clock from here.";
+ delitem 6389,1; //Puddle_R_Sample
+ set ep14_1_muk,12;
+ getitem 1092,1; //Empty_Cylinder
+ changequest 5025,5026;
+ next;
+ mes "[Raffle Researcher]";
+ mes "I can't emphasize this enough, even if I did it 1000000000000000000000 times.";
+ mes "Please take care that";
+ mes "the sample is not damaged.";
+ close;
+ } else if (ep14_1_muk == 12) {
+ if (countitem(6389) == 0) {
+ mes "You still haven't gone to collect the puddle sample?";
+ mes "Get me a sample from the puddle from the south.";
+ mes "The puddle to the south is located";
+ mes "at 6 o'clock from here.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "You know what I'm going to say?";
+ mes "Be careful.";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "You have the sample from the puddle to the south?";
+ mes "Now only the puddle to the north";
+ mes "remains to be sampled.";
+ next;
+ callsub L_CheckWeight;
+ mes "[Raffle Researcher]";
+ mes "Please get me the sample from the puddle to the north.";
+ mes "It's not completely to the north.";
+ mes "it's at 11 o'clock from the village.";
+ delitem 6389,1; //Puddle_R_Sample
+ set ep14_1_muk,13;
+ getitem 1092,1; //Empty_Cylinder
+ changequest 5026,5027;
+ next;
+ mes "[Raffle Researcher]";
+ mes "You know what I'm going to say?";
+ mes "Be careful.";
+ close;
+ } else if (ep14_1_muk == 13) {
+ if (countitem(6389) == 0) {
+ mes "[Raffle Researcher]";
+ mes "You still haven't gone to collect the puddle sample?";
+ mes "Please get me a sample from the puddle to the north.";
+ mes "It's not exactly north of the village.";
+ mes "The puddle should be located at 11 o'clock";
+ mes "from the village.";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "You brought the last sample from the puddle from the north.";
+ mes "Great work. You've done really well.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Now, I'm going to do some research";
+ mes "with these samples,";
+ mes "looking at the relationship between";
+ mes "these puddles and the bath.";
+ next;
+ if (checkweight(6380,4) == 0) {
+ mes "[Raffle Researcher]";
+ mes "I know that you've done a lot...";
+ mes "but you are carrying too many things.";
+ mes "Even though I want to give you pocket money, I can't.";
+ mes "Could you lighten your load and come back?";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "If I finish this experiment...";
+ mes "There's probably nothing else to do. While I run the experiment,";
+ mes "why don't you go and entertain yourself?";
+ delitem 6389,1; //Puddle_R_Sample
+ set ep14_1_muk,14;
+ getitem 6380,4; //Mora_Coin
+ erasequest 5027;
+ setquest 5028;
+ next;
+ mes "[Raffle Researcher]";
+ mes "Comparison of the samples and the bath water";
+ mes "will take about 12 hours.";
+ close;
+ } else if (ep14_1_muk == 14) {
+ if (checkquest(5028,PLAYTIME) == 0 || checkquest(5028,PLAYTIME) == 1) {
+ mes "[Raffle Researcher]";
+ mes "What? You're here? Well...";
+ next;
+ mes "[Raffle Researcher]";
+ mes "But the sample studies have not been finished.";
+ mes "This is an experiment for the final result,";
+ mes "so don't be too hasty.";
+ mes "I think the research will take about 12 hours.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Come back then.";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "You're here? Finally,";
+ mes "the experiment results are all in.";
+ mes "Do you want to look at the results?";
+ next;
+ switch(select("Actually, I don't want to.:Look at the results.")) {
+ case 1:
+ mes "[Raffle Researcher]";
+ mes "Good thinking. Actually, it may hurt";
+ mes "regular people's brains to look at it.";
+ mes "I suppose it's time for your reward";
+ mes "for helping me out so much.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Did I talk to you about the reward before the experiment?";
+ mes "That you won't be sorry that you helped out...";
+ next;
+ break;
+ case 2:
+ mes "[Raffle Researcher]";
+ mes "You're curious about the results? Really???";
+ mes "OK, here it is.";
+ next;
+ callsub L_ShowReport;
+ mes "[Raffle Researcher]";
+ mes "There are no volcanoes around the area";
+ mes "and no record of volcanoes in the past,";
+ mes "but the water temperature is that high...";
+ mes "Isn't it surprising?";
+ next;
+ mes "[Raffle Researcher]";
+ mes "The ingredients are... yes.";
+ mes "There are certainly substances that are beneficial for you humans.";
+ mes "But, there are also substances";
+ mes "that are fatal to us Raffles,";
+ mes "or other races.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "And if you look at the electric conductivity,";
+ mes "it is quite higher than that of the average water.";
+ mes "My theory is that";
+ mes "this must be the cause of the mysterious power.";
+ mes "That's what I'm thinking about.";
+ mes "Anyhow.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "There is something at work that science cannot explain";
+ mes "in the bath water...";
+ mes "Take the unidentified creature, for instance.";
+ mes "How strange is it that a fish can live";
+ mes "in such warm water?";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I'm not satisfied with the research results and conclusions.";
+ mes "I guess in the end,";
+ mes "it will remain a mystery...";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I suppose it's time for your reward";
+ mes "for helping me out so much.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Did I talk to you about the reward before the experiment?";
+ mes "That you won't be sorry that you helped out...";
+ next;
+ break;
+ }
+ mes "[Raffle Researcher]";
+ mes "I was thinking about what you would want";
+ mes "for your reward... and I felt";
+ mes "a little... sad.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "... ... ... ...";
+ next;
+ mes "[Raffle Researcher]";
+ mes "During our short time here together working on these projects,";
+ mes "I sent you all over the place.";
+ mes "It must've been hard, but you didn't complain at all.";
+ mes "And unlike some of the other guys I've had,";
+ mes "you never skipped work.";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I suppose I've grown fond of you,";
+ mes "so that it saddens me to say goodbye...";
+ next;
+ mes "[Raffle Researcher]";
+ mes "But thank you anyhow. I've been researching for a while,";
+ mes "but I've never met such an excellent research assistant as you.";
+ next;
+ if (MaxWeight - Weight < 100 || checkweight(1092,1) == 0) {
+ mes "[Raffle Researcher]";
+ mes "Hmm? By the way...";
+ mes "You are carrying too much weight.";
+ mes "Could it be because you are also sad";
+ mes "about parting ways?";
+ next;
+ mes "[Raffle Researcher]";
+ mes "With this weight, I can't give you a reward!";
+ close;
+ }
+ mes "[Raffle Researcher]";
+ mes "The best research assistant in my life...";
+ mes "is you, "+strcharinfo(0)+"!!!";
+ set ep14_1_muk,15;
+ completequest 5028;
+ getexp 1000000,4000000;
+ getitem 6380,30; //Mora_Coin
+ next;
+ mes "[Raffle Researcher]";
+ mes "If we happen to run into each other again,";
+ mes "let's work on a research project once more.";
+ close;
+ } else if (ep14_1_muk == 15) {
+ mes "[Raffle Researcher]";
+ mes "Hmm? No?... What are you doing here?";
+ next;
+ mes "[Raffle Researcher]";
+ mes "Could it be that you suddenly want to look at";
+ mes "the research report???";
+ next;
+ switch(select("Look at the report.:I came to say hello.")) {
+ case 1:
+ mes "[Raffle Researcher]";
+ mes "Haven't I shown it to you before?";
+ next;
+ mes "[Raffle Researcher]";
+ mes "... ... ... ...";
+ emotion e_dots;
+ next;
+ mes "[Raffle Researcher]";
+ mes "Maybe I haven't shown you.";
+ mes "Sorry about that. So you wanted to see it so badly";
+ mes "that you came back to see me?";
+ mes "Great! Here it is.";
+ next;
+ while(1) {
+ callsub L_ShowReport;
+ mes "[Raffle Researcher]";
+ mes "This concludes the report of";
+ mes "Mora Village's mysterious bath.";
+ mes "You want to look again?";
+ emotion e_what;
+ next;
+ switch(select("Look again.:Don't look again.")) {
+ case 1:
+ mes "[Raffle Researcher]";
+ mes "Sure... As you wish!!";
+ next;
+ break;
+ case 2:
+ mes "[Raffle Researcher]";
+ mes "Goodbye. Come by any time,";
+ mes "if you want to look at the results again.";
+ mes "You're always welcome here.";
+ close;
+ }
+ }
+ case 2:
+ mes "[Raffle Researcher]";
+ mes "Oh, You came to say hi. I see.";
+ mes "Long time no see, "+strcharinfo(0)+".";
+ next;
+ mes "[Raffle Researcher]";
+ mes "I've been telling you that I lucked out in picking you as my research assistant.";
+ mes "Come by any time,";
+ mes "if you want to look at the results again.";
+ mes "You're always welcome here.";
+ close;
+ }
+ } else {
+ mes "[Raffle Researcher]";
+ mes "Hmm? I'm Researcher Inffle.";
+ mes "Who are you?";
+ close;
+ }
+ end;
+L_ShowReport:
+ mes "[Experimental Results]";
+ mes "*** Researcher - Inffle";
+ mes "*** Research Assistant - "+strcharinfo(0);
+ mes "¡¡";
+ mes "<Research topic>";
+ mes "*** Bath of Mora Village";
+ mes "¡¡";
+ mes "<Aim>";
+ mes "To investigate the mysterious power of the bath water";
+ mes "and to find out ways to better utilize";
+ mes "the water.";
+ mes "¡¡";
+ mes "<Methods>";
+ mes "1. Obtained an unidentified DNA sample.";
+ mes "Obtained a sample of an unidentified DNA,";
+ mes "and collected more samples to look further into it.";
+ mes "¡¡";
+ mes "2. A comparison analysis on the unidentified DNA";
+ mes "Concluded that the DNA belongs to";
+ mes "an unidentified creature living in the bath water.";
+ mes "combine and result in";
+ mes "from the swordfish DNA.";
+ mes "¡¡";
+ mes "3. Research on the puddles around the village";
+ mes "From the four puddles around the village,";
+ mes "confirmed that the testing substances were";
+ mes "distributed evenly across the puddles.";
+ mes "It is thought that the four puddles";
+ mes "combine and result in";
+ mes "the mysterious power.";
+ mes "¡¡";
+ mes "<Material analysis>";
+ mes "*** Temperature ***** 33.5° ";
+ mes "*** PH ************ 9.8";
+ mes "*** Solid residues *** 176";
+ mes "*** K+ ************ 0,23";
+ mes "*** Ca++ ********** 1.83";
+ mes "*** Cl- *********** 26.2";
+ mes "*** HCO3- ********* 31.0";
+ mes "*** H2S *********** 1.7";
+ mes "*** Na++ ********** 51.9";
+ mes "*** Mg+ *********** 0.03";
+ mes "*** SO4- ********** 5.0";
+ mes "*** F ************* 12.8";
+ mes "*** SiO2 ********** 23.9";
+ mes "*** Li ************ 0.06";
+ mes "*** CO3+ ********** 22.8";
+ mes "*** Sr ************ 0.04";
+ mes "*** Ge ************ 0.004";
+ mes "*** T-solids ****** 165";
+ mes "*** Electric conductivity **** 500";
+ mes "*** Longitude ********** 4.6";
+ next;
+ return;
+L_CheckWeight:
+ if (MaxWeight - Weight < 100 || checkweight(1092,1) == 0) {
+ mes "[Raffle Researcher]";
+ mes "You are carrying too much weight.";
+ mes "I can't give you the sample tube.";
+ mes "Why don't you lighten your load and come back?";
+ close;
+ }
+ return;
+}
+
+mora,114,79,0 script Black Shadow#ep14_muk 844,{
+ if (checkweight(1201,1) == 0 || MaxWeight - Weight < 500) {
+ mes "^FF0000- Warning message -";
+ mes "- Hang on there!! -";
+ mes "- You have too many items -";
+ mes "- to receive any more items. -";
+ mes "- Please lighten your load -";
+ mes "- and try again. -^000000";
+ close;
+ }
+ if (BaseLevel < 100) {
+ mes "Something looks at you from head to toe, and disappears, mocking you.";
+ close2;
+ donpcevent "Black Shadow#ep14_muk::OnDisable";
+ end;
+ }
+ set .@playtime, checkquest(5029,PLAYTIME);
+ if (.@playtime == 0 || .@playtime == 1) {
+ mes "You see a dark hole. As you show interest, something disappears quickly into the dark hole.";
+ close2;
+ donpcevent "Black Shadow#ep14_muk::OnDisable";
+ end;
+ } else if (.@playtime == 2)
+ erasequest 5029;
+ if (ep14_1_goki == 30) {
+ if (checkquest(5030) == -1 && checkquest(5031) == -1 && checkquest(5032) == -1 && checkquest(5033) == -1 && checkquest(5034) == -1) {
+ mes "[Unidentified creature]";
+ mes "Arrgghh!!!";
+ mes "Why you bother me.";
+ mes "You stop bullying me.";
+ next;
+ if(select("Bully anyway.:I'll stop.") == 1) {
+ emotion e_sob;
+ set ep14_1_goki,0;
+ close2;
+ donpcevent "Black Shadow#ep14_muk::OnDisable";
+ end;
+ }
+ mes "[Unidentified creature]";
+ mes "You... Good.";
+ mes "Everybody calls me monster.";
+ mes "Hit me. Bully. Me tired.";
+ next;
+ mes "[Fishee]";
+ mes "My name Fishee.";
+ mes "Dad name me.";
+ next;
+ mes "... ... ... ... ...";
+ next;
+ mes "He appears to be rambling.";
+ next;
+ mes "[Fishee]";
+ mes "Bully. Fun. Every day.";
+ mes "I talk. Still bully.";
+ next;
+ mes "[Fishee]";
+ mes "You... Good. Help Fishee?";
+ next;
+ if(select("Don't help.:Help.") == 1) {
+ emotion e_sob;
+ set ep14_1_goki,0;
+ close2;
+ donpcevent "Black Shadow#ep14_muk::OnDisable";
+ end;
+ }
+ mes "[Fishee]";
+ mes "You good. Good!";
+ next;
+ mes "[Fishee]";
+ mes "Me didn't live here.";
+ mes "Me lived puddle.";
+ mes "Puddle. Live there.";
+ next;
+ mes "[Fishee]";
+ mes "Me sleep weird.";
+ mes "Wake up one day.";
+ mes "Here, bath.";
+ next;
+ mes "[Fishee]";
+ mes "Don't know how go home.";
+ mes "Me just live here.";
+ mes "Grow big. Hole small.";
+ mes "Can't get in.";
+ next;
+ mes "[Fishee]";
+ mes "Me miss family. Me want to see family.";
+ mes "You good. How my family do.";
+ mes "Bring me. Good.";
+ next;
+ select("How would I know who is your family?");
+ mes "[Fishee]";
+ mes "Us fish stupid.";
+ mes "Stupid. But know family name.";
+ next;
+ mes "[Fishee]";
+ mes "Family know name Fishee. Family come.";
+ next;
+ mes "[Fishee]";
+ mes "Please. In puddle.";
+ mes "You tell me my family do okay.";
+ setquest 5030+rand(4); //5030,5031,5032,5033
+ close;
+ } else if (checkquest(5030) > -1 || checkquest(5031) > -1 || checkquest(5032) > -1 || checkquest(5033) > -1) {
+ mes "[Fishee]";
+ mes "Please. In puddle.";
+ mes "You tell me my family do okay.";
+ next;
+ mes "[Fishee]";
+ mes "You forgot me name?";
+ next;
+ if(select("Please tell me your name again!:I know your name.") == 1) {
+ mes "[Fishee]";
+ mes "Your memory, like fish.";
+ mes "Stupid. I talk.";
+ mes "My name Fishee, Fishee!!";
+ next;
+ }
+ mes "[Fishee]";
+ mes "Please. In puddle.";
+ mes "You tell me my family do okay.";
+ close;
+ } else if (checkquest(5034) > -1 && checkquest(5034) < 2) {
+ if (MaxWeight - Weight < 100 || checkweight(5792,1) == 0) {
+ mes "[Fishee]";
+ mes "You have lots.";
+ mes "I give. To you.";
+ mes "Empty bag. Come back.";
+ close;
+ }
+ mes "[Fishee]";
+ mes "You told me my family ok. Thank you.";
+ mes "I know thank you. Fish.";
+ mes "Re... Don't know word.";
+ next;
+ select("Perhaps... Reward??");
+ mes "[Fishee]";
+ mes "Yes. That. You good.";
+ mes "Smart. Give you reward.";
+ mes "I know thank you. Fish.";
+ next;
+ mes "[Fishee]";
+ mes "This, I got from bath.";
+ mes "No. Someone left it.";
+ mes "... ... Good guy. I give you.";
+ completequest 5034;
+ getitem 5792,1; //Fish_Pin
+ close;
+ } else if (checkquest(5034) == 2) {
+ mes "[Fishee]";
+ mes "You... I saw. Feeling. I saw. Feeling.";
+ mes "You... Name?";
+ next;
+ input .@inputstr$;
+ mes "[Fishee]";
+ mes .@inputstr$+" do.";
+ mes "No know. No remember..";
+ mes "Who.. you... are?";
+ close;
+ }
+ }
+ set .@weapon$, ((getequipisequiped(EQI_HAND_R))?getequipname(EQI_HAND_R):"Bare handed");
+ set .@pc_hp, 200;
+ set .@npc_hp, 200;
+ setarray .@skills$[0],"Midsection punch","Headbutt","Wiggle wiggle","Screw punch","Mumble muble";
+ mes "The unidentified creature is attacking. What will you do?";
+ next;
+ while(1) {
+ switch(select("Attack with a weapon.:Attack using a skill.:Attack using teeth.:Run away in fear.")) {
+ case 1: // Weapon
+ set .@p_damage,10;
+ set .@pc_attack, rand(1,10);
+ mes "["+strcharinfo(0)+"'s Attack]";
+ switch(.@pc_attack) {
+ // Miss.
+ case 3:
+ mes "You attempt to attack with your recent expensive purchase ^FF0000["+.@weapon$+"]^000000, but the unidentified creature rapidly dodged.";
+ break;
+ case 6:
+ mes "By mistake, you use ^FF0000["+.@weapon$+"]^000000 that Holgren has thrown your way to attack the unidentified creature, but the creature foresaw the attack and dodged.";
+ break;
+ case 9:
+ mes "You use your precious ^FF0000[+"+.@weapon$+"+]^000000 to attack the unidentified creature, but the creature pulled back and dodged your attack.";
+ break;
+ // Hit.
+ default:
+ specialeffect EF_HIT1;
+ set .@npc_hp, .@npc_hp - .@p_damage;
+ switch(.@pc_attack) {
+ case 1: set .@str$,"With your precious ^FF0000["+.@weapon$+"]^000000, you attacked the unidentified creature. The weapon pierced the creature's body."; break;
+ case 2: set .@str$,"By mistake, you use ^FF0000["+.@weapon$+"]^000000 that Holgren has thrown your way to attack the unidentified creature. With a thud, the unidentified creature's body is swaying."; break;
+ case 4: set .@str$,"You attempt to attack with your recent expensive purchase ^FF0000["+.@weapon$+"]^000000. You hit the unidentified creature's body with a thud."; break;
+ case 5: set .@str$,"You use a borrowed ^FF0000["+.@weapon$+"]^000000 to attack the unidentified creature, but the weapon slipped. But the weapon flies off and pierces the creature's body."; break;
+ case 7: set .@str$,"With your precious ^FF0000["+.@weapon$+"]^000000, you attacked the unidentified creature. It was as if the weapon was part of your body."; break;
+ case 8: set .@str$,"You use your lucky ^FF0000["+.@weapon$+"]^000000 to attack the unidentified creature."; break;
+ case 10: set .@str$,"You use a friend's ^FF0000["+.@weapon$+"]^000000 to attack the unidentified creature."; break;
+ }
+ mes .@str$+" ^FF0000["+.@p_damage+"]^000000 damage inflicted.";
+ break;
+ }
+ next;
+ break;
+ case 2: // Skill
+ set .@p_damage,20;
+ set .@pc_attack, rand(1,6);
+ set .@skillname$, .@skills$[rand(5)];
+ mes "["+strcharinfo(0)+"'s Attack]";
+ switch(.@pc_attack) {
+ // Miss.
+ case 2:
+ mes "You use skill ^0000FF["+.@skillname$+"]^000000 but you couldn't concentrate, and failed to use the skill properly.";
+ break;
+ case 4:
+ mes "You use skill ^0000FF["+.@skillname$+"]^000000 with all your might, but the unidentified creature dodged lightly and mocked you.";
+ break;
+ case 6:
+ mes "You use skill ^0000FF["+.@skillname$+"]^000000 to attack the creature, but he got out of sight and you failed to use the skill.";
+ break;
+ // Hit.
+ default:
+ specialeffect EF_BASH;
+ set .@npc_hp, .@npc_hp - .@p_damage;
+ switch(.@pc_attack) {
+ case 1: set .@str$, "With an attack so fast and furious, the creature is too stunned to move."; break;
+ case 3: set .@str$, "The creature dodged, but you foresaw his movements and targeted accurately."; break;
+ case 5: set .@str$, "Your skill flew in a perfect parabola and hit the creature exactly."; break;
+ }
+ mes "You use skill ^0000FF["+.@skillname$+"]^000000 to attack the unidentified creature. "+.@str$+" ^FF0000["+.@p_damage+"]^000000 damage inflicted.";
+ break;
+ }
+ next;
+ break;
+ case 3: // Tooth
+ set .@p_damage,50;
+ set .@pc_attack, rand(1,10);
+ mes "["+strcharinfo(0)+"'s Attack]";
+ if (.@pc_attack == 4 || .@pc_attack == 7) {
+ specialeffect EF_HIT1;
+ set .@npc_hp, .@npc_hp - .@p_damage;
+ mes "You use your well-groomed teeth to bite the unidentified creature hard until your teeth sink into its flesh. ^FF0000["+.@p_damage+"]^000000 damage inflicted.";
+ } else
+ mes "You use your steel-like teeth to bite the unidentified creature, but the frightened creature dodged. He stares at you with strange eyes.";
+ next;
+ break;
+ case 4: // Run
+ mes "You get scared of the unidentified creature, and attempt to run.";
+ next;
+ mes "["+strcharinfo(0)+"'s Escape]";
+ if (rand(1,2) == 1) {
+ mes "Fortunately, the unidentified creature did not come after you.";
+ close;
+ } else {
+ mes "When you attempt to run away, the unidentified creature sees you and attacks. You fail to escape.";
+ next;
+ specialeffect2 EF_HIT1;
+ mes "The creature slams you with its tail. It's so painful that a tear rolls out of your eyes. ^FF000010^000000 damaged received.";
+ set .@pc_hp, .@pc_hp - 10;
+ next;
+ // Unofficial check, but it's needed here.
+ callsub L_CheckPCAlive, .@pc_hp;
+ }
+ break;
+ }
+ if (.@npc_hp <= 0) {
+ mes "You won. The unidentified creature is unconscious.";
+ next;
+ if (checkquest(5016) > -1 && countitem(6385) == 0) {
+ mes "What will you do?";
+ next;
+ select("Look for the research tools.");
+ if (checkweight(6385,1) == 0) {
+ mes "You attempted to look for the research tools,";
+ mes "but you are carrying too many things.";
+ mes "You'd better lighten your load";
+ mes "and come back.";
+ close2;
+ donpcevent "Black Shadow#ep14_muk::OnDisable";
+ end;
+ }
+ mes "Found Researcher Raffle's ^0000FF Research tool ^000000.";
+ set ep14_1_goki, ep14_1_goki+1;
+ getitem 6385,1; //Research_Tool_Bag
+ setquest 5029;
+ next;
+ mes "The creature wakes up and disappears into the dark hole.";
+ close2;
+ donpcevent "Black Shadow#ep14_muk::OnDisable";
+ end;
+ } else if (checkquest(5017) > -1) {
+ mes "How will you bully the creature?";
+ next;
+ input .@inputstr$;
+ mes "You do ^0000FF"+.@inputstr$+"^000000 to bully the unidentified creature.";
+ next;
+ setquest 5029;
+ switch(ep14_1_muk) {
+ case 3:
+ mes "You bully the unidentified creature. This is kind of fun.";
+ break;
+ case 4:
+ mes "You bully the unidentified creature for the second time. It's definitely entertaining.";
+ break;
+ case 5:
+ mes "You bully the unidentified creature for the third time. It's fun, but now it is time to stop.";
+ changequest 5017,5018;
+ break;
+ }
+ set ep14_1_muk, ep14_1_muk+1;
+ set ep14_1_goki, ep14_1_goki+1;
+ close2;
+ donpcevent "Black Shadow#ep14_muk::OnDisable";
+ end;
+ } else {
+ mes "What will you do?";
+ next;
+ if(select("Check the body of the unidentified creature.:Leave.") == 2) {
+ setquest 5029;
+ set ep14_1_goki, ep14_1_goki+1;
+ close2;
+ donpcevent "Black Shadow#ep14_muk::OnDisable";
+ end;
+ }
+ if (rand(1,30) == 7) {
+ if (checkweight(6380,1) == 0) {
+ mes "While you were checking the body of the unidentified creature, your fingers touch something. You got lucky, but due to your heavy load you failed to obtain a ^0000FF Mora Coin^000000.";
+ set ep14_1_goki, ep14_1_goki+1;
+ setquest 5029;
+ close2;
+ donpcevent "Black Shadow#ep14_muk::OnDisable";
+ end;
+ }
+ mes "While you were checking the body of the unidentified creature, your fingers touch something. Lucky. Obtained a ^0000FF Mora Coin^000000.";
+ set ep14_1_goki, ep14_1_goki+1;
+ getitem 6380,1; //Mora_Coin
+ setquest 5029;
+ next;
+ mes "The creature wakes up and disappears into the dark hole.";
+ } else {
+ mes "As soon as you touch the creature's body, it wakes up and disappears into the dark hole.";
+ set ep14_1_goki, ep14_1_goki+1;
+ setquest 5029;
+ }
+ close2;
+ donpcevent "Black Shadow#ep14_muk::OnDisable";
+ end;
+ }
+ }
+ mes "[ Current Progress ]";
+ mes strcharinfo(0)+" HP = "+.@pc_hp;
+ mes "Unidentified Creature HP = "+.@npc_hp;
+ next;
+ mes "[Attack of the unidentified creature]";
+ set .@npc_attack, rand(1,3);
+ switch(.@npc_attack) {
+ case 1:
+ set .@n_damage,10;
+ mes "The unidentified creature shoots a stream of bath water.";
+ break;
+ case 2:
+ set .@n_damage,20;
+ mes "The unidentified creature dashes at you with great speed. It appears to be attempting a headbutt.";
+ break;
+ case 3:
+ set .@n_damage,50;
+ mes "The unidentified creature runs at you with its teeth bared. It appears to be attempting to bite.";
+ break;
+ }
+ next;
+ mes "What will you do?";
+ next;
+ switch(select("... ... ...:Dodge.:Block.:It's too much. Run away.")) {
+ case 1:
+ switch(.@npc_attack) {
+ case 1:
+ specialeffect2 EF_ICEARROW;
+ mes "You stand still. The stream of water hits your face squarely. Your mind is clear in an instant. ^FF0000["+.@n_damage+"]^000000 damage received.";
+ break;
+ case 2:
+ specialeffect2 EF_BASH;
+ mes "You stand still. The creature headbutts you squarely. Your mind is clear in an instant. ^FF0000["+.@n_damage+"]^000000 damage received.";
+ break;
+ case 3:
+ specialeffect2 EF_HIT1;
+ mes "You stand still. While you were standing stupidly, the creature comes near and bites you mercilessly. Your mind is clear in an instant. ^FF0000["+.@n_damage+"]^000000 damage received.";
+ break;
+ }
+ set .@pc_hp, .@pc_hp - .@n_damage;
+ next;
+ break;
+ case 2:
+ switch(.@npc_attack) {
+ case 1:
+ set .@miss, rand(1,5);
+ mes "[Attack of the unidentified creature]";
+ switch(.@miss) {
+ // Miss.
+ case 1:
+ mes "The unidentified creature shoots a stream of water at you, but you dodge it easily by tilting your body.";
+ break;
+ case 3:
+ mes "The unidentified creature shoots a stream of water at you, but you dodge it while picking your nose.";
+ break;
+ // Hit.
+ default:
+ specialeffect2 EF_ICEARROW;
+ set .@pc_hp, .@pc_hp - .@n_damage;
+ switch(.@miss) {
+ case 2: set .@str$,"face"; break;
+ case 4: set .@str$,"stomach"; break;
+ case 5: set .@str$,"arm"; break;
+ }
+ mes "The stream of water hits your "+.@str$+" squarely. ^FF0000["+.@n_damage+"]^000000 damage received.";
+ break;
+ }
+ next;
+ break;
+ case 2:
+ set .@miss, rand(1,10);
+ mes "[Attack of the unidentified creature]";
+ switch(.@miss) {
+ // Miss.
+ case 1:
+ mes "The unidentified creature dashes at you attempting a headbutt, but you are not the one to succumb to such an attack.";
+ break;
+ case 3:
+ mes "The unidentified creature dashes at you attempting a headbutt, but you move slightly to dodge the attack.";
+ break;
+ case 5:
+ mes "The unidentified creature dashes at you attempting a headbutt, but you dodge the attack while picking your nose.";
+ break;
+ case 7:
+ mes "The unidentified creature dashes at you attempting a headbutt, but you dodge the attack easily.";
+ break;
+ // Hit.
+ default:
+ specialeffect2 EF_BASH;
+ set .@pc_hp, .@pc_hp - .@n_damage;
+ switch(.@miss) {
+ case 2: set .@str$,"With a thud, you can feel intense pain."; break;
+ case 4: set .@str$,"*thud* Your back seems to give way."; break;
+ case 6: set .@str$,"The creature's attack hits you in the shoulder."; break;
+ case 8: set .@str$,"The attack is like an arrow."; break;
+ case 9: set .@str$,"The attack was fast and accurate."; break;
+ case 10: set .@str$,"It hits your hand with a thud."; break;
+ }
+ mes "The unidentified creature dashes at you and headbutts. "+.@str$+" ^FF0000["+.@n_damage+"]^000000 damage received.";
+ break;
+ }
+ next;
+ break;
+ case 3:
+ set .@miss, rand(1,10);
+ mes "[Attack of the unidentified creature]";
+ switch(.@miss) {
+ // Miss.
+ case 1:
+ mes "The unidentified creature runs at you with its teeth bared, but you dodge the attack sneering.";
+ break;
+ case 3:
+ mes "The unidentified creature runs at you with its teeth bared, but you dodge the attack by moving slightly.";
+ break;
+ case 5:
+ mes "The unidentified creature runs at you with its teeth bared, but you dodge the attack while stretching.";
+ break;
+ case 7:
+ mes "The unidentified creature runs at you with its teeth bared, but you dodge the attack while counting Zenies.";
+ break;
+ case 8:
+ mes "The unidentified creature runs at you with its teeth bared, but you dodge the attack lightly.";
+ break;
+ case 9:
+ mes "The unidentified creature runs at you with its teeth bared, but you dodge the attack sneering.";
+ break;
+ // Hit.
+ default:
+ specialeffect2 EF_HIT1;
+ set .@pc_hp, .@pc_hp - .@n_damage;
+ switch(.@miss) {
+ case 2: set .@str$,"leg. Its sharp teeth penetrate your legs."; break;
+ case 4: set .@str$,"arm. Its sharp teeth penetrate your arm."; break;
+ case 6: set .@str$,"toe. You feel like your toe is being cut off."; break;
+ case 10: set .@str$,"finger. You feel like your finger is being cut off."; break;
+ }
+ mes "The unidentified creature runs at you with its teeth bared, and bites your "+.@str$+" ^FF0000["+.@n_damage+"]^000000 damage received.";
+ break;
+ }
+ next;
+ break;
+ }
+ break;
+ case 3:
+ set .@defend, rand(1,10);
+ switch(.@npc_attack) {
+ case 1:
+ if (.@defend == 3 || .@defend == 6) {
+ set .@n_damage, .@n_damage / 2;
+ specialeffect2 EF_GUARD;
+ } else
+ specialeffect2 EF_ICEARROW;
+ set .@pc_hp, .@pc_hp - .@n_damage;
+ mes "[Defense of "+strcharinfo(0)+"]";
+ switch(.@defend) {
+ // Blocked.
+ case 3: set .@str$,"You block the stream of water with your strong butt. Feels refreshing. HP reduced only by half."; break;
+ case 6: set .@str$,"You block the stream of water with your strong hands. Your hands sting a little. HP reduced only by half."; break;
+ // Not blocked.
+ case 1: set .@str$,"You try to block the stream of water with your strong butt, but it's too late."; break;
+ case 2: set .@str$,"You try to block the stream of water with your big gut, but to no avail."; break;
+ case 4: set .@str$,"You try to block the stream of water with your gathered hands, but the creature targets a different place."; break;
+ case 5: set .@str$,"You try to block the stream of water with your strong hands, but you fail."; break;
+ case 7: set .@str$,"You try to block the stream of water with arms crossed, but you fold them wrong."; break;
+ case 8: set .@str$,"You try to block the stream of water with your rock-like head, but it was not possible."; break;
+ case 9: set .@str$,"You try to block the stream of water with your solid muscles, but it was not possible."; break;
+ case 10: set .@str$,"You try to block the stream of water with your strong feet, but your effort was wasted."; break;
+ }
+ mes .@str$+" ^FF0000["+.@n_damage+"]^000000 damage received.";
+ next;
+ break;
+ case 2:
+ if (.@defend == 1 || .@defend == 3 || .@defend == 5 || .@defend == 7) {
+ set .@n_damage, .@n_damage / 2;
+ specialeffect2 EF_GUARD;
+ } else
+ specialeffect2 EF_BASH;
+ set .@pc_hp, .@pc_hp - .@n_damage;
+ mes "[Defense of "+strcharinfo(0)+"]";
+ switch(.@defend) {
+ // Blocked.
+ case 1: set .@str$,"You block the dash attack with your fat butt. Your butt is world class. HP reduced only by half."; break;
+ case 3: set .@str$,"You block the dash attack with your big gut. Your gut is world class. HP reduced only by half."; break;
+ case 5: set .@str$,"You block the dash attack with your strong hands. Your hands are world class. HP reduced only by half."; break;
+ case 7: set .@str$,"The unidentified creature dashed with lightning speed, but you easily block the attack with your big gut. Your gut is world class. HP reduced only by half."; break;
+ // Not blocked.
+ case 2: set .@str$,"You try to block the dash attack with your fat butt, but miss and get hit in an unmentionable place."; break;
+ case 4: set .@str$,"You try to block the dash attack with your big gut, but your gut isn't big enough to absorb the impact."; break;
+ case 6: set .@str$,"You try to block the dash attack with arms crossed, but you feel an incredible force."; break;
+ case 8: set .@str$,"You try to block the dash attack, to no avail."; break;
+ case 9: set .@str$,"You try to block the dash attack with your strong hands, to no avail."; break;
+ case 10: set .@str$,"You try to block the dash attack with your durable feet, but the pain woke you up."; break;
+ }
+ mes .@str$+" ^FF0000["+.@n_damage+"]^000000 damage received.";
+ next;
+ break;
+ case 3:
+ if (.@defend == 2 || .@defend == 4 || .@defend == 6 || .@defend == 8) {
+ set .@n_damage, .@n_damage / 2;
+ specialeffect2 EF_GUARD;
+ }
+ set .@pc_hp, .@pc_hp - .@n_damage;
+ mes "[Defense of "+strcharinfo(0)+"]";
+ switch(.@defend) {
+ // Blocked.
+ case 2: set .@str$,"but you block its attack with a branch nearby. HP reduced only by half."; break;
+ case 4: set .@str$,"but you block its attack with a weapon. HP reduced only by half."; break;
+ case 6: set .@str$,"but you block its attack using skill ^0000FFFriend Shield^000000. HP reduced only by half."; break;
+ case 8: set .@str$,"but you block its attack using a book you always carry around. HP reduced only by half."; break;
+ // Not blocked.
+ case 1: set .@str$,"and bites your arm."; break;
+ case 3: set .@str$,"and bites your leg."; break;
+ case 5: set .@str$,"and bites your shoulder."; break;
+ case 7: set .@str$,"and bites your finger."; break;
+ case 9: set .@str$,"and bites your finger."; break;
+ case 10: set .@str$,"and bites your toe."; break;
+ }
+ mes "The unidentified creature runs at you with its teeth bared, "+.@str$+" ^FF0000["+.@n_damage+"]^000000 damage received.";
+ next;
+ break;
+ }
+ break;
+ case 4:
+ mes "You get scared of the unidentified creature, and attempt to run.";
+ next;
+ mes "["+strcharinfo(0)+"'s Escape]";
+ if (rand(1,2) == 1) {
+ mes "Fortunately ^BF2C15Unidentified creature^000000";
+ mes "did not come after you.";
+ close;
+ } else {
+ mes "When you attempt to run away, the unidentified creature sees you and attacks.";
+ mes "You fail to escape.";
+ next;
+ mes "The creature slams you with its tail. It's so painful that a tear rolls out of your eyes. ^FF000010^000000 damaged received.";
+ set .@pc_hp, .@pc_hp - 10;
+ next;
+ }
+ break;
+ }
+ callsub L_CheckPCAlive, .@pc_hp;
+ mes "[ Current Progress ]";
+ mes strcharinfo(0)+" HP = "+.@pc_hp;
+ mes "Unidentified Creature HP = "+.@npc_hp;
+ next;
+ }
+ end;
+L_CheckPCAlive:
+ if (getarg(0) <= 0) {
+ mes "You lost to the unidentified creature. Your mind goes blank and you faint.";
+ next;
+ mes "You leave the bath with somebody's help.";
+ percentheal -99,0;
+ donpcevent "Black Shadow#ep14_muk::OnDisable";
+ warp "mora",31,132;
+ end;
+ }
+ return;
+OnInit:
+ disablenpc "Black Shadow#ep14_muk";
+ end;
+OnEnable:
+ enablenpc "Black Shadow#ep14_muk";
+ disablenpc "???#ep14_muk01";
+ disablenpc "???#ep14_muk02";
+ disablenpc "???#ep14_muk03";
+ disablenpc "???#ep14_muk04";
+ disablenpc "???#ep14_muk05";
+ end;
+OnDisable:
+ disablenpc "Black Shadow#ep14_muk";
+ donpcevent "Black Shadow#ep14_muk::OnFullon";
+ mapannounce "mora","You can now use the mysterious power of bath water.",bc_map,"0xFFFF00"; //FW_NORMAL 12 0 0
+ end;
+OnFullon:
+ donpcevent "???#ep14_muk01::OnReset";
+ donpcevent "???#ep14_muk02::OnReset";
+ donpcevent "???#ep14_muk03::OnReset";
+ donpcevent "???#ep14_muk04::OnReset";
+ donpcevent "???#ep14_muk05::OnReset";
+ end;
+}
+
+- script ???#mora -1,{
+ if (checkquest(5019) > -1) {
+ mes "You find an area emitting a distinct aura.";
+ mes "You may be able to collect bath water samples.";
+ mes "What will you do?";
+ next;
+ if(select("Collect samples.:Leave.") == 2) {
+ donpcevent strnpcinfo(0)+"::OnDisable";
+ end;
+ }
+ if (countitem(6386) >= 10) {
+ mes "You will not need additional samples.";
+ close2;
+ donpcevent strnpcinfo(0)+"::OnDisable";
+ end;
+ }
+ if (countitem(1092) == 0) {
+ mes "To obtain a sample, you need a sample tube.";
+ close2;
+ donpcevent strnpcinfo(0)+"::OnDisable";
+ end;
+ }
+ mes "Collecting samples.";
+ next;
+ progressbar "ffff00",3;
+ if (!rand(3)) {
+ if (checkweight(6386,1) == 0) {
+ mes "You have so many items";
+ mes "that it is difficult to collect samples.";
+ mes "You will have to lighten your load and come back.";
+ close2;
+ donpcevent strnpcinfo(0)+"::OnDisable";
+ end;
+ }
+ mes "Bath water sample collection complete.";
+ delitem 1092,1; //Empty_Cylinder
+ getitem 6386,1; //Bathtub_R_Sample
+ } else {
+ mes "Bath water sample collection failed.";
+ percentheal 5,5;
+ }
+ close2;
+ donpcevent strnpcinfo(0)+"::OnDisable";
+ end;
+ } else if (checkquest(5021) > -1 || checkquest(5022) > -1) {
+ if (checkquest(5021) > -1) {
+ set .@str$,"tooth";
+ set .@item,6387; //Teeth_Sample
+ } else {
+ set .@str$,"scale";
+ set .@item,6388; //Scale_Sample
+ }
+ mes "Something is shining in the water.";
+ mes "You may be able to collect the unidentified creature's "+.@str$+" samples.";
+ mes "What do you want to do?";
+ next;
+ if(select("Look further.:Leave.") == 2) {
+ donpcevent strnpcinfo(0)+"::OnDisable";
+ end;
+ }
+ if (countitem(.@item) >= 10) {
+ mes "You will not need additional samples.";
+ close2;
+ donpcevent strnpcinfo(0)+"::OnDisable";
+ end;
+ }
+ progressbar "ffff00",3;
+ if (!rand(3)) {
+ if (checkweight(.@item,1) == 0) {
+ mes "You have so many items";
+ mes "that it is difficult to collect samples.";
+ mes "You will have to lighten your load and come back.";
+ close;
+ }
+ mes "Obtained a "+.@str$+" sample";
+ mes "of the unidentified creature.";
+ getitem .@item,1;
+ } else
+ mes "You thought you saw it on the ground, but it was an illusion.";
+ close2;
+ donpcevent strnpcinfo(0)+"::OnDisable";
+ end;
+ } else {
+ mes "???";
+ next;
+ select("???");
+ mes "???";
+ close;
+ }
+ end;
+OnEnable:
+ enablenpc strnpcinfo(0);
+ stopnpctimer;
+ end;
+OnDisable:
+ disablenpc strnpcinfo(0);
+ initnpctimer;
+ end;
+OnReset:
+ if (rand(2))
+ donpcevent strnpcinfo(0)+"::OnEnable";
+ else
+ initnpctimer;
+ end;
+OnTimer10000:
+OnTimer20000:
+OnTimer30000:
+OnTimer40000:
+OnTimer50000:
+ if (rand(2))
+ donpcevent strnpcinfo(0)+"::OnEnable";
+ end;
+OnTimer60000:
+ donpcevent strnpcinfo(0)+"::OnEnable";
+ end;
+OnTouch:
+ if (checkquest(5034) == 2 || ep14_1_muk == 0 || rand(5)) {
+ percentheal 5,5;
+ end;
+ }
+ set .@playtime, checkquest(5029,PLAYTIME);
+ if (.@playtime == 0 || .@playtime == 1) {
+ percentheal 5,5;
+ end;
+ } else if (.@playtime == 2) {
+ erasequest 5029;
+ end;
+ } else {
+ mapannounce "mora","You can no longer use the mysterious power of the bath water.",bc_map,"0xFFFF00"; //FW_NORMAL 12 0 0
+ mes "^FF0000Something appeared.^000000";
+ mes "^FFFF00You cannot use the mysterious power of the bath water.^000000";
+ close2;
+ donpcevent "Black Shadow#ep14_muk::OnEnable";
+ end;
+ }
+}
+mora,108,86,0 duplicate(???#mora) ???#ep14_muk01 844,2,2
+mora,107,82,0 duplicate(???#mora) ???#ep14_muk02 844,2,2
+mora,113,84,0 duplicate(???#mora) ???#ep14_muk03 844,2,2
+mora,116,81,0 duplicate(???#mora) ???#ep14_muk04 844,2,2
+mora,118,86,0 duplicate(???#mora) ???#ep14_muk05 844,2,2
+
+- script #mora_puddle -1,{
+ set .@i, atoi(charat(strnpcinfo(2),9));
+
+ // This script has a lot of checks,
+ // so arrays are only set when used.
+ setarray .@quest1[1],5024,5025,5026,5027;
+ setarray .@dir$[1],"east","west","south","north";
+
+ if (checkquest(.@quest1[.@i]) > -1) {
+ if (countitem(6389) == 0) {
+ mes "This appears to be the puddle to the "+.@dir$[.@i];
+ mes "that the researcher talked about.";
+ mes "Will you collect a sample?";
+ next;
+ if(select("Collect a sample.:Don't collect a sample.") == 2)
+ close;
+ if (countitem(1092) == 0) {
+ mes "You have no empty sample tubes.";
+ close;
+ }
+ progressbar "ffff00",5;
+ if (checkweight(6389,1) == 0) {
+ mes "You have so many items";
+ mes "that it is difficult to collect samples.";
+ mes "You will have to lighten your load and come back.";
+ close;
+ }
+ mes "You have collected a sample from the puddle to the "+.@dir$[.@i]+".";
+ delitem 1092,1; //Empty_Cylinder
+ getitem 6389,1; //Puddle_R_Sample
+ close;
+ } else {
+ mes "You already have a sample.";
+ close;
+ }
+ }
+
+ set .@quest1[0], .@quest1[.@i];
+ set .@dir$[0], .@dir$[.@i];
+ deletearray .@quest1[.@i],1;
+ deletearray .@dir$[.@i],1;
+
+ if (checkquest(.@quest1[1]) > -1 || checkquest(.@quest1[2]) > -1 || checkquest(.@quest1[3]) > -1) {
+ for(set .@j,1; .@j<=3; set .@j,.@j+1) {
+ if (checkquest(.@quest1[.@j]) > -1)
+ break;
+ }
+ mes "This is not the puddle to the "+.@dir$[.@j]+".";
+ close;
+ }
+
+ setarray .@quest2[1],5030,5031,5032,5033;
+ set .@quest2[0], .@quest2[.@i];
+ deletearray .@quest2[.@i],1;
+
+ if (ep14_1_goki == 30 && checkquest(.@quest2[0]) > -1) {
+ mes "You arrived at the puddle to the "+.@dir$[0]+".";
+ mes "You should look for the unidentified creature's family.";
+ next;
+ mes "["+strcharinfo(0)+"]";
+ mes "Fish~ Fish~";
+ next;
+ mes "When you called out, an answer came";
+ mes "from the puddle.";
+ next;
+ mes "[???]";
+ mes "Who? Fisher? Go!";
+ next;
+ select("I'm looking for a particular fish's family.");
+ mes "[???]";
+ mes "Family? What be that fish name?";
+ next;
+ mes "What was the name of the unidentified creature?";
+ next;
+ input .@inputstr$;
+ if (.@inputstr$ != "Fishee") {
+ mes "[???]";
+ mes "No Family. "+.@inputstr$+" No.";
+ mes "You go.";
+ next;
+ mes "It appears that the unidentified creature's family is not here.";
+ close;
+ }
+ mes "[???]";
+ mes .@inputstr$+"? Oh... How...";
+ mes "Husband here come. Your son.";
+ mes "News here.";
+ next;
+ mes "Another creature from the puddle spoke to you.";
+ next;
+ mes "[????]";
+ mes "What? Missing son news?";
+ next;
+ mes "The two fish were very excited,";
+ mes "and their conversation was hard to follow.";
+ mes "You waited for them to calm down";
+ mes "and told them the full story.";
+ next;
+ mes "[Fishee's Dad]";
+ mes "Yes... At night, son";
+ mes "gone... Night fishers.";
+ mes "Son stupid. Caught. Dead. OK.";
+ next;
+ mes "[Fishee's Mom]";
+ mes "Fishee alive. Great. Great.";
+ next;
+ mes "[Fishee's Dad]";
+ mes "Yes... Human give son news.";
+ mes "Thanks. Son,";
+ mes "We okay. Happy. Here. You tell son.";
+ changequest .@quest2[0],5034;
+ close;
+ } else if (checkquest(5034) > -1 && checkquest(5034) < 2) {
+ mes "[Fishee's Dad]";
+ mes "Yes... Human give son news.";
+ mes "Thanks. Son,";
+ mes "We okay. Happy. Here. You tell son.";
+ close;
+ } else if (checkquest(.@quest2[1]) > -1 || checkquest(.@quest2[2]) > -1 || checkquest(.@quest2[3]) > -1) {
+ mes "You arrived at the puddle to the "+.@dir$[0]+".";
+ mes "You should look for the unidentified creature's family.";
+ next;
+ mes "["+strcharinfo(0)+"]";
+ mes "Fish~ Fish~";
+ next;
+ mes "You yelled out loud for fish,";
+ mes "but there is no response.";
+ mes "I don't think anybody lives";
+ mes "in this puddle.";
+ close;
+ }
+ mes "You see a puddle with a calm surface.";
+ close;
+}
+bif_fild02,315,285,0 duplicate(#mora_puddle) Puddle#ep14_muk01 844
+bif_fild02,65,109,0 duplicate(#mora_puddle) Puddle#ep14_muk02 844
+bif_fild02,223,71,0 duplicate(#mora_puddle) Puddle#ep14_muk03 844
+bif_fild02,113,340,0 duplicate(#mora_puddle) Puddle#ep14_muk04 844
+
+// Mora Daily Quests :: dealer
+//============================================================
+mora,133,80,6 script Elephantine#pa0829 509,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ if (ep14_1_mistwoods < 10) {
+ mes "[Elephantine]";
+ mes "Hmm, you don't look reliable enough to perform tasks for me.";
+ close;
+ }
+ if (BaseLevel < 135) {
+ mes "[Elephantine]";
+ mes "Why don't you come back when you've grown stronger? I can't give you tasks when you're in your current state.";
+ close;
+ }
+ set .@playtime, checkquest(12230,PLAYTIME);
+ if (.@playtime == 0 || .@playtime == 1) {
+ mes "[Elephantine]";
+ mes "I have no additional tasks available now. If I get some, I'll let you know when you come back.";
+ close;
+ } else if (.@playtime == 2) {
+ mes "[Elephantine]";
+ mes "Will you please check with ^990099Hotcha^000000";
+ mes "on the details of the previous task?";
+ close;
+ }
+ mes "[Elephantine]";
+ mes "Welcome.";
+ mes "I have some tasks for you - will you take a look at them?";
+ next;
+ if(select("What kind of tasks do you have for me?:Tell me about today's task.") == 1) {
+ mes "[Elephantine]";
+ mes "I'm the Head of the Volunteer Patrol of the Village of Mora. It didn't used to be like this, he he.";
+ next;
+ mes "[Elephantine]";
+ mes "Each day, I'll be giving you a quest to kill off monsters in the surrounding area.";
+ next;
+ mes "[Elephantine]";
+ mes "You might get a task that's far too difficult for you to take care of alone - in that case, try to get help from your fellow adventurers.";
+ close;
+ }
+ mes "[Elephantine]";
+ mes "Let me see what tasks we've got today... Hmm...";
+ next;
+ mes "[Elephantine]";
+ mes "How about this one?";
+ next;
+ switch(rand(1,5)) {
+ case 1:
+ setquest 12225;
+ setquest 12230;
+ mes "[Elephantine]";
+ mes "Strange insects that carry fruit on their backs roam this area - you must've seen them.";
+ next;
+ mes "[Elephantine]";
+ mes "I'd like you to take them out as you see them, before they try to sell anything to the adventurers lost in the forest.";
+ set .@n$,"Fruit-Carrying Insects";
+ break;
+ case 2:
+ setquest 12226;
+ setquest 12230;
+ mes "[Elephantine]";
+ mes "There have been a lot of reports lately about mantises disguised as flowers attacking creatures passing by.";
+ next;
+ mes "[Elephantine]";
+ mes "No casualties have been reported yet, but it wouldn't hurt to take precautions. Please deal with them appropriately.";
+ set .@n$,"Flowery Hunters";
+ break;
+ case 3:
+ setquest 12227;
+ setquest 12230;
+ mes "[Elephantine]";
+ mes "An adventurer was reported to have been attacked by little birds while gathering resources in the vicinity of Bifrost.";
+ next;
+ mes "[Elephantine]";
+ mes "They didn't look so ferocious... but the adventurer has asked me to get rid of them, so you'll have to do it.";
+ set .@n$,"Small but Ferocious...";
+ break;
+ case 4:
+ setquest 12228;
+ setquest 12230;
+ mes "[Elephantine]";
+ mes "I have qualms about this one, but somebody anonymously asked me to hunt down the naughty fairies.";
+ next;
+ mes "[Elephantine]";
+ mes "I don't know what grudge he has against the fairies, but a request is a request.";
+ set .@n$,"An Unknown Grudge";
+ break;
+ case 5:
+ setquest 12229;
+ setquest 12230;
+ mes "[Elephantine]";
+ mes "Would you believe it if I said there are balls of blonde hair rolling around? You wouldn't, would you?";
+ next;
+ mes "[Elephantine]";
+ mes "They don't seem so dangerous, but they are reported to steal books and sweets from adventurers. Please deal with them appropriately.";
+ set .@n$,"Blondie Ann";
+ break;
+ }
+ next;
+ mes "You have received the task ^005500"+.@n$+"^000000. Open and see the quest window for the details.";
+ close;
+}
+
+mora,115,98,8 script Hotcha#pa0829 509,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ if (ep14_1_mistwoods < 10) {
+ mes "[Hotcha]";
+ mes "Hmm, you don't look reliable enough for Elephantine's tasks.";
+ close;
+ }
+ if (BaseLevel < 97) {
+ mes "[Hotcha]";
+ mes "This place is like a paradise for adventurers. Not for weak ones like you, though.";
+ close;
+ }
+ set .@playtime, checkquest(12230,PLAYTIME);
+ if (.@playtime == -1) {
+ mes "[Hotcha]";
+ mes "I see you haven't received";
+ mes "any tasks yet.";
+ mes "Go talk to Elephantine,";
+ mes "and Elephantine will give you";
+ mes "one of the countless tasks.";
+ close;
+ } else if (.@playtime == 2) {
+ mes "[Hotcha]";
+ mes "The time is up to complete the existing tasks.";
+ next;
+ mes "[Hotcha]";
+ mes "If you have any unfinished tasks in your quest log, they are considered 'failed' and removed from the log.";
+ next;
+ mes "[Hotcha]";
+ mes "Once they are removed, go talk to Elephantine and you can receive new tasks.";
+ for(set .@i,12225; .@i<=12229; set .@i,.@i+1) {
+ if (checkquest(.@i) > -1)
+ erasequest .@i;
+ }
+ erasequest 12230;
+ close;
+ }
+ mes "[Hotcha]";
+ mes "Welcome.";
+ mes "How may I help you?";
+ next;
+ select("I have completed a task.");
+ mes "Oh.";
+ mes "Have you?";
+ mes "Please wait a minute while I check the documents.";
+ next;
+
+ for(set .@i,12225; .@i<=12229; set .@i,.@i+1) {
+ if (checkquest(.@i,HUNTING) == 2) {
+ mes "[Hotcha]";
+ mes "Yes, I see you've completed the task. It has been confirmed as completed.";
+ erasequest .@i;
+ specialeffect2 EF_STEAL;
+ if (BaseLevel > 99)
+ getexp 0, ((JobLevel < 50)?JobLevel * JobLevel * (110/100) * 50:0);
+ else
+ getexp 0, ((JobLevel < 70)?JobLevel * JobLevel * (110/100) * 10:0);
+ getitem 6380,3; //Mora_Coin
+ close;
+ }
+ }
+
+ mes "[Hotcha]";
+ mes "Hmm... "+strcharinfo(0)+".";
+ mes "It may be a documentation error, but according to the documents, you have nothing to do with the tasks.";
+ close;
+}
+
+mora,119,103,4 script Bow-wow#pa0829 513,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ if (ep14_1_mistwoods < 10) {
+ mes "[Bow-wow]";
+ mes "I try to give tasks only to reliable people. You are......... no, never mind.";
+ close;
+ }
+ if (BaseLevel < 97) {
+ mes "[Bow-wow]";
+ mes "You really have no clue. What could you do with such a weak body?";
+ close;
+ }
+ set .@playtime, checkquest(12241,PLAYTIME);
+ if (.@playtime == 0 || .@playtime == 1) {
+ mes "[Bow-wow]";
+ mes "I have no additional tasks available now. If I get some, I'll let you know when you come back.";
+ close;
+ } else if (.@playtime == 2) {
+ mes "[Bow-wow]";
+ mes "Will you please check with the ^990099General Goods Dealer^000000";
+ mes "on the details of the previous task?";
+ close;
+ }
+ mes "[Bow-wow]";
+ mes "Welcome.";
+ mes "I have some tasks for you - will you take a look at them?";
+ next;
+ if(select("What kind of tasks do you have for me?:Tell me about today's task.") == 1) {
+ mes "[Bow-wow]";
+ mes "Here, we make all kinds of supplies for adventurers.";
+ next;
+ mes "[Bow-wow]";
+ mes "We accept raw materials for the supplies once a day.";
+ next;
+ mes "[Bow-wow]";
+ mes "Sometimes, we might ask for materials that are very difficult to obtain. In that case, try to get help from your fellow adventurers.";
+ close;
+ }
+ mes "[Bow-wow]";
+ mes "Let me see... what supplies are we making today...?";
+ next;
+ mes "[Bow-wow]";
+ mes "How about this one?";
+ next;
+ switch(rand(1,5)) {
+ case 1:
+ setquest 12231;
+ setquest 12241;
+ mes "[Bow-wow]";
+ mes "The adventurers here make sure to bring with them, on their exploration to dungeons, a preservative to keep their food fresh. Do you know what the preservative is made from?";
+ next;
+ mes "[Bow-wow]";
+ mes "*grin* None other than... Insect Feelers! The General Goods Dealer there asked me to get four of them. I personally would not eat it for all the world...";
+ set .@n$,"Material for the Preservative";
+ break;
+ case 2:
+ setquest 12232;
+ setquest 12241;
+ mes "[Bow-wow]";
+ mes "These days, it's common for adventurers here to make talismans to protect themselves on their dangerous adventures. Like a kind of insurance.";
+ next;
+ mes "[Bow-wow]";
+ mes "Immortal Hearts seem to be all the rage lately. The General Goods Merchant asked me to get five of them.";
+ set .@n$,"A Symbol of Resistance";
+ break;
+ case 3:
+ setquest 12233;
+ setquest 12241;
+ mes "[Bow-wow]";
+ mes "They need tons of Rotten Bandages for making first aid bandages. They must have run out of new materials.";
+ next;
+ mes "[Bow-wow]";
+ mes "The client is the General Goods Merchant over there. Three bunches of them will be enough.";
+ set .@n$,"Material for First Aid Kits";
+ break;
+ case 4:
+ setquest 12234;
+ setquest 12241;
+ mes "[Bow-wow]";
+ mes "Symbols of strong warriors give adventurers great support on their journeys. That's why Orcish Vouchers sell like hotcakes.";
+ next;
+ mes "[Bow-wow]";
+ mes "The General Goods Dealer asked me to get three Orcish Vouchers, which are to be used to make symbols of courage.";
+ set .@n$,"Symbols of Courage";
+ break;
+ case 5:
+ setquest 12235;
+ setquest 12241;
+ mes "[Bow-wow]";
+ mes "It seems to be rumored among adventurers that drinking powdered bones mixed with water helps boost their stamina.";
+ next;
+ mes "[Bow-wow]";
+ mes "The General Goods Dealer asked me to get three Skel-Bones, which are to be used to make tonic.";
+ set .@n$,"Good for Stamina...";
+ break;
+ }
+ next;
+ mes "You have received the task ^880088"+.@n$+"^000000. Open and see the quest window for the details.";
+ close;
+}
+
+mora,119,118,4 script General Good Dealer#pa0 516,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ if (ep14_1_mistwoods < 10) {
+ mes "[General Good Dealer]";
+ mes "Hmm, you don't look reliable enough for Bow-wow's tasks.";
+ close;
+ }
+ if (BaseLevel < 97) {
+ mes "[General Good Dealer]";
+ mes "What could you do with that fragile body? Go get some exercise.";
+ close;
+ }
+ set .@playtime, checkquest(12241,PLAYTIME);
+ if (.@playtime == -1) {
+ mes "[General Good Dealer]";
+ mes "I see you haven't received";
+ mes "any tasks yet.";
+ mes "Go talk to Bow-wow,";
+ mes "and Bow-wow will give you";
+ mes "one of the countless tasks.";
+ close;
+ } else if (.@playtime == 2) {
+ mes "[General Good Dealer]";
+ mes "The time is up to complete the existing tasks.";
+ next;
+ mes "[General Good Dealer]";
+ mes "If you have any unfinished tasks in your quest log, they are considered 'failed' and removed from the log.";
+ next;
+ mes "[General Good Dealer]";
+ mes "Once they are removed, go talk to Bow-wow and you can receive new tasks.";
+ for(set .@i,12231; .@i<=12235; set .@i,.@i+1) {
+ if (checkquest(.@i) > -1)
+ erasequest .@i;
+ }
+ erasequest 12241;
+ close;
+ }
+ mes "[General Good Dealer]";
+ mes "Welcome.";
+ mes "How may I help you?";
+ next;
+ select("I have completed a task.");
+ mes "[General Good Dealer]";
+ mes "Oh.";
+ mes "Have you?";
+ mes "Please wait a minute while I check the documents.";
+ next;
+
+ callsub L_CheckQuest,12231,928,4; //Insect_Feeler
+ callsub L_CheckQuest,12232,929,5; //Immortal_Heart
+ callsub L_CheckQuest,12233,930,1; //Rotten_Bandage
+ callsub L_CheckQuest,12234,931,3; //Orcish_Voucher
+ callsub L_CheckQuest,12235,932,3; //Skel_Bone
+
+ mes "[General Good Dealer]";
+ mes "Hmm... "+strcharinfo(0)+".";
+ mes "It may be a documentation error, but according to the documents, you have nothing to do with the tasks.";
+ close;
+
+L_CheckQuest:
+ if (checkquest(getarg(0)) > -1) {
+ if (countitem(getarg(1)) < getarg(2)) {
+ mes "[General Good Dealer]";
+ mes "The amount is not enough...";
+ close;
+ }
+ mes "[General Good Dealer]";
+ mes "I've received the items all right. It will be some time before I have another task for you, so why don't you visit the hot spring and relax?";
+ delitem getarg(1),getarg(2);
+ erasequest getarg(0);
+ specialeffect2 EF_STEAL;
+ if (BaseLevel > 99)
+ getexp 0, ((JobLevel < 50)?JobLevel * JobLevel * (110/100) * 50:0);
+ else
+ getexp 0, ((JobLevel < 70)?JobLevel * JobLevel * (110/100) * 10:0);
+ getitem 6380,1; //Mora_Coin
+ close;
+ }
+ return;
+}
+
+mora,124,108,7 script Woof-grrr#pa0829 514,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ if (ep14_1_mistwoods < 10) {
+ mes "[Woof-grrr]";
+ mes "Can you please keep away from me? You're getting in the way.";
+ close;
+ }
+ if (BaseLevel < 97) {
+ mes "[Woof-grrr]";
+ mes "This place is not a nursery. Grow up and come back, and I'll gladly give you tasks.";
+ close;
+ }
+ set .@playtime, checkquest(12242,PLAYTIME);
+ if (.@playtime == 0 || .@playtime == 1) {
+ mes "[Woof-grrr]";
+ mes "I have no additional tasks available now. If I get some, I'll let you know when you come back.";
+ close;
+ } else if (.@playtime == 2) {
+ mes "[Woof-grrr]";
+ mes "Will you please check with the ^990099Commodities Dealer^000000, standing across from me,";
+ mes "on the details of the previous task?";
+ close;
+ }
+ mes "[Woof-grrr]";
+ mes "Nice to see you.";
+ mes "I have some tasks for you - will you take a look at them?";
+ next;
+ if(select("What kind of tasks do you have for me?:Tell me about today's task.") == 1) {
+ mes "[Woof-grrr]";
+ mes "Bow-wow and I are in the same industry.";
+ next;
+ mes "[Woof-grrr]";
+ mes "We are a manufacturer of adventurers' supplies.";
+ next;
+ mes "[Woof-grrr]";
+ mes "My tasks won't be easy - you'd better prepare yourself.";
+ close;
+ }
+ mes "[Woof-grrr]";
+ mes "Hmm... What tasks are at hand today?";
+ next;
+ mes "[Woof-grrr]";
+ mes "Oh. This one looks good.";
+ next;
+ switch(rand(1,5)) {
+ case 1:
+ setquest 12236;
+ setquest 12242;
+ mes "[Woof-grrr]";
+ mes "Some people just hang their talismans around their necks, but more people choose to seal them in special cases and carry them on their bodies.";
+ next;
+ mes "[Woof-grrr]";
+ mes "Mementos serve as inspirations for designers of those cases. The Commodities Dealer across from me asked me to get two of them.";
+ set .@n$,"The Latest Trend in Talismans";
+ break;
+ case 2:
+ setquest 12237;
+ setquest 12242;
+ mes "[Woof-grrr]";
+ mes "Adventurers make sure to keep their talismans safe, because they could save their lives.";
+ next;
+ mes "[Woof-grrr]";
+ mes "The Commodities Dealer across from me seems to make protective cases out of Shells. I was asked to get three of them.";
+ set .@n$,"Keep Your Valuables Safe";
+ break;
+ case 3:
+ setquest 12238;
+ setquest 12242;
+ mes "[Woof-grrr]";
+ mes "Adventurers that go into the bushes of the Maze of the Hazy Forest always wear knee protectors.";
+ next;
+ mes "[Woof-grrr]";
+ mes "The Commodities Dealer across from me asked me to get three Scale Shells, which are to be used to make knee protectors.";
+ set .@n$,"Material for Knee Protectors";
+ break;
+ case 4:
+ setquest 12239;
+ setquest 12242;
+ mes "[Woof-grrr]";
+ mes "I have a task for you at hand, making a vaccine for possible poisonous insects.";
+ next;
+ mes "[Woof-grrr]";
+ mes "The Commodities Dealer across from me asked me to get two Venom Canines, which are to be used in the research of the substance.";
+ set .@n$,"Poison for Poison...";
+ break;
+ case 5:
+ setquest 12240;
+ setquest 12242;
+ mes "[Woof-grrr]";
+ mes "It seems they have run out of the material for adding non-slip soles to shoes.";
+ next;
+ mes "[Woof-grrr]";
+ mes "The Commodities Dealer across from me commissioned me to get five globs of Sticky Mucus.";
+ set .@n$,"Don't Slip and Fall";
+ break;
+ }
+ next;
+ mes "You have received the task ^880088"+.@n$+"^000000. Open and see the quest window for the details.";
+ close;
+}
+
+mora,127,112,4 script Commodities Dealer#pa08 518,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ if (ep14_1_mistwoods < 10) {
+ mes "[Commodities Dealer]";
+ mes "Well, Woof-grrr can't have given a weakling like you tasks.";
+ close;
+ }
+ if (BaseLevel < 97) {
+ mes "[Commodities Dealer]";
+ mes "Go away! I can't concentrate on cataloging with you hanging around like that...";
+ close;
+ }
+ set .@playtime, checkquest(12242,PLAYTIME);
+ if (.@playtime == -1) {
+ mes "[Commodities Dealer]";
+ mes "I see you haven't received";
+ mes "any tasks yet.";
+ mes "Go talk to Woof-grrr,";
+ mes "and Woof-grrr will give you";
+ mes "one of the countless tasks.";
+ close;
+ } else if (.@playtime == 2) {
+ mes "[Commodities Dealer]";
+ mes "The time is up to complete the existing tasks.";
+ next;
+ mes "[Commodities Dealer]";
+ mes "If you have any unfinished tasks in your quest log, they are considered 'failed' and removed from the log.";
+ next;
+ mes "[Commodities Dealer]";
+ mes "Once they are removed, go talk to Woof-grrr and you can receive new tasks.";
+ for(set .@i,12236; .@i<=12240; set .@i,.@i+1) {
+ if (checkquest(.@i) > -1)
+ erasequest .@i;
+ }
+ erasequest 12242;
+ close;
+ }
+ mes "[Commodities Dealer]";
+ mes "Welcome.";
+ mes "How may I help you?";
+ next;
+ select("I have completed a task.");
+ mes "[Commodities Dealer]";
+ mes "Oh.";
+ mes "Have you?";
+ mes "Please wait a minute while I check the documents.";
+ next;
+
+ callsub L_CheckQuest,12236,934,2; //Mementos
+ callsub L_CheckQuest,12237,935,3; //Shell
+ callsub L_CheckQuest,12238,936,3; //Scales_Shell
+ callsub L_CheckQuest,12239,937,2; //Posionous_Canine
+ callsub L_CheckQuest,12240,938,5; //Sticky_Mucus
+
+ mes "[Commodities Dealer]";
+ mes "Hmm... "+strcharinfo(0)+".";
+ mes "It may be a documentation error, but according to the documents, you have nothing to do with the tasks.";
+ close;
+
+L_CheckQuest:
+ if (checkquest(getarg(0)) > -1) {
+ if (countitem(getarg(1)) < getarg(2)) {
+ mes "[Commodities Dealer]";
+ mes "The amount is not enough...";
+ close;
+ }
+ mes "[Commodities Dealer]";
+ mes "I've received the items all right. I look forward to working with you again.";
+ delitem getarg(1),getarg(2);
+ erasequest getarg(0);
+ specialeffect2 EF_STEAL;
+ if (BaseLevel > 99)
+ getexp 0, ((JobLevel < 50)?JobLevel * JobLevel * (110/100) * 50:0);
+ else
+ getexp 0, ((JobLevel < 70)?JobLevel * JobLevel * (110/100) * 10:0);
+ getitem 6380,1; //Mora_Coin
+ close;
+ }
+ return;
+}
+
+mora,170,101,4 script Soul Guide#pa0829 515,{
+ if (checkweight(1201,1) == 0) {
+ mes "You have too many kinds of things with you to do that. Throw out some of them and try again.";
+ close;
+ }
+ if (MaxWeight - Weight < 1000) {
+ mes "You are carrying too much weight to do that. Reduce the weight and try again.";
+ close;
+ }
+ if (ep14_1_mistwoods < 10) {
+ mes "[Soul Guide]";
+ mes "Reliability is the primary quality needed in looking for lost souls. You don't look so reliable to me.";
+ close;
+ }
+ if (BaseLevel < 97) {
+ mes "[Soul Guide]";
+ mes "You need to have a strong spirit to do this task. I think you need a lot more discipline.";
+ close;
+ }
+ set .@playtime, checkquest(12253,PLAYTIME);
+ if (.@playtime == 0 || .@playtime == 1) {
+ mes "You still have marks of the haunting souls on your body.";
+ next;
+ mes "You'll have to come back when the marks have disappeared.";
+ close;
+ } else if (.@playtime == 2) {
+ mes "You feel your mind has calmed down once again. You now have enough energy to go look for other souls, so talk to the Guide again.";
+ for(set .@i,12243; .@i<=12252; set .@i,.@i+1) {
+ if (checkquest(.@i) > -1)
+ erasequest .@i;
+ }
+ erasequest 12253;
+ close;
+ }
+ mes "[Soul Guide]";
+ mes "Welcome.";
+ mes "Are you ready?";
+ next;
+ if(select("What kind of tasks do you have for me?:Tell me about today's task.") == 1) {
+ mes "[Soul Guide]";
+ mes "My job is to gather the remains of the souls haunting the forest and put them to rest.";
+ next;
+ mes "[Soul Guide]";
+ mes "There are countless souls trapped in the Maze.";
+ next;
+ mes "[Soul Guide]";
+ mes "Help them get their long-deserved rest.";
+ close;
+ }
+ mes "[Soul Guide]";
+ mes "I'll show you the details of one of the lost souls.";
+ next;
+ switch(rand(1,10)) {
+ case 1:
+ setquest 12243;
+ setquest 12253;
+ mes "^660066Age 32. Comes from Midgard. Has been missing for 3 months since he went to the Maze of the Hazy Forest in order to collect the native plants. Low chance of survival.^000000";
+ set .@n$,"Tazar";
+ break;
+ case 2:
+ setquest 12244;
+ setquest 12253;
+ mes "^660066Age 19. Adventurer who came from a far, unknown place by ship. Been missing for 2 months since he went to explore the Maze dressed in thin tights, despite dissuasion of all Mora residents.";
+ mes "Even if he's alive, he would cause trouble to the rescue team.^000000";
+ set .@n$,"Niger";
+ break;
+ case 3:
+ setquest 12245;
+ setquest 12253;
+ mes "^660066Age unknown. Has some mental illness. Went alone in order to purify the Maze of the Hazy forest. He insists that he has good ancestry but no one trusts him.";
+ mes "Disappearance period : 12 years. Not much chance of survival.^000000";
+ set .@n$,"Messil";
+ break;
+ case 4:
+ setquest 12246;
+ setquest 12253;
+ mes "^660066Age 51. Used to be a big thief who stole famous swords from all around the world.";
+ mes "Went missing in the Maze after being pursued for running an illegal casino house which caused massive casualties in his final years. Low chance of survival.^000000";
+ set .@n$,"Noirit";
+ break;
+ case 5:
+ setquest 12247;
+ setquest 12253;
+ mes "^660066Age 22. An apprentice of an airship pilot. He has gone missing while drinking in Mora town, where he went for a break.";
+ mes "Rumor has it that he fled after signing somewhere. Disappearance period : 4 months. Low chance of survival.^000000";
+ set .@n$,"Pajama Sin";
+ break;
+ case 6:
+ setquest 12248;
+ setquest 12253;
+ mes "^660066Age Unknown. A female with long hair, dressed in black. Went on an expedition to the forest of the Maze in search of eternal life. Disappearance period : 3 months. Low chance of survival.^000000";
+ set .@n$,"Mendel";
+ break;
+ case 7:
+ setquest 12249;
+ setquest 12253;
+ mes "^660066Age around 50. The current Mayor of the Mora village. He ran away to the Forest of Maze after being caught pocketing profits by cheating the residents. Survival uncertain.^000000";
+ set .@n$,"Milebit";
+ break;
+ case 8:
+ setquest 12250;
+ setquest 12253;
+ mes "^660066Age 29. A young man with an unknown background.";
+ mes "Fled to the forest of maze after scamming 1200 Mora coins from Mora residents while pretending to start a lot of business and adapting himself in Mora. Survival uncertain.^000000";
+ set .@n$,"Kunmoon";
+ break;
+ case 9:
+ setquest 12251;
+ setquest 12253;
+ mes "^660066Age 34. Flirted with several women in Mora. Fled from Mora villagers to the forest of maze. Survival uncertain.^000000";
+ set .@n$,"Chaihokin";
+ break;
+ case 10:
+ setquest 12252;
+ setquest 12253;
+ mes "^660066Age Unknown. Disappered with coins which were joint controlled by the villagers. Low chance of survival.^000000";
+ set .@n$,"Tual";
+ break;
+ }
+ next;
+ mes "^990099Information on missing person "+.@n$+"^000000 has been found. Check your Quest Window for further information.";
+ specialeffect2 EF_STEAL;
+ close;
+}
+
+mora,131,165,7 script Wandering Customer#pa082 520,{
+ mes "[Wandering Customer]";
+ mes "I don't know whether to believe this art dealer... He made me stand here like this for days.... Ah... I feel dizzy.";
+ close;
+}
+
+mora,125,174,2 script A Random Customer#pa0829 520,{
+ mes "[Naive Customer]";
+ mes "I don't know when carving my pendant will be completed. Since he is a reliable art dealer, I suppose he won't break my pendant.";
+ close;
+}
+
+mora,104,172,7 script Victim#pa0829 520,{
+ mes "[Victim]";
+ mes "You Bastard! I want my rugged outwear! That was passed on to me by my father *SOB*";
+ next;
+ mes "^990099 It seems that he has gotten a great deal of damage from the art dealer.^000000";
+ close;
+}
+
+// Mora Daily Quests - Souls :: md_cadaver_in
+//============================================================
+// callfunc "mora_remains",<quest ID>,<NPC name>,<Mora Coin amount>,<reward ID>,<max reward amount>;
+function script mora_remains {
+ if (MaxWeight - Weight < 1000) {
+ mes "You have to make space in your inventory.";
+ close;
+ }
+ if (checkquest(getarg(0)) > -1) {
+ specialeffect2 EF_BLIND;
+ specialeffect2 EF_BEGINSPELL;
+ progressbar "ffff00",4;
+ erasequest getarg(0);
+ mes "These must be ["+getarg(1)+"]'s Remains. So carefully gather his remains.";
+ specialeffect2 EF_STEAL;
+ getitem getarg(3), rand(1,getarg(4));
+ if (rand(10)) {
+ next;
+ mes "You picked up "+getarg(2)+" Mora Coins next to the remains.";
+ specialeffect2 EF_STEAL;
+ getitem 6380,getarg(2); //Mora_Coin
+ }
+ close;
+ }
+ mes "You see traces of recent digging.";
+ close;
+}
+1@mist,132,100,0 script Tazaar's Remains#33 844,{ callfunc "mora_remains",12243,"Tazaar",6,526,3; } //Royal_Jelly
+1@mist,102,242,0 script Naizar's Remains#33 844,{ callfunc "mora_remains",12244,"Naizar",5,942,17; } //Yoyo_Tail
+1@mist,145,245,0 script Meshir's Remains#33 844,{ callfunc "mora_remains",12245,"Meshir",5,943,4; } //Solid_Shell
+1@mist,196,276,0 script Noirit's Remains#33 844,{ callfunc "mora_remains",12246,"Noirit",6,549,3; } //Nice_Sweet_Potato
+1@mist,304,327,0 script Pajama God's Remains#33 844,{ callfunc "mora_remains",12247,"Pajama God",5,945,18; } //Raccoon_Leaf
+1@mist,334,287,0 script Mendel's Remains#33 844,{ callfunc "mora_remains",12248,"Mendel",7,946,31; } //Snail's_Shell
+1@mist,330,177,0 script Milebit's Remains#33 844,{ callfunc "mora_remains",12249,"Milebit",5,7008,17; } //Stiff_Horn
+1@mist,284,84,0 script Kunmun's Remains#33 844,{ callfunc "mora_remains",12250,"Kunmun",4,6380,20; } //Mora_Coin
+1@mist,170,54,0 script Tsaihokin's Remains#33 844,{ callfunc "mora_remains",12251,"Tsaihokin",2,929,5; } //Immortal_Heart
+1@mist,118,43,0 script Tuar's Remains#33 844,{ callfunc "mora_remains",12252,"Tuar",3,6380,20; } //Mora_Coin
+
+// Knights of the Neighborhood :: mora_knight
+//============================================================
+mora,118,166,6 script Knights Chief#mo 525,{
+ mes "[Order of the Knights Chief]";
+ mes "We are the legendary order of the Neighborhood Knights, founded just five minutes ago!";
+ next;
+ mes "[Order of the Knights Chief]";
+ mes "We have four chiefs but no foot soldiers...";
+ mes "It's so frustrating!";
+ next;
+ mes "[Other Leaders]";
+ mes "Those other guys are all soldiers, but I'm the Boss!";
+ mes "I, the Head, will tell you what to do!";
+ mes "The Leader is the highest in the rank!";
+ mes "You talked me into joining the order, and now look at this!";
+ close;
+}
+
+mora,116,165,5 script Knights Boss#mo 524,{
+ set .@playtime, checkquest(1119,PLAYTIME);
+ if (.@playtime == 0 || .@playtime == 1) {
+ mes "[Order of the Knights Boss]";
+ mes "We've run out of Mora Coins.";
+ mes "Come back tomorrow!";
+ close;
+ } else if (.@playtime == 2)
+ erasequest 1119;
+ if (checkweight(6380,1) == 0) {
+ mes "[Order of the Knights Boss]";
+ mes "You have a lot of things with you!";
+ mes "Why not dump some of them in my pocket?";
+ close;
+ }
+ if (countitem(12561) >= 200) {
+ mes "[Order of the Knights Boss]";
+ mes "So you've brought back";
+ mes "200 ^FF0000Mysterious Seeds^000000.";
+ mes "Are you working under my command?";
+ mes "I'm so confused";
+ mes "because I've been sending random people on errands.";
+ next;
+ mes "[Order of the Knights Boss]";
+ mes "I'll reward you as I promised.";
+ mes "You made sure everyone knows";
+ mes "it's the Order of the Neighborhood Knights's work, right?";
+ setquest 1119;
+ delitem 12561,200; //Mysterious_Seed
+ getitem 6380,1; //Mora_Coin
+ close;
+ }
+ mes "[Order of the Knights Boss]";
+ mes "You have courage to";
+ mes "show up out of nowhere";
+ mes "and demand Mora Coins... how impressive!";
+ mes "You're more than qualified to be a soldier of the Order of the Neighborhood Knights.";
+ next;
+ mes "[Order of the Knights Boss]";
+ mes "Soldier, I need you to do something for me.";
+ mes "Go to the Hazy Forest and gather 200 ^FF0000Mysterious Seeds^000000!";
+ next;
+ switch(select("Yes, sir!:I challenge you to a duel!")) {
+ case 1:
+ mes "[Order of the Knights Boss]";
+ mes "Good attitude, "+strcharinfo(0)+" Soldier!";
+ mes "I'll reward you handsomely when you get back.";
+ next;
+ mes "[Other Bosses]";
+ mes "This is from me, the Chief!";
+ mes "Don't look down on the Head!";
+ mes "It's from me, the Leader!";
+ close;
+ case 2:
+ mes "[Order of the Knights Boss]";
+ mes "See the Chief if you want to have a duel!";
+ mes "I'm in charge of recruiting here.";
+ mes "Ahem...";
+ close;
+ }
+}
+
+mora,114,163,5 script Knights Head#mo 522,{
+ if (checkweight(6380,1) == 0) {
+ mes "[Order of the Knights Head]";
+ mes "You have a lot of things with you!";
+ mes "Why not dump some of them in my pocket?";
+ close;
+ }
+ if (ep14_1_rope < 11) {
+ mes "[Order of the Knights Head]";
+ mes "I hear that a Laphine called 'Lope'";
+ mes "went missing in the Hazy Forest.";
+ mes "I wish the Order of the Neighborhood Knights";
+ next;
+ mes "[Order of the Knights Head]";
+ mes "could help solve the case,";
+ mes "but we can't now";
+ mes "because we're not done cleaning the yard yet.";
+ mes "So, what I'm trying to say is";
+ next;
+ mes "[Order of the Knights Head]";
+ mes "why don't you go";
+ mes "and deal with the problem";
+ mes "on behalf of the Order of the Neighborhood Knights!";
+ next;
+ mes "[Order of the Knights Head]";
+ mes "I promise, as the Head of the Order,";
+ mes "that I'll give you more work";
+ mes "when you get back!";
+ next;
+ mes "[Other Heads]";
+ mes "I approve it, as the Chief.";
+ mes "You can thank me, the Boss.";
+ mes "You know the Leader is the boss here, right?";
+ close;
+ } else if (ep14_1_rope == 11) {
+ mes "[Order of the Knights Head]";
+ mes "So the missing Laphine";
+ mes "is dead?";
+ mes "I'm sorry to hear that.";
+ mes "I could have saved him.";
+ next;
+ mes "[Order of the Knights Head]";
+ mes "I hear that there are more ^0000FFLope's Clues^000000";
+ mes "in the Hazy Forest.";
+ mes "Go look for the rest of them";
+ mes "and bring back about 30 of them.";
+ mes "They will make great souvenirs.";
+ next;
+ switch(select("Am I doing all the work here or what?:Yes, sir!")) {
+ case 1:
+ mes "[Order of the Knights Head]";
+ mes "So you've noticed it?";
+ mes "Darn! I should have given you work earlier!";
+ close;
+ case 2:
+ mes "[Order of the Knights Head]";
+ mes "It was worthwhile to have trained you after all.";
+ mes "I'm proud of you,"+strcharinfo(0)+" Soldier!";
+ next;
+ mes "[Other Heads]";
+ mes "I think you'll make a great right-hand man, the Chief.";
+ mes "I feel rewarded, as the Boss.";
+ mes "As the Leader, I'm so pleased to see you all improve.";
+ set ep14_1_rope,12;
+ setquest 1118;
+ close;
+ }
+ } else if (ep14_1_rope == 12) {
+ if (countitem(6383) < 30) {
+ mes "[Order of the Knights Head]";
+ mes "You still haven't gathered";
+ mes "^0000FFLope's Clues^000000?";
+ mes "I feel somewhat good,";
+ mes "because that's about what I expected out of you.";
+ close;
+ }
+ mes "[Order of the Knights Head]";
+ mes "So you've brought back ^0000FFLope's Clues^000000.";
+ mes "Let's see ...";
+ mes "Assemble, assemble";
+ mes "Attach, attach";
+ next;
+ mes "[Lope's Letter]";
+ mes "...a traveler... attacked...";
+ mes "...under disguise... deadly poison...";
+ mes "...the Village... in danger...";
+ next;
+ mes "[Order of the Knights Head]";
+ mes "What on earth does this mean?";
+ mes "Well done, anyway.";
+ mes "Cheer up, you will be a great head of the Knights like myself, someday.";
+ next;
+ mes "[Other Heads]";
+ mes "I'm not so sure!";
+ mes "It's too much for us.";
+ mes "It's no use trying to do it.";
+ completequest 1118;
+ delitem 6383,30; //Clue_Of_Lope
+ set ep14_1_rope,13;
+ getitem 6380,2; //Mora_Coin
+ getexp 1000000,1000000;
+ close;
+ } else if (ep14_1_rope > 12) {
+ mes "[Order of the Knights Head]";
+ mes "We're in trouble.";
+ mes "We're sick of being knights.";
+ mes "We're thinking of forming";
+ mes "a circus troupe instead.";
+ mes "Are you interested in trying tightrope walking?";
+ next;
+ switch(select("Well, I could do a fire show.:This is so absurd.")) {
+ case 1:
+ mes "[Order of the Knights Head]";
+ mes "No, it's impossible.";
+ mes "I burned down a few houses";
+ mes "playing with fire.";
+ close;
+ case 2:
+ mes "[Order of the Knights Head]";
+ mes "That's the answer I expected.";
+ mes "I'm proud of myself.";
+ close;
+ }
+ close;
+ }
+ end;
+}
+
+mora,112,161,5 script Knights Leader#mo 523,{
+ mes "[Order of the Knights Leader]";
+ mes "I'm the Leader of the Order -";
+ mes "you can tell me.";
+ mes "What brings you here? Do you have some work for us?";
+ next;
+ mes "[Other Leaders]";
+ mes "Huh! I said the Boss is the boss!";
+ mes "No, the Chief is the best!";
+ mes "How rude you all are! I'm the Head here!";
+ emotion e_swt2,1;
+ close;
+}
diff --git a/npc/re/quests/quests_veins.txt b/npc/re/quests/quests_veins.txt
index b4be40067..3478fe16b 100644
--- a/npc/re/quests/quests_veins.txt
+++ b/npc/re/quests/quests_veins.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Quest NPCs located in Veins
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Quests related to Veins.
//===== Additional Comments: =================================
diff --git a/npc/re/quests/skills/sage_skills.txt b/npc/re/quests/skills/sage_skills.txt
new file mode 100644
index 000000000..64ebe20e3
--- /dev/null
+++ b/npc/re/quests/skills/sage_skills.txt
@@ -0,0 +1,53 @@
+//===== Hercules Script ======================================
+//= Sage Quest Skill's related NPCs
+//===== By: ==================================================
+//= Zopokx
+//===== Current Version: =====================================
+//= 1.0
+//===== Description: =========================================
+//= Morocc/Payon Solution duplicate NPCs for Sage Quest Skill
+//===== Additional Comments: =================================
+//= 1.0 First version
+//============================================================
+
+moc_ruins,91,150,0 script Ponka-Hontas 93,{
+ mes "[Mage Guildsman]";
+ mes "Would you like a Solution? Then please give me 50 Zeny and at least 1 Empty Testtube.";
+ next;
+ if (select("Alright, Deal.:Nah, forget it.") == 1) {
+ mes "[Mage Guildsman]";
+ if (zeny < 50) {
+ mes "I'm sorry, but you don't have enough money to cover the 50 Zeny fee.";
+ close;
+ }
+ if (countitem(1092) == 0) {
+ mes "You can't carry liquids without using a bottle. Bring an Empty Test Tube the next time you see me.";
+ close;
+ }
+ delitem 1092,1; //Empty_Cylinder
+ set zeny,zeny-50;
+ getitem 1088,1; //Morocc_Potion
+ }
+ close;
+}
+
+pay_arche,122,100,0 script Dollshoi 88,{
+ mes "[Mage Guildsman]";
+ mes "You want a Solution? Hmm, give me 50 Zeny and at least 1 Empty Test Tube.";
+ next;
+ if (select("Alright, Deal.:Nah, forget it.") == 1) {
+ mes "[Mage Guildsman]";
+ if (Zeny < 50) {
+ mes "Hey! You don't have enough money to cover my 50 Zeny charge.";
+ close;
+ }
+ if (countitem(1092) == 0) {
+ mes "You can't carry solutions without a bottle! Bring me an Empty Test Tube.";
+ close;
+ }
+ delitem 1092,1; //Empty_Cylinder
+ set zeny,zeny-50;
+ getitem 1089,1; //Payon_Potion
+ }
+ close;
+}
diff --git a/npc/re/scripts_athena.conf b/npc/re/scripts.conf
index 47b2cb7e0..c1e40dae6 100644
--- a/npc/re/scripts_athena.conf
+++ b/npc/re/scripts.conf
@@ -13,6 +13,7 @@ npc: npc/re/cities/dicastes.txt
npc: npc/re/cities/izlude.txt
npc: npc/re/cities/jawaii.txt
npc: npc/re/cities/malangdo.txt
+npc: npc/re/cities/malaya.txt
npc: npc/re/cities/mora.txt
// --------------------------- Guides ---------------------------
@@ -33,6 +34,7 @@ npc: npc/re/guides/guides_juno.txt
npc: npc/re/guides/guides_lighthalzen.txt
npc: npc/re/guides/guides_louyang.txt
npc: npc/re/guides/guides_lutie.txt
+npc: npc/re/guides/guides_mora.txt
npc: npc/re/guides/guides_morroc.txt
npc: npc/re/guides/guides_moscovia.txt
npc: npc/re/guides/guides_niflheim.txt
@@ -50,10 +52,12 @@ npc: npc/re/merchants/3rd_trader.txt
npc: npc/re/merchants/diamond.txt
npc: npc/re/merchants/flute.txt
npc: npc/re/merchants/inn.txt
+npc: npc/re/merchants/quivers.txt
npc: npc/re/merchants/refine.txt
npc: npc/re/merchants/renters.txt
npc: npc/re/merchants/shops.txt
npc: npc/re/merchants/enchan_mal.txt
+npc: npc/re/merchants/enchan_mora.txt
npc: npc/re/merchants/coin_exchange.txt
// --------------------------- Others ---------------------------
@@ -84,5 +88,6 @@ npc: npc/re/quests/quests_izlude.txt
npc: npc/re/quests/quests_lighthalzen.txt
npc: npc/re/quests/quests_malangdo.txt
npc: npc/re/quests/quests_veins.txt
+npc: npc/re/quests/quests_mora.txt
npc: npc/re/quests/monstertamers.txt
npc: npc/re/quests/quests_13_1.txt
diff --git a/npc/re/scripts_main.conf b/npc/re/scripts_main.conf
index 2bca12324..fd393e5b7 100644
--- a/npc/re/scripts_main.conf
+++ b/npc/re/scripts_main.conf
@@ -1,15 +1,15 @@
// --------------------------------------------------------------
-// - rAthena Renewal Primary Scripts File -
+// - Hercules Renewal Primary Scripts File -
// --------------------------------------------------------------
-// The idea of this new system is to make scripts more organized
+// The idea of this new system is to make scripts more organized
// since the old system was rather messy with all the NPCs in one
// file. Now scripts are organized in to files arraged by type.
-// Custom scripts are now in scripts_custom.conf, all other
+// Custom scripts are now in scripts_custom.conf, all other
// scripts are deemed as 'official'. You should place your NPCs
// in to scripts_custom.conf to follow the trend.
//
// Thanks,
-// Ancyker and the rest of the rAthena Team
+// Ancyker and the rest of the Hercules Team
//
// Note: "Comments" are all text on the right side of a double slash "//"
// Whatever text is commented will not be parsed by the servers, and serves
@@ -26,7 +26,7 @@ npc: npc/other/Global_Functions.txt
npc: npc/other/CashShop_Functions.txt
// ------------------- Common Script Files ----------------------
-import: npc/scripts_athena.conf
+import: npc/scripts.conf
import: npc/scripts_guild.conf
import: npc/scripts_jobs.conf
import: npc/scripts_mapflags.conf
@@ -34,7 +34,7 @@ import: npc/scripts_monsters.conf
import: npc/scripts_warps.conf
// ------------------- Renewal Script Files ---------------------
-import: npc/re/scripts_athena.conf
+import: npc/re/scripts.conf
import: npc/re/scripts_jobs.conf
import: npc/re/scripts_monsters.conf
import: npc/re/scripts_warps.conf
diff --git a/npc/re/warps/cities/dewata.txt b/npc/re/warps/cities/dewata.txt
index 9ca29688c..4e7476ec8 100644
--- a/npc/re/warps/cities/dewata.txt
+++ b/npc/re/warps/cities/dewata.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Dewata Warp Script
//===== By: ==================================================
//= Chilly
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Warp Points for Dewata
//===== Additional Comments: =================================
diff --git a/npc/re/warps/cities/dicastes.txt b/npc/re/warps/cities/dicastes.txt
index d80e178a9..d2c84ad0a 100644
--- a/npc/re/warps/cities/dicastes.txt
+++ b/npc/re/warps/cities/dicastes.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= El Dicastes Warp Script
//===== By: ==================================================
//= Chilly, Muad_Dib
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Warp Points for El Dicastes
//===== Additional Comments: =================================
diff --git a/npc/re/warps/cities/eclage.txt b/npc/re/warps/cities/eclage.txt
index c67bf202f..0400489f5 100644
--- a/npc/re/warps/cities/eclage.txt
+++ b/npc/re/warps/cities/eclage.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Eclage Warp Script
//===== By: ==================================================
//= Chilly
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Warp Points for Eclage
//===== Additional Comments: =================================
diff --git a/npc/re/warps/cities/malaya.txt b/npc/re/warps/cities/malaya.txt
index 3a8b1002e..a792c4690 100644
--- a/npc/re/warps/cities/malaya.txt
+++ b/npc/re/warps/cities/malaya.txt
@@ -1,38 +1,94 @@
-//===== rAthena Script =======================================
-//= Malaya Port Warp Script
-//===== By: ==================================================
+//===== Hercules Script ======================================
+//= Mayala Port Town Warps
+//===== By: ==================================================
//= Chilly
-//===== Current Version: =====================================
-//= 1.0
-//===== Compatible With: =====================================
-//= rAthena SVN
-//===== Description: =========================================
-//= Warp Points for Malaya Port
-//===== Additional Comments: =================================
-//= 1.0 First Version.
-//============================================================
+//===== Current Version: =====================================
+//= 1.0a
+//===== Compatible With: =====================================
+//= Hercules
+//===== Description: =========================================
+//= Warps for Mayala Port Town.
+//===== Additional Comments: =================================
+//= 1.0 First Version [Chilly].
+//= 1.0a Updated the file with new / missing warps [Masao].
+//============================================================
+
+malaya,178,211,0 script malaya_inn 45,1,1,{
+ end;
+
+OnTouch:
+ if (malaya_hi < 10) {
+ mes "Door is closed. It seems keeping its eyes on you.";
+ close;
+ }
+ warp "ma_in01",24,80;
+ end;
+}
+
+malaya,112,212,0 script malaya_ws 45,1,1,{
+ end;
+
+OnTouch:
+ if (malaya_hi < 20) {
+ mes "Door is closed. It seems keeping its eyes on you.";
+ close;
+ }
+ warp "ma_in01",83,16;
+ end;
+}
+
+malaya,299,167,0 script malaya_ts 45,1,1,{
+ end;
+
+OnTouch:
+ if (malaya_hi < 20) {
+ mes "Door is closed. It seems keeping its eyes on you.";
+ close;
+ }
+ warp "ma_in01",12,24;
+ end;
+}
+
+malaya,261,240,0 script malaya_shop 45,1,1,{
+ end;
+
+OnTouch:
+ if (malaya_hi < 20) {
+ mes "Door is closed. It seems keeping its eyes on you.";
+ close;
+ }
+ warp "ma_in01",126,20;
+ end;
+}
+
+malaya,300,211,0 script malaya_house01 45,1,1,{
+ end;
+
+OnTouch:
+ if (malaya_hi < 10) {
+ mes "Door is closed. It seems keeping its eyes on you.";
+ close;
+ }
+ warp "ma_in01",36,152;
+ end;
+}
// Town Warps
-malaya,309,70,0 warp malaya_field0001 1,1,ma_in01,108,92
-ma_in01,105,92,0 warp malaya_field0002 1,1,malaya,310,67
-malaya,300,211,0 warp malaya_field0003 1,1,ma_in01,36,152
-ma_in01,33,152,0 warp malaya_field0004 1,1,malaya,297,211
-malaya,178,211,0 warp malaya_field0005 1,1,ma_in01,24,80
-ma_in01,24,77,0 warp malaya_field0006 1,1,malaya,178,208
-malaya,112,212,0 warp malaya_field0007 1,1,ma_in01,83,16
-ma_in01,86,16,0 warp malaya_field0008 1,1,malaya,115,212
-malaya,299,167,0 warp malaya_field0009 1,1,ma_in01,12,24
-ma_in01,9,24,0 warp malaya_field0010 1,1,malaya,296,167
-malaya,261,240,0 warp malaya_field0011 1,1,ma_in01,126,20
-ma_in01,126,17,0 warp malaya_field0012 1,1,malaya,261,237
-malaya,370,277,0 warp malaya_field0013 1,1,ma_fild01,40,272
-ma_fild01,37,272,0 warp malaya_field0014 1,1,malaya,367,277
-ma_fild01,266,359,0 warp malaya_field0015 1,1,ma_fild02,248,36
-ma_fild02,248,33,0 warp malaya_field0016 1,1,ma_fild01,266,356
-ma_fild01,251,190,0 warp malaya_field0017 1,1,ma_in01,108,160
-ma_in01,105,160,0 warp malaya_field0018 1,1,ma_fild01,249,192
-ma_fild01,288,52,0 warp malaya_field0019 1,1,ma_scene01,142,78
-ma_scene01,140,80,0 warp malaya_field0020 1,1,ma_fild01,288,55
+ma_in01,86,16,0 warp mal_in_ws 1,1,malaya,115,212
+ma_in01,24,77,0 warp mal_in_inn 1,1,malaya,178,208
+malaya,370,277,0 warp malaya_mal_fild01 1,1,ma_fild01,40,272
+ma_fild01,37,272,0 warp mal_fild01_malaya 1,1,malaya,367,277
+ma_in01,33,152,0 warp mal_in_house01 1,1,malaya,52,75
+malaya,309,70,0 warp malaya_ship_mal_in_ship 1,1,ma_in01,108,92
+ma_in01,105,92,0 warp mal_in_ship_malaya_ship 1,1,malaya,310,67
+ma_fild01,266,359,0 warp mafild01_to02 1,1,ma_fild02,248,36
+ma_fild02,248,33,0 warp mafild02_to01 1,1,ma_fild01,266,356
+ma_fild01,288,52,0 warp mafild01_tobknw 1,1,ma_scene01,142,78
+ma_scene01,140,80,0 warp bknw_tofild01 1,1,ma_fild01,288,55
+ma_in01,9,24,0 warp mal_in_ts 1,1,malaya,296,167
+ma_in01,126,17,0 warp mal_in_shop_malaya_shop 1,1,malaya,261,237
+ma_fild01,251,190,0 warp mf_minga_mf_in_minga 1,1,ma_in01,108,160
+ma_in01,105,160,0 warp mf_in_minga_mf_minga 1,1,ma_fild01,248,190
// Car Warps
ma_zif01,30,22,0 warp malaya_car0001 1,1,malaya,241,238
@@ -43,4 +99,4 @@ ma_zif05,30,22,0 warp malaya_car0005 1,1,malaya,341,150
ma_zif06,30,22,0 warp malaya_car0006 1,1,malaya,294,293
ma_zif07,30,22,0 warp malaya_car0007 1,1,malaya,239,221
ma_zif08,30,22,0 warp malaya_car0008 1,1,malaya,59,246
-ma_zif09,30,22,0 warp malaya_car0009 1,1,malaya,254,68
+ma_zif09,30,22,0 warp malaya_car0009 1,1,malaya,254,68 \ No newline at end of file
diff --git a/npc/re/warps/cities/rachel.txt b/npc/re/warps/cities/rachel.txt
index 8610fa3bf..eb2b0722f 100644
--- a/npc/re/warps/cities/rachel.txt
+++ b/npc/re/warps/cities/rachel.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Rachel Warp Script
//===== By: ==================================================
//= erKURITA & RockmanEXE
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Description: =========================================
//= Warp Points for Rachel City, shops & other locations
//===== Additional Comments: =================================
diff --git a/npc/re/warps/cities/yggdrasil.txt b/npc/re/warps/cities/yggdrasil.txt
index 92f084372..3076d22b1 100644
--- a/npc/re/warps/cities/yggdrasil.txt
+++ b/npc/re/warps/cities/yggdrasil.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Yggdrasil Tree Warp Script
//===== By: ==================================================
//= PKGINGO (1.0)
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= Any Athena Version; RO Episode 6+
+//= Hercules; RO Episode 6+
//===== Description: =========================================
//= Warp Points for Yggdrasil Tree
//===== Additional Comments: =================================
diff --git a/npc/re/warps/dungeons/dic_dun.txt b/npc/re/warps/dungeons/dic_dun.txt
index 2af6d4445..9016c3e0c 100644
--- a/npc/re/warps/dungeons/dic_dun.txt
+++ b/npc/re/warps/dungeons/dic_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Scaraba Hole Warp Script
//===== By: ==================================================
//= Chilly, Muad_Dib
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Warp Points for Scaraba Hole
//===== Additional Comments: =================================
diff --git a/npc/re/warps/dungeons/ecl_dun.txt b/npc/re/warps/dungeons/ecl_dun.txt
index 6d6bb321a..5209c4f25 100644
--- a/npc/re/warps/dungeons/ecl_dun.txt
+++ b/npc/re/warps/dungeons/ecl_dun.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Eclage Dungeon Warp Script
//===== By: ==================================================
//= Chilly
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Warp Points for Eclage Dungeon
//===== Additional Comments: =================================
diff --git a/npc/re/warps/dungeons/iz_dun.txt b/npc/re/warps/dungeons/iz_dun.txt
index 3ef9ab86e..bbe68f8b8 100644
--- a/npc/re/warps/dungeons/iz_dun.txt
+++ b/npc/re/warps/dungeons/iz_dun.txt
@@ -1,4 +1,4 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Izlude Dungeon Renewal Warp Script
//===== By: ==================================================
//= Athena (1.0)
@@ -6,7 +6,7 @@
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Description: =========================================
//= Warp Points for Bibilyn Island & Undersea Cave
//===== Additional Comments: =================================
diff --git a/npc/re/warps/fields/bif_fild.txt b/npc/re/warps/fields/bif_fild.txt
index 3a32c3e75..ec9de1cf9 100644
--- a/npc/re/warps/fields/bif_fild.txt
+++ b/npc/re/warps/fields/bif_fild.txt
@@ -1,20 +1,44 @@
-//===== Hercules Script ======================================
+//===== rAthena Script =======================================
//= Bifrost Field Warp Script
//===== By: ==================================================
//= Chilly
//===== Current Version: =====================================
-//= 1.0
+//= 1.2
+//===== Compatible With: =====================================
+//= rAthena SVN
//===== Description: =========================================
//= Warp Points for Bifrost Field
//===== Additional Comments: =================================
//= 1.0 First Version.
+//= 1.1 Added official warp scripts. [Euphy]
+//= 1.2 Updated to match the official script. [Euphy]
//============================================================
splendide,275,390,0 warp bifrost_field0001 1,1,bif_fild01,316,50
-bif_fild01,318,48,0 warp bifrost_field0002 1,1,splendide,275,387
-bif_fild02,285,333,0 warp bifrost_field0003 1,1,mora,179,74
-mora,182,74,0 warp bifrost_field0004 1,1,bif_fild02,285,330
-bif_fild02,95,310,0 warp bifrost_field0005 1,1,mora,22,157
-mora,20,159,0 warp bifrost_field0006 1,1,bif_fild02,98,309
-bif_fild02,174,162,0 warp bifrost_field0007 1,1,mora,58,27
-mora,56,25,0 warp bifrost_field0008 1,1,bif_fild02,177,162
+bif_fild01,318,48,0 warp bifrost_field0002 1,1,splendide,271,382
+mora,182,74,0 warp bifrost_field0003 1,1,bif_fild02,286,327
+mora,20,159,0 warp bifrost_field0004 1,1,bif_fild02,99,308
+mora,56,25,0 warp bifrost_field0005 1,1,bif_fild02,176,162
+
+- script bifrost_field0000 -1,{
+ mes "At the end of the small path through the bright flower garden";
+ mes "is an entrance to something that looks like a small hill.";
+ next;
+ if(select("Knock-knock:Is this a wormhole?") == 1) {
+ mes "When you knock on the door-like thing just for fun,";
+ mes "the door clicks open and you feel some mysterious force pulling you inside.";
+ close2;
+ switch(atoi(charat(strnpcinfo(2),9))) {
+ case 1: warp "mora",179,74; end;
+ case 2: warp "mora",22,157; end;
+ case 3: warp "mora",58,27; end;
+ }
+ }
+ close;
+OnTouch:
+ specialeffect EF_LEVEL99_4;
+ end;
+}
+bif_fild02,285,332,0 duplicate(bifrost_field0000) Small Hole#ep14_mora1 844
+bif_fild02,95,310,0 duplicate(bifrost_field0000) Small Hole#ep14_mora2 844
+bif_fild02,174,162,0 duplicate(bifrost_field0000) Small Hole#ep14_mora3 844
diff --git a/npc/re/warps/fields/com_fild.txt b/npc/re/warps/fields/com_fild.txt
index 765874af1..c90257eb3 100644
--- a/npc/re/warps/fields/com_fild.txt
+++ b/npc/re/warps/fields/com_fild.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Comodo Field Warp Script
//===== By: ==================================================
//= Nana
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Description: =========================================
//= [Aegis Conversion]
//= Warp Points for Comodo Fields
diff --git a/npc/re/warps/fields/dic_fild.txt b/npc/re/warps/fields/dic_fild.txt
index d49b5f5c7..41ac07aaf 100644
--- a/npc/re/warps/fields/dic_fild.txt
+++ b/npc/re/warps/fields/dic_fild.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= El Dicastes Field Warp Script
//===== By: ==================================================
//= Chilly, Muad_Dib
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Warp Points for El Dicastes Field
//===== Additional Comments: =================================
diff --git a/npc/re/warps/fields/geffen_fild.txt b/npc/re/warps/fields/geffen_fild.txt
index 08b0e46e2..289ad3a6c 100644
--- a/npc/re/warps/fields/geffen_fild.txt
+++ b/npc/re/warps/fields/geffen_fild.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Geffen Warp Script
//===== By: ==================================================
//= Nana (1.0)
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Description: =========================================
//= Warp Points for Geffen Field's
//===== Additional Comments: =================================
diff --git a/npc/re/warps/fields/hugel_fild.txt b/npc/re/warps/fields/hugel_fild.txt
index 8b5de97b2..309ba8cc1 100644
--- a/npc/re/warps/fields/hugel_fild.txt
+++ b/npc/re/warps/fields/hugel_fild.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Hugel Field Warp Script
//===== By: ==================================================
//= Sara-chan (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version; RO Episode 10+
+//= Hercules; RO Episode 10+
//===== Description: =========================================
//= Warp Points for Hugel Field
//===== Additional Comments: =================================
diff --git a/npc/re/warps/fields/morroc_fild.txt b/npc/re/warps/fields/morroc_fild.txt
index 6cd6c64b5..b256e9413 100644
--- a/npc/re/warps/fields/morroc_fild.txt
+++ b/npc/re/warps/fields/morroc_fild.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Morroc Field Warp Script
//===== By: ==================================================
//= Nana (1.0)
//===== Current Version: =====================================
//= 1.4b
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Description: =========================================
//= Warp Points for Morroc Fields
//===== Additional Comments: =================================
diff --git a/npc/re/warps/fields/payon_fild.txt b/npc/re/warps/fields/payon_fild.txt
index d991f2280..5bec271e8 100644
--- a/npc/re/warps/fields/payon_fild.txt
+++ b/npc/re/warps/fields/payon_fild.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Payon Field Warps
//===== By: ==================================================
//= Nana (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any rAthena Mod
+//= Hercules
//===== Description: =========================================
//= Payon Field Warps
//===== Additional Comments: =================================
diff --git a/npc/re/warps/fields/prontera_fild.txt b/npc/re/warps/fields/prontera_fild.txt
index 16d3c8238..2267c298d 100644
--- a/npc/re/warps/fields/prontera_fild.txt
+++ b/npc/re/warps/fields/prontera_fild.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Prontera Field Warp Script
//===== By: ==================================================
//= Nana (1.0)
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Description: =========================================
//= Warp Points for Prontera Field
//===== Additional Comments: =================================
diff --git a/npc/re/warps/fields/rachel_fild.txt b/npc/re/warps/fields/rachel_fild.txt
index 475557200..87d4f16d7 100644
--- a/npc/re/warps/fields/rachel_fild.txt
+++ b/npc/re/warps/fields/rachel_fild.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Rachel Field Warp Script
//===== By: ==================================================
//= Playtester
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Description: =========================================
//= Warp Points for Rachel Field
//===== Additional Comments: =================================
diff --git a/npc/re/warps/fields/veins_fild.txt b/npc/re/warps/fields/veins_fild.txt
index ac05163ff..c1a5cce5a 100644
--- a/npc/re/warps/fields/veins_fild.txt
+++ b/npc/re/warps/fields/veins_fild.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Veins Field Warp Script
//===== By: ==================================================
//= $ephiroth
//===== Current Version: =====================================
//= 1.5
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Description: =========================================
//= Warp Points for Veins Field
//===== Additional Comments: =================================
diff --git a/npc/re/warps/fields/yuno_fild.txt b/npc/re/warps/fields/yuno_fild.txt
index 32d1924f5..b570fca9e 100644
--- a/npc/re/warps/fields/yuno_fild.txt
+++ b/npc/re/warps/fields/yuno_fild.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Yuno Field Warp Script
//===== By: ==================================================
//= Nana (1.0), Sara
//===== Current Version: =====================================
//= 1.3
//===== Compatible With: =====================================
-//= Any Athena Version; RO Episode 5+
+//= Hercules; RO Episode 5+
//===== Description: =========================================
//= Warp Points for Yuno Field
//===== Additional Comments: =================================
diff --git a/npc/re/warps/other/jobquests.txt b/npc/re/warps/other/jobquests.txt
index 5dec2077c..5b62a74a4 100644
--- a/npc/re/warps/other/jobquests.txt
+++ b/npc/re/warps/other/jobquests.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Job Quest Renewal Warp Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 2.2
//===== Compatible With: =====================================
-//= Any Athena Version; RO Version Ep4+
+//= Hercules; RO Version Ep4+
//===== Description: =========================================
//= Warp Points for Job Quest Maps
//===== Additional Comments: =================================
diff --git a/npc/re/warps/other/paradise.txt b/npc/re/warps/other/paradise.txt
index fec766ec4..4d4b241a9 100644
--- a/npc/re/warps/other/paradise.txt
+++ b/npc/re/warps/other/paradise.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Paradise Group Warp Script
//===== By: ==================================================
//= Chilly
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
-//= rAthena SVN;
+//= Hercules
//===== Description: =========================================
//= Warp Points for Paradise Group
//===== Additional Comments: =================================
diff --git a/npc/re/warps/other/s_workshop.txt b/npc/re/warps/other/s_workshop.txt
index 884d77202..bc04509b3 100644
--- a/npc/re/warps/other/s_workshop.txt
+++ b/npc/re/warps/other/s_workshop.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Shadow Workshop Warp Script
//===== By: ==================================================
//= Chilly
//===== Current Version: =====================================
//= 1.1
//===== Compatible With: =====================================
-//= rAthena SVN
+//= Hercules
//===== Description: =========================================
//= Warp Points for Shadow Workshop
//===== Additional Comments: =================================
diff --git a/npc/re/warps/other/sign.txt b/npc/re/warps/other/sign.txt
index fb24620f8..84895c26b 100644
--- a/npc/re/warps/other/sign.txt
+++ b/npc/re/warps/other/sign.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Sign Quest Warps
//===== By: ==================================================
//= MasterOfMuppets
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
-//= Any Athena Version; RO Episode 8+
+//= Hercules; RO Episode 8+
//===== Description: =========================================
//= Warp Points related to the Sign Quest will be put here
//===== Additional Comments: =================================
diff --git a/npc/scripts_athena.conf b/npc/scripts.conf
index e8265d0c0..65cfe53f5 100644
--- a/npc/scripts_athena.conf
+++ b/npc/scripts.conf
@@ -1,4 +1,10 @@
// --------------------------------------------------------------
+// - Message of the Day -
+// --------------------------------------------------------------
+npc: npc/MOTD.txt
+
+
+// --------------------------------------------------------------
// - Core Scripts -
// --------------------------------------------------------------
@@ -133,6 +139,7 @@ npc: npc/merchants/enchan_arm.txt
npc: npc/merchants/gemstone.txt
npc: npc/merchants/hair_dyer.txt
npc: npc/merchants/hair_style.txt
+//npc: npc/merchants/hd_refine.txt
//npc: npc/merchants/icecream.txt
npc: npc/merchants/inn.txt
npc: npc/merchants/kunai_maker.txt
diff --git a/npc/scripts_mapflags.conf b/npc/scripts_mapflags.conf
index 78adeba20..c0d2787f8 100644
--- a/npc/scripts_mapflags.conf
+++ b/npc/scripts_mapflags.conf
@@ -1,31 +1,31 @@
// --------------------------------------------------------------
// - Map Flags -
// --------------------------------------------------------------
-npc: conf/mapflag/nopvp.txt
-npc: conf/mapflag/gvg.txt
-npc: conf/mapflag/jail.txt
-npc: conf/mapflag/nightmare.txt
-npc: conf/mapflag/nobranch.txt
-npc: conf/mapflag/noexp.txt
-npc: conf/mapflag/noicewall.txt
-npc: conf/mapflag/noloot.txt
-npc: conf/mapflag/nomemo.txt
-npc: conf/mapflag/nopenalty.txt
-npc: conf/mapflag/nosave.txt
-npc: conf/mapflag/noteleport.txt
-npc: conf/mapflag/noreturn.txt
-npc: conf/mapflag/noskill.txt
-npc: conf/mapflag/nowarp.txt
-npc: conf/mapflag/nowarpto.txt
-npc: conf/mapflag/partylock.txt
-npc: conf/mapflag/pvp.txt
-npc: conf/mapflag/pvp_noparty.txt
-npc: conf/mapflag/pvp_noguild.txt
-npc: conf/mapflag/night.txt
-npc: conf/mapflag/zone.txt
-npc: conf/mapflag/battleground.txt
-npc: conf/mapflag/novending.txt
-npc: conf/mapflag/town.txt
-npc: conf/mapflag/reset.txt
-npc: conf/mapflag/skillmodifier.txt
-npc: conf/mapflag/skillduration.txt \ No newline at end of file
+npc: npc/mapflag/nopvp.txt
+npc: npc/mapflag/gvg.txt
+npc: npc/mapflag/jail.txt
+npc: npc/mapflag/nightmare.txt
+npc: npc/mapflag/nobranch.txt
+npc: npc/mapflag/noexp.txt
+npc: npc/mapflag/noicewall.txt
+npc: npc/mapflag/noloot.txt
+npc: npc/mapflag/nomemo.txt
+npc: npc/mapflag/nopenalty.txt
+npc: npc/mapflag/nosave.txt
+npc: npc/mapflag/noteleport.txt
+npc: npc/mapflag/noreturn.txt
+npc: npc/mapflag/noskill.txt
+npc: npc/mapflag/nowarp.txt
+npc: npc/mapflag/nowarpto.txt
+npc: npc/mapflag/partylock.txt
+npc: npc/mapflag/pvp.txt
+npc: npc/mapflag/pvp_noparty.txt
+npc: npc/mapflag/pvp_noguild.txt
+npc: npc/mapflag/night.txt
+npc: npc/mapflag/zone.txt
+npc: npc/mapflag/battleground.txt
+npc: npc/mapflag/novending.txt
+npc: npc/mapflag/town.txt
+npc: npc/mapflag/reset.txt
+npc: npc/mapflag/skillmodifier.txt
+npc: npc/mapflag/skillduration.txt \ No newline at end of file
diff --git a/npc/warps/guildcastles.txt b/npc/warps/guildcastles.txt
index 923d9b2bc..f41fc2a5d 100644
--- a/npc/warps/guildcastles.txt
+++ b/npc/warps/guildcastles.txt
@@ -1,11 +1,11 @@
-//===== rAthena Script =======================================
+//===== Hercules Script ======================================
//= Guild Castles Warp Script
//===== By: ==================================================
//= Athena (1.0)
//===== Current Version: =====================================
//= 2.7
//===== Compatible With: =====================================
-//= Any Athena Version
+//= Hercules
//===== Description: =========================================
//= Warp Points for Al de Baran, Payon, Prontera, Geffen,
//= and Juno Guild Castles
diff --git a/npc/warps/pvp.txt b/npc/warps/pvp.txt
index c0e6b09a3..2d28a94d8 100644
--- a/npc/warps/pvp.txt
+++ b/npc/warps/pvp.txt
@@ -5,7 +5,7 @@
//===== Current Version: =====================================
//= 1.4
//===== Compatible With: =====================================
-//= Hercules GIT
+//= Hercules
//===== Description: =========================================
//= Warp Points for Prontera Arena and PvP Maps
//===== Additional Comments: =================================
diff --git a/src/char/char.c b/src/char/char.c
index 00fc633df..3083876ab 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -81,7 +81,8 @@ struct mmo_map_server {
uint32 ip;
uint16 port;
int users;
- unsigned short map[MAX_MAP_PER_SERVER];
+ unsigned short *map;
+ unsigned short maps;
} server[MAX_MAP_SERVERS];
int char_fd=-1;
@@ -187,7 +188,7 @@ static DBData create_online_char_data(DBKey key, va_list args)
character->pincode_enable = -1;
character->fd = -1;
character->waiting_disconnect = INVALID_TIMER;
- return DB->ptr2data(character);
+ return iDB->ptr2data(character);
}
void set_char_charselect(int account_id)
@@ -206,7 +207,7 @@ void set_char_charselect(int account_id)
character->pincode_enable = *pincode->charselect + *pincode->enabled;
if(character->waiting_disconnect != INVALID_TIMER) {
- delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
+ iTimer->delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
character->waiting_disconnect = INVALID_TIMER;
}
@@ -247,7 +248,7 @@ void set_char_online(int map_id, int char_id, int account_id)
//Get rid of disconnect timer
if(character->waiting_disconnect != INVALID_TIMER) {
- delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
+ iTimer->delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
character->waiting_disconnect = INVALID_TIMER;
}
@@ -292,7 +293,7 @@ void set_char_offline(int char_id, int account_id)
server[character->server].users--;
if(character->waiting_disconnect != INVALID_TIMER){
- delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
+ iTimer->delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
character->waiting_disconnect = INVALID_TIMER;
}
@@ -321,13 +322,13 @@ void set_char_offline(int char_id, int account_id)
*/
static int char_db_setoffline(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data);
+ struct online_char_data* character = (struct online_char_data*)iDB->data2ptr(data);
int server = va_arg(ap, int);
if (server == -1) {
character->char_id = -1;
character->server = -1;
if(character->waiting_disconnect != INVALID_TIMER){
- delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
+ iTimer->delete_timer(character->waiting_disconnect, chardb_waiting_disconnect);
character->waiting_disconnect = INVALID_TIMER;
}
} else if (character->server == server)
@@ -340,7 +341,7 @@ static int char_db_setoffline(DBKey key, DBData *data, va_list ap)
*/
static int char_db_kickoffline(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = (struct online_char_data*)DB->data2ptr(data);
+ struct online_char_data* character = (struct online_char_data*)iDB->data2ptr(data);
int server_id = va_arg(ap, int);
if (server_id > -1 && character->server != server_id)
@@ -392,7 +393,7 @@ static DBData create_charstatus(DBKey key, va_list args)
struct mmo_charstatus *cp;
cp = (struct mmo_charstatus *) aCalloc(1,sizeof(struct mmo_charstatus));
cp->char_id = key.i;
- return DB->ptr2data(cp);
+ return iDB->ptr2data(cp);
}
int inventory_to_sql(const struct item items[], int max, int id);
@@ -1171,13 +1172,13 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus* p, bool load_everything
p->save_point.map = mapindex_name2id(save_map);
if( p->last_point.map == 0 ) {
- p->last_point.map = strdb_iget(mapindex_db, MAP_DEFAULT);
+ p->last_point.map = (unsigned short)strdb_iget(mapindex_db, MAP_DEFAULT);
p->last_point.x = MAP_DEFAULT_X;
p->last_point.y = MAP_DEFAULT_Y;
}
if( p->save_point.map == 0 ) {
- p->save_point.map = strdb_iget(mapindex_db, MAP_DEFAULT);
+ p->save_point.map = (unsigned short)strdb_iget(mapindex_db, MAP_DEFAULT);
p->save_point.x = MAP_DEFAULT_X;
p->save_point.y = MAP_DEFAULT_Y;
}
@@ -2024,7 +2025,7 @@ static void char_auth_ok(int fd, struct char_session_data *sd)
{ //Character already online. KICK KICK KICK
mapif_disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2);
if (character->waiting_disconnect == INVALID_TIMER)
- character->waiting_disconnect = add_timer(gettick()+20000, chardb_waiting_disconnect, character->account_id, 0);
+ character->waiting_disconnect = iTimer->add_timer(iTimer->gettick()+20000, chardb_waiting_disconnect, character->account_id, 0);
WFIFOHEAD(fd,3);
WFIFOW(fd,0) = 0x81;
WFIFOB(fd,2) = 8;
@@ -2101,7 +2102,7 @@ void loginif_on_ready(void)
loginif_check_shutdown();
//Send online accounts to login server.
- send_accounts_tologin(INVALID_TIMER, gettick(), 0, 0);
+ send_accounts_tologin(INVALID_TIMER, iTimer->gettick(), 0, 0);
// if no map-server already connected, display a message...
ARR_FIND( 0, ARRAYLENGTH(server), i, server[i].fd > 0 && server[i].map[0] );
@@ -2382,7 +2383,7 @@ int parse_fromlogin(int fd) {
{ //Kick it from the map server it is on.
mapif_disconnectplayer(server[character->server].fd, character->account_id, character->char_id, 2);
if (character->waiting_disconnect == INVALID_TIMER)
- character->waiting_disconnect = add_timer(gettick()+AUTH_TIMEOUT, chardb_waiting_disconnect, character->account_id, 0);
+ character->waiting_disconnect = iTimer->add_timer(iTimer->gettick()+AUTH_TIMEOUT, chardb_waiting_disconnect, character->account_id, 0);
}
else
{// Manual kick from char server.
@@ -2451,12 +2452,12 @@ int send_accounts_tologin(int tid, unsigned int tick, int id, intptr_t data);
void do_init_loginif(void)
{
// establish char-login connection if not present
- add_timer_func_list(check_connect_login_server, "check_connect_login_server");
- add_timer_interval(gettick() + 1000, check_connect_login_server, 0, 0, 10 * 1000);
+ iTimer->add_timer_func_list(check_connect_login_server, "check_connect_login_server");
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, check_connect_login_server, 0, 0, 10 * 1000);
// send a list of all online account IDs to login server
- add_timer_func_list(send_accounts_tologin, "send_accounts_tologin");
- add_timer_interval(gettick() + 1000, send_accounts_tologin, 0, 0, 3600 * 1000); //Sync online accounts every hour
+ iTimer->add_timer_func_list(send_accounts_tologin, "send_accounts_tologin");
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, send_accounts_tologin, 0, 0, 3600 * 1000); //Sync online accounts every hour
}
void do_final_loginif(void)
@@ -2628,7 +2629,7 @@ int search_mapserver(unsigned short map, uint32 ip, uint16 port);
/// Initializes a server structure.
void mapif_server_init(int id)
{
- memset(&server[id], 0, sizeof(server[id]));
+ //memset(&server[id], 0, sizeof(server[id]));
server[id].fd = -1;
}
@@ -2655,7 +2656,7 @@ void mapif_server_reset(int id)
WBUFL(buf,4) = htonl(server[id].ip);
WBUFW(buf,8) = htons(server[id].port);
j = 0;
- for(i = 0; i < MAX_MAP_PER_SERVER; i++)
+ for(i = 0; i < server[id].maps; i++)
if (server[id].map[i])
WBUFW(buf,10+(j++)*4) = server[id].map[i];
if (j > 0) {
@@ -2725,8 +2726,11 @@ int parse_frommap(int fd)
case 0x2afa: // Receiving map names list from the map-server
if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
return 0;
-
- memset(server[id].map, 0, sizeof(server[id].map));
+ if( server[id].map != NULL ) { aFree(server[id].map); server[id].map = NULL; }
+
+ server[id].maps = ( RFIFOW(fd, 2) - 4 ) / 4;
+ CREATE(server[id].map, unsigned short, server[id].maps);
+
j = 0;
for(i = 4; i < RFIFOW(fd,2); i += 4) {
server[id].map[j] = RFIFOW(fd,i);
@@ -3392,10 +3396,14 @@ int parse_frommap(int fd)
if( RFIFOREST(fd) < RFIFOW(fd,4) )
return 0;/* packet wasn't fully received yet (still fragmented) */
else {
- int sfd;/* stat server fd */
+ int sfd;/* stat server fd */
+ struct hSockOpt opt;
RFIFOSKIP(fd, 2);/* we skip first 2 bytes which are the 0x3008, so we end up with a buffer equal to the one we send */
- if( (sfd = make_connection(host2ip("stats.hercules.ws"),(uint16)25427,true) ) == -1 ) {
+ opt.silent = 1;
+ opt.setTimeo = 1;
+
+ if( (sfd = make_connection(host2ip("stats.hercules.ws"),(uint16)25427,&opt) ) == -1 ) {
RFIFOSKIP(fd, RFIFOW(fd,2) );/* skip this packet */
RFIFOFLUSH(fd);
break;/* connection not possible, we drop the report */
@@ -4275,7 +4283,6 @@ int parse_char(int fd)
server[i].ip = ntohl(RFIFOL(fd,54));
server[i].port = ntohs(RFIFOW(fd,58));
server[i].users = 0;
- memset(server[i].map, 0, sizeof(server[i].map));
session[fd]->func_parse = parse_frommap;
session[fd]->flag.server = 1;
realloc_fifo(fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
@@ -4450,7 +4457,7 @@ int broadcast_user_count(int tid, unsigned int tick, int id, intptr_t data)
*/
static int send_accounts_tologin_sub(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data* character = DB->data2ptr(data);
+ struct online_char_data* character = iDB->data2ptr(data);
int* i = va_arg(ap, int*);
if(character->server > -1)
@@ -4486,12 +4493,12 @@ int check_connect_login_server(int tid, unsigned int tick, int id, intptr_t data
return 0;
ShowInfo("Attempt to connect to login-server...\n");
- login_fd = make_connection(login_ip, login_port, false);
- if (login_fd == -1)
- { //Try again later. [Skotlex]
+
+ if ( (login_fd = make_connection(login_ip, login_port, NULL)) == -1) { //Try again later. [Skotlex]
login_fd = 0;
return 0;
}
+
session[login_fd]->func_parse = parse_fromlogin;
session[login_fd]->flag.server = 1;
realloc_fifo(login_fd, FIFOSIZE_SERVERLINK, FIFOSIZE_SERVERLINK);
@@ -4532,7 +4539,7 @@ static int chardb_waiting_disconnect(int tid, unsigned int tick, int id, intptr_
*/
static int online_data_cleanup_sub(DBKey key, DBData *data, va_list ap)
{
- struct online_char_data *character= DB->data2ptr(data);
+ struct online_char_data *character= iDB->data2ptr(data);
if (character->fd != -1)
return 0; //Character still connected
if (character->server == -2) //Unknown server.. set them offline
@@ -4858,8 +4865,8 @@ int char_config_read(const char* cfgName)
return 0;
}
-void do_final(void)
-{
+void do_final(void) {
+ int i;
ShowStatus("Terminating...\n");
set_all_offline(-1);
@@ -4879,8 +4886,7 @@ void do_final(void)
online_char_db->destroy(online_char_db, NULL);
auth_db->destroy(auth_db, NULL);
- if( char_fd != -1 )
- {
+ if( char_fd != -1 ) {
do_close(char_fd);
char_fd = -1;
}
@@ -4888,6 +4894,10 @@ void do_final(void)
SQL->Free(sql_handle);
mapindex_final();
+ for(i = 0; i < MAX_MAP_SERVERS; i++ )
+ if( server[i].map )
+ aFree(server[i].map);
+
ShowStatus("Finished.\n");
}
@@ -4923,11 +4933,17 @@ void do_shutdown(void)
int do_init(int argc, char **argv) {
+ int i;
memset(&skillid2idx, 0, sizeof(skillid2idx));
+
+ for(i = 0; i < MAX_MAP_SERVERS; i++ )
+ server[i].map = NULL;
+
//Read map indexes
mapindex_init();
start_point.map = mapindex_name2id("new_zone01");
+
pincode_defaults();
char_config_read((argc < 2) ? CHAR_CONF_NAME : argv[1]);
@@ -4969,15 +4985,15 @@ int do_init(int argc, char **argv) {
do_init_mapif();
// periodically update the overall user count on all mapservers + login server
- add_timer_func_list(broadcast_user_count, "broadcast_user_count");
- add_timer_interval(gettick() + 1000, broadcast_user_count, 0, 0, 5 * 1000);
+ iTimer->add_timer_func_list(broadcast_user_count, "broadcast_user_count");
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, broadcast_user_count, 0, 0, 5 * 1000);
// Timer to clear (online_char_db)
- add_timer_func_list(chardb_waiting_disconnect, "chardb_waiting_disconnect");
+ iTimer->add_timer_func_list(chardb_waiting_disconnect, "chardb_waiting_disconnect");
// Online Data timers (checking if char still connected)
- add_timer_func_list(online_data_cleanup, "online_data_cleanup");
- add_timer_interval(gettick() + 1000, online_data_cleanup, 0, 0, 600 * 1000);
+ iTimer->add_timer_func_list(online_data_cleanup, "online_data_cleanup");
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, online_data_cleanup, 0, 0, 600 * 1000);
//Cleaning the tables for NULL entrys @ startup [Sirius]
//Chardb clean
diff --git a/src/char/char.h b/src/char/char.h
index b48ea359c..996a0e845 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -45,7 +45,7 @@ struct online_char_data {
DBMap* online_char_db; // int account_id -> struct online_char_data*
-#define MAX_MAP_SERVERS 30
+#define MAX_MAP_SERVERS 2
#define DEFAULT_AUTOSAVE_INTERVAL 300*1000
diff --git a/src/char/int_auction.c b/src/char/int_auction.c
index 977638aad..c9195a380 100644
--- a/src/char/int_auction.c
+++ b/src/char/int_auction.c
@@ -115,7 +115,7 @@ unsigned int auction_create(struct auction_data *auction)
auction->item.expire_time = 0;
auction->auction_id = (unsigned int)SqlStmt_LastInsertId(stmt);
- auction->auction_end_timer = add_timer( gettick() + tick , auction_end_timer, auction->auction_id, 0);
+ auction->auction_end_timer = iTimer->add_timer( iTimer->gettick() + tick , auction_end_timer, auction->auction_id, 0);
ShowInfo("New Auction %u | time left %u ms | By %s.\n", auction->auction_id, tick, auction->seller_name);
CREATE(auction_, struct auction_data, 1);
@@ -170,7 +170,7 @@ void auction_delete(struct auction_data *auction)
Sql_ShowDebug(sql_handle);
if( auction->auction_end_timer != INVALID_TIMER )
- delete_timer(auction->auction_end_timer, auction_end_timer);
+ iTimer->delete_timer(auction->auction_end_timer, auction_end_timer);
idb_remove(auction_db_, auction_id);
}
@@ -182,7 +182,7 @@ void inter_auctions_fromsql(void)
struct item *item;
char *data;
StringBuf buf;
- unsigned int tick = gettick(), endtick;
+ unsigned int tick = iTimer->gettick(), endtick;
time_t now = time(NULL);
StrBuf->Init(&buf);
@@ -234,7 +234,7 @@ void inter_auctions_fromsql(void)
else
endtick = tick + 10000; // 10 Second's to process ended auctions
- auction->auction_end_timer = add_timer(endtick, auction_end_timer, auction->auction_id, 0);
+ auction->auction_end_timer = iTimer->add_timer(endtick, auction_end_timer, auction->auction_id, 0);
idb_put(auction_db_, auction->auction_id, auction);
}
diff --git a/src/char/int_guild.c b/src/char/int_guild.c
index e1e012725..55f29953f 100644
--- a/src/char/int_guild.c
+++ b/src/char/int_guild.c
@@ -57,7 +57,7 @@ static int guild_save_timer(int tid, unsigned int tick, int id, intptr_t data)
if( last_id == 0 ) //Save the first guild in the list.
state = 1;
- for( g = DB->data2ptr(iter->first(iter, &key)); dbi_exists(iter); g = DB->data2ptr(iter->next(iter, &key)) )
+ for( g = iDB->data2ptr(iter->first(iter, &key)); dbi_exists(iter); g = iDB->data2ptr(iter->next(iter, &key)) )
{
if( state == 0 && g->guild_id == last_id )
state++; //Save next guild in the list.
@@ -86,7 +86,7 @@ static int guild_save_timer(int tid, unsigned int tick, int id, intptr_t data)
state = guild_db_->size(guild_db_);
if( state < 1 ) state = 1; //Calculate the time slot for the next save.
- add_timer(tick + autosave_interval/state, guild_save_timer, 0, 0);
+ iTimer->add_timer(tick + autosave_interval/state, guild_save_timer, 0, 0);
return 0;
}
@@ -729,8 +729,8 @@ int inter_guild_sql_init(void)
//Read exp file
sv->readdb("db", DBPATH"exp_guild.txt", ',', 1, 1, 100, exp_guild_parse_row);
- add_timer_func_list(guild_save_timer, "guild_save_timer");
- add_timer(gettick() + 10000, guild_save_timer, 0, 0);
+ iTimer->add_timer_func_list(guild_save_timer, "guild_save_timer");
+ iTimer->add_timer(iTimer->gettick() + 10000, guild_save_timer, 0, 0);
return 0;
}
@@ -739,7 +739,7 @@ int inter_guild_sql_init(void)
*/
static int guild_db_final(DBKey key, DBData *data, va_list ap)
{
- struct guild *g = DB->data2ptr(data);
+ struct guild *g = iDB->data2ptr(data);
if (g->save_flag&GS_MASK) {
inter_guild_tosql(g, g->save_flag&GS_MASK);
return 1;
diff --git a/src/char/inter.c b/src/char/inter.c
index a1b075a14..a9e9dece4 100644
--- a/src/char/inter.c
+++ b/src/char/inter.c
@@ -935,7 +935,7 @@ int mapif_disconnectplayer(int fd, int account_id, int char_id, int reason)
int check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap)
{
unsigned long tick;
- struct WisData *wd = DB->data2ptr(data);
+ struct WisData *wd = iDB->data2ptr(data);
tick = va_arg(ap, unsigned long);
if (DIFF_TICK(tick, wd->tick) > WISDATA_TTL && wis_delnum < WISDELLIST_MAX)
@@ -946,7 +946,7 @@ int check_ttl_wisdata_sub(DBKey key, DBData *data, va_list ap)
int check_ttl_wisdata(void)
{
- unsigned long tick = gettick();
+ unsigned long tick = iTimer->gettick();
int i;
do {
@@ -1039,7 +1039,7 @@ int mapif_parse_WisRequest(int fd)
memcpy(wd->src, RFIFOP(fd, 4), NAME_LENGTH);
memcpy(wd->dst, RFIFOP(fd,28), NAME_LENGTH);
memcpy(wd->msg, RFIFOP(fd,52), wd->len);
- wd->tick = gettick();
+ wd->tick = iTimer->gettick();
idb_put(wis_db, wd->id, wd);
mapif_wis_message(wd);
}
diff --git a/src/common/HPM.c b/src/common/HPM.c
index 28ea8f413..ed6151c95 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -264,8 +264,8 @@ void hplugins_share_defaults(void) {
HPM->share(&SERVER_TYPE,"SERVER_TYPE");
HPM->share((void*)get_svn_revision,"get_svn_revision");
HPM->share((void*)get_git_hash,"get_git_hash");
- HPM->share(DB, "DB");
- HPM->share(malloclib, "malloclib");
+ HPM->share(iDB, "iDB");
+ HPM->share(iMalloc, "iMalloc");
/* socket */
HPM->share(RFIFOSKIP,"RFIFOSKIP");
HPM->share(WFIFOSET,"WFIFOSET");
@@ -281,12 +281,8 @@ void hplugins_share_defaults(void) {
/* sql */
HPM->share(SQL,"SQL");
/* timer */
- HPM->share(gettick,"gettick");
- HPM->share(add_timer,"add_timer");
- HPM->share(add_timer_interval,"add_timer_interval");
- HPM->share(add_timer_func_list,"add_timer_func_list");
- HPM->share(delete_timer,"delete_timer");
- HPM->share(get_uptime,"get_uptime");
+ HPM->share(iTimer,"iTimer");
+
}
CPCMD(plugins) {
if( HPM->plugin_count == 0 ) {
diff --git a/src/common/cbasetypes.h b/src/common/cbasetypes.h
index 731a8b578..bfe8bf8f8 100644
--- a/src/common/cbasetypes.h
+++ b/src/common/cbasetypes.h
@@ -281,6 +281,24 @@ typedef char bool;
//#define swap(a,b) ((a == b) || ((a ^= b), (b ^= a), (a ^= b)))
// Avoid "value computed is not used" warning and generates the same assembly code
#define swap(a,b) if (a != b) ((a ^= b), (b ^= a), (a ^= b))
+#if 0 //to be activated soon, more tests needed on how VS works with the macro above
+#ifdef WIN32
+#undef swap
+#define swap(a,b)__asm \
+{ \
+ __asm mov eax, dword ptr [a] \
+ __asm cmp eax, dword ptr [b] \
+ __asm je _ret \
+ __asm xor eax, dword ptr [b] \
+ __asm mov dword ptr [a], eax \
+ __asm xor eax, dword ptr [b] \
+ __asm mov dword ptr [b], eax \
+ __asm xor eax, dword ptr [a] \
+ __asm mov dword ptr [a], eax \
+ __asm _ret: \
+}
+#endif
+#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
diff --git a/src/common/console.c b/src/common/console.c
index ba93b8e09..08daec04e 100644
--- a/src/common/console.c
+++ b/src/common/console.c
@@ -85,6 +85,9 @@ CPCMD(exit) {
CPCMD(ers_report) {
ers_report();
}
+CPCMD(mem_report) {
+ memmgr_report(line?atoi(line):0);
+}
CPCMD(help) {
unsigned int i = 0;
for ( i = 0; i < console->cmd_list_count; i++ ) {
@@ -98,7 +101,7 @@ CPCMD(help) {
}
/* [Ind/Hercules] */
CPCMD(malloc_usage) {
- unsigned int val = (unsigned int)malloclib->usage();
+ unsigned int val = (unsigned int)iMalloc->usage();
ShowInfo("malloc_usage: %.2f MB\n",(double)(val)/1024);
}
#define CP_DEF_C(x) { #x , NULL , NULL, NULL }
@@ -115,6 +118,7 @@ void console_load_defaults(void) {
CP_DEF(help),
CP_DEF_C(server),
CP_DEF_S(ers_report,server),
+ CP_DEF_S(mem_report,server),
CP_DEF_S(malloc_usage,server),
CP_DEF_S(exit,server),
};
@@ -227,8 +231,10 @@ void console_parse_sub(char *line) {
char *tok;
char sublist[CP_CMD_LENGTH * 5];
unsigned int i, len = 0;
+
memcpy(bline, line, 200);
tok = strtok(line, " ");
+
for ( i = 0; i < console->cmd_list_count; i++ ) {
if( strcmpi(tok,console->cmd_list[i]->cmd) == 0 )
break;
@@ -363,8 +369,8 @@ void console_parse_init(void) {
exit(EXIT_FAILURE);
}
- add_timer_func_list(console->parse_timer, "console_parse_timer");
- add_timer_interval(gettick() + 1000, console->parse_timer, 0, 0, 500);/* start listening in 1s; re-try every 0.5s */
+ iTimer->add_timer_func_list(console->parse_timer, "console_parse_timer");
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, console->parse_timer, 0, 0, 500);/* start listening in 1s; re-try every 0.5s */
}
#endif /* CONSOLE_INPUT */
diff --git a/src/common/core.c b/src/common/core.c
index 0959e6fc9..d6cfff662 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -307,7 +307,7 @@ int main (int argc, char **argv) {
}
core_defaults();
- malloclib->init();// needed for Show* in display_title() [FlavioJS]
+ iMalloc->init();// needed for Show* in display_title() [FlavioJS]
console->display_title();
@@ -322,14 +322,14 @@ int main (int argc, char **argv) {
Sql_Init();
rathread_init();
mempool_init();
- DB->init();
+ iDB->init();
signals_init();
#ifdef _WIN32
cevents_init();
#endif
- timer_init();
+ iTimer->init();
console->init();
@@ -343,7 +343,7 @@ int main (int argc, char **argv) {
{// Main runtime cycle
int next;
while (runflag != CORE_ST_STOP) {
- next = do_timer(gettick_nocache());
+ next = iTimer->do_timer(iTimer->gettick_nocache());
do_sockets(next);
}
}
@@ -354,14 +354,14 @@ int main (int argc, char **argv) {
#ifndef MINICORE
HPM->final();
#endif
- timer_final();
+ iTimer->final();
socket_final();
- DB->final();
+ iDB->final();
mempool_final();
rathread_final();
#endif
- malloclib->final();
+ iMalloc->final();
return 0;
}
diff --git a/src/common/db.c b/src/common/db.c
index 579697a99..b1fe22a4a 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -1,70 +1,70 @@
/*****************************************************************************\
-* Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-* For more information, see LICENCE in the main folder
-*
-* This file is separated in five sections:
-* (1) Private typedefs, enums, structures, defines and gblobal variables
-* (2) Private functions
-* (3) Protected functions used internally
-* (4) Protected functions used in the interface of the database
-* (5) Public functions
-*
-* The databases are structured as a hashtable of RED-BLACK trees.
-*
-* <B>Properties of the RED-BLACK trees being used:</B>
-* 1. The value of any node is greater than the value of its left child and
-* less than the value of its right child.
-* 2. Every node is colored either RED or BLACK.
-* 3. Every red node that is not a leaf has only black children.
-* 4. Every path from the root to a leaf contains the same number of black
-* nodes.
-* 5. The root node is black.
-* An <code>n</code> node in a RED-BLACK tree has the property that its
-* height is <code>O(lg(n))</code>.
-* Another important property is that after adding a node to a RED-BLACK
-* tree, the tree can be readjusted in <code>O(lg(n))</code> time.
-* Similarly, after deleting a node from a RED-BLACK tree, the tree can be
-* readjusted in <code>O(lg(n))</code> time.
-* {@link http://www.cs.mcgill.ca/~cs251/OldCourses/1997/topic18/}
-*
-* <B>How to add new database types:</B>
-* 1. Add the identifier of the new database type to the enum DBType
-* 2. If not already there, add the data type of the key to the union DBKey
-* 3. If the key can be considered NULL, update the function db_is_key_null
-* 4. If the key can be duplicated, update the functions db_dup_key and
-* db_dup_key_free
-* 5. Create a comparator and update the function db_default_cmp
-* 6. Create a hasher and update the function db_default_hash
-* 7. If the new database type requires or does not support some options,
-* update the function db_fix_options
-*
-* TODO:
-* - create test cases to test the database system thoroughly
-* - finish this header describing the database system
-* - create custom database allocator
-* - make the system thread friendly
-* - change the structure of the database to T-Trees
-* - create a db that organizes itself by splaying
-*
-* HISTORY:
-* 2013/04/27 - Added ERS to speed up iterator memory allocation [Ind/Hercules]
-* 2012/03/09 - Added enum for data types (int, uint, void*)
-* 2008/02/19 - Fixed db_obj_get not handling deleted entries correctly.
-* 2007/11/09 - Added an iterator to the database.
-* 2006/12/21 - Added 1-node cache to the database.
-* 2.1 (Athena build #???#) - Portability fix
-* - Fixed the portability of casting to union and added the functions
-* ensure and clear to the database.
-* 2.0 (Athena build 4859) - Transition version
-* - Almost everything recoded with a strategy similar to objects,
-* database structure is maintained.
-* 1.0 (up to Athena build 4706)
-* - Previous database system.
-*
-* @version 2006/12/21
-* @author Athena Dev team
-* @encoding US-ASCII
-* @see #db.h
+ * Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+ * For more information, see LICENCE in the main folder
+ *
+ * This file is separated in five sections:
+ * (1) Private typedefs, enums, structures, defines and gblobal variables
+ * (2) Private functions
+ * (3) Protected functions used internally
+ * (4) Protected functions used in the interface of the database
+ * (5) Public functions
+ *
+ * The databases are structured as a hashtable of RED-BLACK trees.
+ *
+ * <B>Properties of the RED-BLACK trees being used:</B>
+ * 1. The value of any node is greater than the value of its left child and
+ * less than the value of its right child.
+ * 2. Every node is colored either RED or BLACK.
+ * 3. Every red node that is not a leaf has only black children.
+ * 4. Every path from the root to a leaf contains the same number of black
+ * nodes.
+ * 5. The root node is black.
+ * An <code>n</code> node in a RED-BLACK tree has the property that its
+ * height is <code>O(lg(n))</code>.
+ * Another important property is that after adding a node to a RED-BLACK
+ * tree, the tree can be readjusted in <code>O(lg(n))</code> time.
+ * Similarly, after deleting a node from a RED-BLACK tree, the tree can be
+ * readjusted in <code>O(lg(n))</code> time.
+ * {@link http://www.cs.mcgill.ca/~cs251/OldCourses/1997/topic18/}
+ *
+ * <B>How to add new database types:</B>
+ * 1. Add the identifier of the new database type to the enum DBType
+ * 2. If not already there, add the data type of the key to the union DBKey
+ * 3. If the key can be considered NULL, update the function db_is_key_null
+ * 4. If the key can be duplicated, update the functions db_dup_key and
+ * db_dup_key_free
+ * 5. Create a comparator and update the function db_default_cmp
+ * 6. Create a hasher and update the function db_default_hash
+ * 7. If the new database type requires or does not support some options,
+ * update the function db_fix_options
+ *
+ * TODO:
+ * - create test cases to test the database system thoroughly
+ * - finish this header describing the database system
+ * - create custom database allocator
+ * - make the system thread friendly
+ * - change the structure of the database to T-Trees
+ * - create a db that organizes itself by splaying
+ *
+ * HISTORY:
+ * 2013/04/27 - Added ERS to speed up iterator memory allocation [Ind/Hercules]
+ * 2012/03/09 - Added enum for data types (int, uint, void*)
+ * 2008/02/19 - Fixed db_obj_get not handling deleted entries correctly.
+ * 2007/11/09 - Added an iterator to the database.
+ * 2006/12/21 - Added 1-node cache to the database.
+ * 2.1 (Athena build #???#) - Portability fix
+ * - Fixed the portability of casting to union and added the functions
+ * ensure and clear to the database.
+ * 2.0 (Athena build 4859) - Transition version
+ * - Almost everything recoded with a strategy similar to objects,
+ * database structure is maintained.
+ * 1.0 (up to Athena build 4706)
+ * - Previous database system.
+ *
+ * @version 2006/12/21
+ * @author Athena Dev team
+ * @encoding US-ASCII
+ * @see #db.h
\*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
@@ -77,58 +77,58 @@
#include "../common/strlib.h"
/*****************************************************************************\
-* (1) Private typedefs, enums, structures, defines and global variables of *
-* the database system. *
-* DB_ENABLE_STATS - Define to enable database statistics. *
-* HASH_SIZE - Define with the size of the hashtable. *
-* DBNColor - Enumeration of colors of the nodes. *
-* DBNode - Structure of a node in RED-BLACK trees. *
-* struct db_free - Structure that holds a deleted node to be freed. *
-* DBMap_impl - Struture of the database. *
-* stats - Statistics about the database system. *
+ * (1) Private typedefs, enums, structures, defines and global variables of *
+ * the database system. *
+ * DB_ENABLE_STATS - Define to enable database statistics. *
+ * HASH_SIZE - Define with the size of the hashtable. *
+ * DBNColor - Enumeration of colors of the nodes. *
+ * DBNode - Structure of a node in RED-BLACK trees. *
+ * struct db_free - Structure that holds a deleted node to be freed. *
+ * DBMap_impl - Struture of the database. *
+ * stats - Statistics about the database system. *
\*****************************************************************************/
/**
-* If defined statistics about database nodes, database creating/destruction
-* and function usage are keept and displayed when finalizing the database
-* system.
-* WARNING: This adds overhead to every database operation (not shure how much).
-* @private
-* @see #DBStats
-* @see #stats
-* @see #db_final(void)
-*/
+ * If defined statistics about database nodes, database creating/destruction
+ * and function usage are keept and displayed when finalizing the database
+ * system.
+ * WARNING: This adds overhead to every database operation (not shure how much).
+ * @private
+ * @see #DBStats
+ * @see #stats
+ * @see #db_final(void)
+ */
//#define DB_ENABLE_STATS
/**
-* Size of the hashtable in the database.
-* @private
-* @see DBMap_impl#ht
-*/
+ * Size of the hashtable in the database.
+ * @private
+ * @see DBMap_impl#ht
+ */
#define HASH_SIZE (256+27)
/**
-* The color of individual nodes.
-* @private
-* @see struct dbn
-*/
+ * The color of individual nodes.
+ * @private
+ * @see struct dbn
+ */
typedef enum node_color {
RED,
BLACK
} node_color;
/**
-* A node in a RED-BLACK tree of the database.
-* @param parent Parent node
-* @param left Left child node
-* @param right Right child node
-* @param key Key of this database entry
-* @param data Data of this database entry
-* @param deleted If the node is deleted
-* @param color Color of the node
-* @private
-* @see DBMap_impl#ht
-*/
+ * A node in a RED-BLACK tree of the database.
+ * @param parent Parent node
+ * @param left Left child node
+ * @param right Right child node
+ * @param key Key of this database entry
+ * @param data Data of this database entry
+ * @param deleted If the node is deleted
+ * @param color Color of the node
+ * @private
+ * @see DBMap_impl#ht
+ */
typedef struct dbn {
// Tree structure
struct dbn *parent;
@@ -143,39 +143,39 @@ typedef struct dbn {
} *DBNode;
/**
-* Structure that holds a deleted node.
-* @param node Deleted node
-* @param root Address to the root of the tree
-* @private
-* @see DBMap_impl#free_list
-*/
+ * Structure that holds a deleted node.
+ * @param node Deleted node
+ * @param root Address to the root of the tree
+ * @private
+ * @see DBMap_impl#free_list
+ */
struct db_free {
DBNode node;
DBNode *root;
};
/**
-* Complete database structure.
-* @param vtable Interface of the database
-* @param alloc_file File where the database was allocated
-* @param alloc_line Line in the file where the database was allocated
-* @param free_list Array of deleted nodes to be freed
-* @param free_count Number of deleted nodes in free_list
-* @param free_max Current maximum capacity of free_list
-* @param free_lock Lock for freeing the nodes
-* @param nodes Manager of reusable tree nodes
-* @param cmp Comparator of the database
-* @param hash Hasher of the database
-* @param release Releaser of the database
-* @param ht Hashtable of RED-BLACK trees
-* @param type Type of the database
-* @param options Options of the database
-* @param item_count Number of items in the database
-* @param maxlen Maximum length of strings in DB_STRING and DB_ISTRING databases
-* @param global_lock Global lock of the database
-* @private
-* @see #db_alloc(const char*,int,DBType,DBOptions,unsigned short)
-*/
+ * Complete database structure.
+ * @param vtable Interface of the database
+ * @param alloc_file File where the database was allocated
+ * @param alloc_line Line in the file where the database was allocated
+ * @param free_list Array of deleted nodes to be freed
+ * @param free_count Number of deleted nodes in free_list
+ * @param free_max Current maximum capacity of free_list
+ * @param free_lock Lock for freeing the nodes
+ * @param nodes Manager of reusable tree nodes
+ * @param cmp Comparator of the database
+ * @param hash Hasher of the database
+ * @param release Releaser of the database
+ * @param ht Hashtable of RED-BLACK trees
+ * @param type Type of the database
+ * @param options Options of the database
+ * @param item_count Number of items in the database
+ * @param maxlen Maximum length of strings in DB_STRING and DB_ISTRING databases
+ * @param global_lock Global lock of the database
+ * @private
+ * @see #db_alloc(const char*,int,DBType,DBOptions,unsigned short)
+ */
typedef struct DBMap_impl {
// Database interface
struct DBMap vtable;
@@ -202,16 +202,16 @@ typedef struct DBMap_impl {
} DBMap_impl;
/**
-* Complete iterator structure.
-* @param vtable Interface of the iterator
-* @param db Parent database
-* @param ht_index Current index of the hashtable
-* @param node Current node
-* @private
-* @see #DBIterator
-* @see #DBMap_impl
-* @see #DBNode
-*/
+ * Complete iterator structure.
+ * @param vtable Interface of the iterator
+ * @param db Parent database
+ * @param ht_index Current index of the hashtable
+ * @param node Current node
+ * @private
+ * @see #DBIterator
+ * @see #DBMap_impl
+ * @see #DBNode
+ */
typedef struct DBIterator_impl {
// Iterator interface
struct DBIterator vtable;
@@ -222,11 +222,11 @@ typedef struct DBIterator_impl {
#if defined(DB_ENABLE_STATS)
/**
-* Structure with what is counted when the database statistics are enabled.
-* @private
-* @see #DB_ENABLE_STATS
-* @see #stats
-*/
+ * Structure with what is counted when the database statistics are enabled.
+ * @private
+ * @see #DB_ENABLE_STATS
+ * @see #stats
+ */
static struct db_stats {
// Node alloc/free
uint32 db_node_alloc;
@@ -325,30 +325,30 @@ struct eri *db_iterator_ers;
struct eri *db_alloc_ers;
/*****************************************************************************\
-* (2) Section of private functions used by the database system. *
-* db_rotate_left - Rotate a tree node to the left. *
-* db_rotate_right - Rotate a tree node to the right. *
-* db_rebalance - Rebalance the tree. *
-* db_rebalance_erase - Rebalance the tree after a BLACK node was erased. *
-* db_is_key_null - Returns not 0 if the key is considered NULL. *
-* db_dup_key - Duplicate a key for internal use. *
-* db_dup_key_free - Free the duplicated key. *
-* db_free_add - Add a node to the free_list of a database. *
-* db_free_remove - Remove a node from the free_list of a database. *
-* db_free_lock - Increment the free_lock of a database. *
-* db_free_unlock - Decrement the free_lock of a database. *
-* If it was the last lock, frees the nodes in free_list. *
-* NOTE: Keeps the database trees balanced. *
+ * (2) Section of private functions used by the database system. *
+ * db_rotate_left - Rotate a tree node to the left. *
+ * db_rotate_right - Rotate a tree node to the right. *
+ * db_rebalance - Rebalance the tree. *
+ * db_rebalance_erase - Rebalance the tree after a BLACK node was erased. *
+ * db_is_key_null - Returns not 0 if the key is considered NULL. *
+ * db_dup_key - Duplicate a key for internal use. *
+ * db_dup_key_free - Free the duplicated key. *
+ * db_free_add - Add a node to the free_list of a database. *
+ * db_free_remove - Remove a node from the free_list of a database. *
+ * db_free_lock - Increment the free_lock of a database. *
+ * db_free_unlock - Decrement the free_lock of a database. *
+ * If it was the last lock, frees the nodes in free_list. *
+ * NOTE: Keeps the database trees balanced. *
\*****************************************************************************/
/**
-* Rotate a node to the left.
-* @param node Node to be rotated
-* @param root Pointer to the root of the tree
-* @private
-* @see #db_rebalance(DBNode,DBNode *)
-* @see #db_rebalance_erase(DBNode,DBNode *)
-*/
+ * Rotate a node to the left.
+ * @param node Node to be rotated
+ * @param root Pointer to the root of the tree
+ * @private
+ * @see #db_rebalance(DBNode,DBNode *)
+ * @see #db_rebalance_erase(DBNode,DBNode *)
+ */
static void db_rotate_left(DBNode node, DBNode *root)
{
DBNode y = node->right;
@@ -373,13 +373,13 @@ static void db_rotate_left(DBNode node, DBNode *root)
}
/**
-* Rotate a node to the right
-* @param node Node to be rotated
-* @param root Pointer to the root of the tree
-* @private
-* @see #db_rebalance(DBNode,DBNode *)
-* @see #db_rebalance_erase(DBNode,DBNode *)
-*/
+ * Rotate a node to the right
+ * @param node Node to be rotated
+ * @param root Pointer to the root of the tree
+ * @private
+ * @see #db_rebalance(DBNode,DBNode *)
+ * @see #db_rebalance_erase(DBNode,DBNode *)
+ */
static void db_rotate_right(DBNode node, DBNode *root)
{
DBNode y = node->left;
@@ -404,15 +404,15 @@ static void db_rotate_right(DBNode node, DBNode *root)
}
/**
-* Rebalance the RED-BLACK tree.
-* Called when the node and it's parent are both RED.
-* @param node Node to be rebalanced
-* @param root Pointer to the root of the tree
-* @private
-* @see #db_rotate_left(DBNode,DBNode *)
-* @see #db_rotate_right(DBNode,DBNode *)
-* @see #db_obj_put(DBMap*,DBKey,DBData)
-*/
+ * Rebalance the RED-BLACK tree.
+ * Called when the node and it's parent are both RED.
+ * @param node Node to be rebalanced
+ * @param root Pointer to the root of the tree
+ * @private
+ * @see #db_rotate_left(DBNode,DBNode *)
+ * @see #db_rotate_right(DBNode,DBNode *)
+ * @see #db_obj_put(DBMap*,DBKey,DBData)
+ */
static void db_rebalance(DBNode node, DBNode *root)
{
DBNode y;
@@ -467,14 +467,14 @@ static void db_rebalance(DBNode node, DBNode *root)
}
/**
-* Erase a node from the RED-BLACK tree, keeping the tree balanced.
-* @param node Node to be erased from the tree
-* @param root Root of the tree
-* @private
-* @see #db_rotate_left(DBNode,DBNode *)
-* @see #db_rotate_right(DBNode,DBNode *)
-* @see #db_free_unlock(DBMap_impl*)
-*/
+ * Erase a node from the RED-BLACK tree, keeping the tree balanced.
+ * @param node Node to be erased from the tree
+ * @param root Root of the tree
+ * @private
+ * @see #db_rotate_left(DBNode,DBNode *)
+ * @see #db_rotate_right(DBNode,DBNode *)
+ * @see #db_free_unlock(DBMap_impl*)
+ */
static void db_rebalance_erase(DBNode node, DBNode *root)
{
DBNode y = node;
@@ -558,9 +558,9 @@ static void db_rebalance_erase(DBNode node, DBNode *root)
}
if ((w->left == NULL || w->left->color == BLACK) &&
(w->right == NULL || w->right->color == BLACK)) {
- w->color = RED;
- x = x_parent;
- x_parent = x_parent->parent;
+ w->color = RED;
+ x = x_parent;
+ x_parent = x_parent->parent;
} else {
if (w->right == NULL || w->right->color == BLACK) {
if (w->left) w->left->color = BLACK;
@@ -584,9 +584,9 @@ static void db_rebalance_erase(DBNode node, DBNode *root)
}
if ((w->right == NULL || w->right->color == BLACK) &&
(w->left == NULL || w->left->color == BLACK)) {
- w->color = RED;
- x = x_parent;
- x_parent = x_parent->parent;
+ w->color = RED;
+ x = x_parent;
+ x_parent = x_parent->parent;
} else {
if (w->left == NULL || w->left->color == BLACK) {
if (w->right) w->right->color = BLACK;
@@ -607,39 +607,39 @@ static void db_rebalance_erase(DBNode node, DBNode *root)
}
/**
-* Returns not 0 if the key is considered to be NULL.
-* @param type Type of database
-* @param key Key being tested
-* @return not 0 if considered NULL, 0 otherwise
-* @private
-* @see #db_obj_get(DBMap*,DBKey)
-* @see #db_obj_put(DBMap*,DBKey,DBData)
-* @see #db_obj_remove(DBMap*,DBKey)
-*/
+ * Returns not 0 if the key is considered to be NULL.
+ * @param type Type of database
+ * @param key Key being tested
+ * @return not 0 if considered NULL, 0 otherwise
+ * @private
+ * @see #db_obj_get(DBMap*,DBKey)
+ * @see #db_obj_put(DBMap*,DBKey,DBData)
+ * @see #db_obj_remove(DBMap*,DBKey)
+ */
static int db_is_key_null(DBType type, DBKey key)
{
DB_COUNTSTAT(db_is_key_null);
switch (type) {
- case DB_STRING:
- case DB_ISTRING:
- return (key.str == NULL);
+ case DB_STRING:
+ case DB_ISTRING:
+ return (key.str == NULL);
- default: // Not a pointer
- return 0;
+ default: // Not a pointer
+ return 0;
}
}
/**
-* Duplicate the key used in the database.
-* @param db Database the key is being used in
-* @param key Key to be duplicated
-* @param Duplicated key
-* @private
-* @see #db_free_add(DBMap_impl*,DBNode,DBNode *)
-* @see #db_free_remove(DBMap_impl*,DBNode)
-* @see #db_obj_put(DBMap*,DBKey,void *)
-* @see #db_dup_key_free(DBMap_impl*,DBKey)
-*/
+ * Duplicate the key used in the database.
+ * @param db Database the key is being used in
+ * @param key Key to be duplicated
+ * @param Duplicated key
+ * @private
+ * @see #db_free_add(DBMap_impl*,DBNode,DBNode *)
+ * @see #db_free_remove(DBMap_impl*,DBNode)
+ * @see #db_obj_put(DBMap*,DBKey,void *)
+ * @see #db_dup_key_free(DBMap_impl*,DBKey)
+ */
static DBKey db_dup_key(DBMap_impl* db, DBKey key)
{
char *str;
@@ -647,56 +647,56 @@ static DBKey db_dup_key(DBMap_impl* db, DBKey key)
DB_COUNTSTAT(db_dup_key);
switch (db->type) {
- case DB_STRING:
- case DB_ISTRING:
- len = strnlen(key.str, db->maxlen);
- str = (char*)aMalloc(len + 1);
- memcpy(str, key.str, len);
- str[len] = '\0';
- key.str = str;
- return key;
-
- default:
- return key;
+ case DB_STRING:
+ case DB_ISTRING:
+ len = strnlen(key.str, db->maxlen);
+ str = (char*)aMalloc(len + 1);
+ memcpy(str, key.str, len);
+ str[len] = '\0';
+ key.str = str;
+ return key;
+
+ default:
+ return key;
}
}
/**
-* Free a key duplicated by db_dup_key.
-* @param db Database the key is being used in
-* @param key Key to be freed
-* @private
-* @see #db_dup_key(DBMap_impl*,DBKey)
-*/
+ * Free a key duplicated by db_dup_key.
+ * @param db Database the key is being used in
+ * @param key Key to be freed
+ * @private
+ * @see #db_dup_key(DBMap_impl*,DBKey)
+ */
static void db_dup_key_free(DBMap_impl* db, DBKey key)
{
DB_COUNTSTAT(db_dup_key_free);
switch (db->type) {
- case DB_STRING:
- case DB_ISTRING:
- aFree((char*)key.str);
- return;
+ case DB_STRING:
+ case DB_ISTRING:
+ aFree((char*)key.str);
+ return;
- default:
- return;
+ default:
+ return;
}
}
/**
-* Add a node to the free_list of the database.
-* Marks the node as deleted.
-* If the key isn't duplicated, the key is duplicated and released.
-* @param db Target database
-* @param root Root of the tree from the node
-* @param node Target node
-* @private
-* @see #struct db_free
-* @see DBMap_impl#free_list
-* @see DBMap_impl#free_count
-* @see DBMap_impl#free_max
-* @see #db_obj_remove(DBMap*,DBKey)
-* @see #db_free_remove(DBMap_impl*,DBNode)
-*/
+ * Add a node to the free_list of the database.
+ * Marks the node as deleted.
+ * If the key isn't duplicated, the key is duplicated and released.
+ * @param db Target database
+ * @param root Root of the tree from the node
+ * @param node Target node
+ * @private
+ * @see #struct db_free
+ * @see DBMap_impl#free_list
+ * @see DBMap_impl#free_count
+ * @see DBMap_impl#free_max
+ * @see #db_obj_remove(DBMap*,DBKey)
+ * @see #db_free_remove(DBMap_impl*,DBNode)
+ */
static void db_free_add(DBMap_impl* db, DBNode node, DBNode *root)
{
DBKey old_key;
@@ -704,8 +704,8 @@ static void db_free_add(DBMap_impl* db, DBNode node, DBNode *root)
DB_COUNTSTAT(db_free_add);
if (db->free_lock == (unsigned int)~0) {
ShowFatalError("db_free_add: free_lock overflow\n"
- "Database allocated at %s:%d\n",
- db->alloc_file, db->alloc_line);
+ "Database allocated at %s:%d\n",
+ db->alloc_file, db->alloc_line);
exit(EXIT_FAILURE);
}
if (!(db->options&DB_OPT_DUP_KEY)) { // Make sure we have a key until the node is freed
@@ -718,8 +718,8 @@ static void db_free_add(DBMap_impl* db, DBNode node, DBNode *root)
if (db->free_max <= db->free_count) {
if (db->free_count == (unsigned int)~0) {
ShowFatalError("db_free_add: free_count overflow\n"
- "Database allocated at %s:%d\n",
- db->alloc_file, db->alloc_line);
+ "Database allocated at %s:%d\n",
+ db->alloc_file, db->alloc_line);
exit(EXIT_FAILURE);
}
db->free_max = (unsigned int)~0;
@@ -734,18 +734,18 @@ static void db_free_add(DBMap_impl* db, DBNode node, DBNode *root)
}
/**
-* Remove a node from the free_list of the database.
-* Marks the node as not deleted.
-* NOTE: Frees the duplicated key of the node.
-* @param db Target database
-* @param node Node being removed from free_list
-* @private
-* @see #struct db_free
-* @see DBMap_impl#free_list
-* @see DBMap_impl#free_count
-* @see #db_obj_put(DBMap*,DBKey,DBData)
-* @see #db_free_add(DBMap_impl*,DBNode*,DBNode)
-*/
+ * Remove a node from the free_list of the database.
+ * Marks the node as not deleted.
+ * NOTE: Frees the duplicated key of the node.
+ * @param db Target database
+ * @param node Node being removed from free_list
+ * @private
+ * @see #struct db_free
+ * @see DBMap_impl#free_list
+ * @see DBMap_impl#free_count
+ * @see #db_obj_put(DBMap*,DBKey,DBData)
+ * @see #db_free_add(DBMap_impl*,DBNode*,DBNode)
+ */
static void db_free_remove(DBMap_impl* db, DBNode node)
{
unsigned int i;
@@ -769,35 +769,35 @@ static void db_free_remove(DBMap_impl* db, DBNode node)
}
/**
-* Increment the free_lock of the database.
-* @param db Target database
-* @private
-* @see DBMap_impl#free_lock
-* @see #db_unlock(DBMap_impl*)
-*/
+ * Increment the free_lock of the database.
+ * @param db Target database
+ * @private
+ * @see DBMap_impl#free_lock
+ * @see #db_unlock(DBMap_impl*)
+ */
static void db_free_lock(DBMap_impl* db)
{
DB_COUNTSTAT(db_free_lock);
if (db->free_lock == (unsigned int)~0) {
ShowFatalError("db_free_lock: free_lock overflow\n"
- "Database allocated at %s:%d\n",
- db->alloc_file, db->alloc_line);
+ "Database allocated at %s:%d\n",
+ db->alloc_file, db->alloc_line);
exit(EXIT_FAILURE);
}
db->free_lock++;
}
/**
-* Decrement the free_lock of the database.
-* If it was the last lock, frees the nodes of the database.
-* Keeps the tree balanced.
-* NOTE: Frees the duplicated keys of the nodes
-* @param db Target database
-* @private
-* @see DBMap_impl#free_lock
-* @see #db_free_dbn(DBNode)
-* @see #db_lock(DBMap_impl*)
-*/
+ * Decrement the free_lock of the database.
+ * If it was the last lock, frees the nodes of the database.
+ * Keeps the tree balanced.
+ * NOTE: Frees the duplicated keys of the nodes
+ * @param db Target database
+ * @private
+ * @see DBMap_impl#free_lock
+ * @see #db_free_dbn(DBNode)
+ * @see #db_lock(DBMap_impl*)
+ */
static void db_free_unlock(DBMap_impl* db)
{
unsigned int i;
@@ -805,8 +805,8 @@ static void db_free_unlock(DBMap_impl* db)
DB_COUNTSTAT(db_free_unlock);
if (db->free_lock == 0) {
ShowWarning("db_free_unlock: free_lock was already 0\n"
- "Database allocated at %s:%d\n",
- db->alloc_file, db->alloc_line);
+ "Database allocated at %s:%d\n",
+ db->alloc_file, db->alloc_line);
} else {
db->free_lock--;
}
@@ -823,36 +823,36 @@ static void db_free_unlock(DBMap_impl* db)
}
/*****************************************************************************\
-* (3) Section of protected functions used internally. *
-* NOTE: the protected functions used in the database interface are in the *
-* next section. *
-* db_int_cmp - Default comparator for DB_INT databases. *
-* db_uint_cmp - Default comparator for DB_UINT databases. *
-* db_string_cmp - Default comparator for DB_STRING databases. *
-* db_istring_cmp - Default comparator for DB_ISTRING databases. *
-* db_int_hash - Default hasher for DB_INT databases. *
-* db_uint_hash - Default hasher for DB_UINT databases. *
-* db_string_hash - Default hasher for DB_STRING databases. *
-* db_istring_hash - Default hasher for DB_ISTRING databases. *
-* db_release_nothing - Releaser that releases nothing. *
-* db_release_key - Releaser that only releases the key. *
-* db_release_data - Releaser that only releases the data. *
-* db_release_both - Releaser that releases key and data. *
+ * (3) Section of protected functions used internally. *
+ * NOTE: the protected functions used in the database interface are in the *
+ * next section. *
+ * db_int_cmp - Default comparator for DB_INT databases. *
+ * db_uint_cmp - Default comparator for DB_UINT databases. *
+ * db_string_cmp - Default comparator for DB_STRING databases. *
+ * db_istring_cmp - Default comparator for DB_ISTRING databases. *
+ * db_int_hash - Default hasher for DB_INT databases. *
+ * db_uint_hash - Default hasher for DB_UINT databases. *
+ * db_string_hash - Default hasher for DB_STRING databases. *
+ * db_istring_hash - Default hasher for DB_ISTRING databases. *
+ * db_release_nothing - Releaser that releases nothing. *
+ * db_release_key - Releaser that only releases the key. *
+ * db_release_data - Releaser that only releases the data. *
+ * db_release_both - Releaser that releases key and data. *
\*****************************************************************************/
/**
-* Default comparator for DB_INT databases.
-* Compares key1 to key2.
-* Return 0 if equal, negative if lower and positive if higher.
-* <code>maxlen</code> is ignored.
-* @param key1 Key to be compared
-* @param key2 Key being compared to
-* @param maxlen Maximum length of the key to hash
-* @return 0 if equal, negative if lower and positive if higher
-* @see DBType#DB_INT
-* @see #DBComparator
-* @see #db_default_cmp(DBType)
-*/
+ * Default comparator for DB_INT databases.
+ * Compares key1 to key2.
+ * Return 0 if equal, negative if lower and positive if higher.
+ * <code>maxlen</code> is ignored.
+ * @param key1 Key to be compared
+ * @param key2 Key being compared to
+ * @param maxlen Maximum length of the key to hash
+ * @return 0 if equal, negative if lower and positive if higher
+ * @see DBType#DB_INT
+ * @see #DBComparator
+ * @see #db_default_cmp(DBType)
+ */
static int db_int_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
{
(void)maxlen;//not used
@@ -863,18 +863,18 @@ static int db_int_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
}
/**
-* Default comparator for DB_UINT databases.
-* Compares key1 to key2.
-* Return 0 if equal, negative if lower and positive if higher.
-* <code>maxlen</code> is ignored.
-* @param key1 Key to be compared
-* @param key2 Key being compared to
-* @param maxlen Maximum length of the key to hash
-* @return 0 if equal, negative if lower and positive if higher
-* @see DBType#DB_UINT
-* @see #DBComparator
-* @see #db_default_cmp(DBType)
-*/
+ * Default comparator for DB_UINT databases.
+ * Compares key1 to key2.
+ * Return 0 if equal, negative if lower and positive if higher.
+ * <code>maxlen</code> is ignored.
+ * @param key1 Key to be compared
+ * @param key2 Key being compared to
+ * @param maxlen Maximum length of the key to hash
+ * @return 0 if equal, negative if lower and positive if higher
+ * @see DBType#DB_UINT
+ * @see #DBComparator
+ * @see #db_default_cmp(DBType)
+ */
static int db_uint_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
{
(void)maxlen;//not used
@@ -885,17 +885,17 @@ static int db_uint_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
}
/**
-* Default comparator for DB_STRING databases.
-* Compares key1 to key2.
-* Return 0 if equal, negative if lower and positive if higher.
-* @param key1 Key to be compared
-* @param key2 Key being compared to
-* @param maxlen Maximum length of the key to hash
-* @return 0 if equal, negative if lower and positive if higher
-* @see DBType#DB_STRING
-* @see #DBComparator
-* @see #db_default_cmp(DBType)
-*/
+ * Default comparator for DB_STRING databases.
+ * Compares key1 to key2.
+ * Return 0 if equal, negative if lower and positive if higher.
+ * @param key1 Key to be compared
+ * @param key2 Key being compared to
+ * @param maxlen Maximum length of the key to hash
+ * @return 0 if equal, negative if lower and positive if higher
+ * @see DBType#DB_STRING
+ * @see #DBComparator
+ * @see #db_default_cmp(DBType)
+ */
static int db_string_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
{
DB_COUNTSTAT(db_string_cmp);
@@ -903,17 +903,17 @@ static int db_string_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
}
/**
-* Default comparator for DB_ISTRING databases.
-* Compares key1 to key2 case insensitively.
-* Return 0 if equal, negative if lower and positive if higher.
-* @param key1 Key to be compared
-* @param key2 Key being compared to
-* @param maxlen Maximum length of the key to hash
-* @return 0 if equal, negative if lower and positive if higher
-* @see DBType#DB_ISTRING
-* @see #DBComparator
-* @see #db_default_cmp(DBType)
-*/
+ * Default comparator for DB_ISTRING databases.
+ * Compares key1 to key2 case insensitively.
+ * Return 0 if equal, negative if lower and positive if higher.
+ * @param key1 Key to be compared
+ * @param key2 Key being compared to
+ * @param maxlen Maximum length of the key to hash
+ * @return 0 if equal, negative if lower and positive if higher
+ * @see DBType#DB_ISTRING
+ * @see #DBComparator
+ * @see #db_default_cmp(DBType)
+ */
static int db_istring_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
{
DB_COUNTSTAT(db_istring_cmp);
@@ -921,16 +921,16 @@ static int db_istring_cmp(DBKey key1, DBKey key2, unsigned short maxlen)
}
/**
-* Default hasher for DB_INT databases.
-* Returns the value of the key as an unsigned int.
-* <code>maxlen</code> is ignored.
-* @param key Key to be hashed
-* @param maxlen Maximum length of the key to hash
-* @return hash of the key
-* @see DBType#DB_INT
-* @see #DBHasher
-* @see #db_default_hash(DBType)
-*/
+ * Default hasher for DB_INT databases.
+ * Returns the value of the key as an unsigned int.
+ * <code>maxlen</code> is ignored.
+ * @param key Key to be hashed
+ * @param maxlen Maximum length of the key to hash
+ * @return hash of the key
+ * @see DBType#DB_INT
+ * @see #DBHasher
+ * @see #db_default_hash(DBType)
+ */
static unsigned int db_int_hash(DBKey key, unsigned short maxlen)
{
(void)maxlen;//not used
@@ -939,16 +939,16 @@ static unsigned int db_int_hash(DBKey key, unsigned short maxlen)
}
/**
-* Default hasher for DB_UINT databases.
-* Just returns the value of the key.
-* <code>maxlen</code> is ignored.
-* @param key Key to be hashed
-* @param maxlen Maximum length of the key to hash
-* @return hash of the key
-* @see DBType#DB_UINT
-* @see #DBHasher
-* @see #db_default_hash(DBType)
-*/
+ * Default hasher for DB_UINT databases.
+ * Just returns the value of the key.
+ * <code>maxlen</code> is ignored.
+ * @param key Key to be hashed
+ * @param maxlen Maximum length of the key to hash
+ * @return hash of the key
+ * @see DBType#DB_UINT
+ * @see #DBHasher
+ * @see #db_default_hash(DBType)
+ */
static unsigned int db_uint_hash(DBKey key, unsigned short maxlen)
{
(void)maxlen;//not used
@@ -957,14 +957,14 @@ static unsigned int db_uint_hash(DBKey key, unsigned short maxlen)
}
/**
-* Default hasher for DB_STRING databases.
-* @param key Key to be hashed
-* @param maxlen Maximum length of the key to hash
-* @return hash of the key
-* @see DBType#DB_STRING
-* @see #DBHasher
-* @see #db_default_hash(DBType)
-*/
+ * Default hasher for DB_STRING databases.
+ * @param key Key to be hashed
+ * @param maxlen Maximum length of the key to hash
+ * @return hash of the key
+ * @see DBType#DB_STRING
+ * @see #DBHasher
+ * @see #db_default_hash(DBType)
+ */
static unsigned int db_string_hash(DBKey key, unsigned short maxlen)
{
const char *k = key.str;
@@ -984,13 +984,13 @@ static unsigned int db_string_hash(DBKey key, unsigned short maxlen)
}
/**
-* Default hasher for DB_ISTRING databases.
-* @param key Key to be hashed
-* @param maxlen Maximum length of the key to hash
-* @return hash of the key
-* @see DBType#DB_ISTRING
-* @see #db_default_hash(DBType)
-*/
+ * Default hasher for DB_ISTRING databases.
+ * @param key Key to be hashed
+ * @param maxlen Maximum length of the key to hash
+ * @return hash of the key
+ * @see DBType#DB_ISTRING
+ * @see #db_default_hash(DBType)
+ */
static unsigned int db_istring_hash(DBKey key, unsigned short maxlen)
{
const char *k = key.str;
@@ -1010,14 +1010,14 @@ static unsigned int db_istring_hash(DBKey key, unsigned short maxlen)
}
/**
-* Releaser that releases nothing.
-* @param key Key of the database entry
-* @param data Data of the database entry
-* @param which What is being requested to be released
-* @protected
-* @see #DBReleaser
-* @see #db_default_releaser(DBType,DBOptions)
-*/
+ * Releaser that releases nothing.
+ * @param key Key of the database entry
+ * @param data Data of the database entry
+ * @param which What is being requested to be released
+ * @protected
+ * @see #DBReleaser
+ * @see #db_default_releaser(DBType,DBOptions)
+ */
static void db_release_nothing(DBKey key, DBData data, DBRelease which)
{
(void)key;(void)data;(void)which;//not used
@@ -1025,14 +1025,14 @@ static void db_release_nothing(DBKey key, DBData data, DBRelease which)
}
/**
-* Releaser that only releases the key.
-* @param key Key of the database entry
-* @param data Data of the database entry
-* @param which What is being requested to be released
-* @protected
-* @see #DBReleaser
-* @see #db_default_release(DBType,DBOptions)
-*/
+ * Releaser that only releases the key.
+ * @param key Key of the database entry
+ * @param data Data of the database entry
+ * @param which What is being requested to be released
+ * @protected
+ * @see #DBReleaser
+ * @see #db_default_release(DBType,DBOptions)
+ */
static void db_release_key(DBKey key, DBData data, DBRelease which)
{
(void)data;//not used
@@ -1041,16 +1041,16 @@ static void db_release_key(DBKey key, DBData data, DBRelease which)
}
/**
-* Releaser that only releases the data.
-* @param key Key of the database entry
-* @param data Data of the database entry
-* @param which What is being requested to be released
-* @protected
-* @see #DBData
-* @see #DBRelease
-* @see #DBReleaser
-* @see #db_default_release(DBType,DBOptions)
-*/
+ * Releaser that only releases the data.
+ * @param key Key of the database entry
+ * @param data Data of the database entry
+ * @param which What is being requested to be released
+ * @protected
+ * @see #DBData
+ * @see #DBRelease
+ * @see #DBReleaser
+ * @see #db_default_release(DBType,DBOptions)
+ */
static void db_release_data(DBKey key, DBData data, DBRelease which)
{
(void)key;//not used
@@ -1059,17 +1059,17 @@ static void db_release_data(DBKey key, DBData data, DBRelease which)
}
/**
-* Releaser that releases both key and data.
-* @param key Key of the database entry
-* @param data Data of the database entry
-* @param which What is being requested to be released
-* @protected
-* @see #DBKey
-* @see #DBData
-* @see #DBRelease
-* @see #DBReleaser
-* @see #db_default_release(DBType,DBOptions)
-*/
+ * Releaser that releases both key and data.
+ * @param key Key of the database entry
+ * @param data Data of the database entry
+ * @param which What is being requested to be released
+ * @protected
+ * @see #DBKey
+ * @see #DBData
+ * @see #DBRelease
+ * @see #DBReleaser
+ * @see #db_default_release(DBType,DBOptions)
+ */
static void db_release_both(DBKey key, DBData data, DBRelease which)
{
DB_COUNTSTAT(db_release_both);
@@ -1078,52 +1078,52 @@ static void db_release_both(DBKey key, DBData data, DBRelease which)
}
/*****************************************************************************\
-* (4) Section with protected functions used in the interface of the *
-* database and interface of the iterator. *
-* dbit_obj_first - Fetches the first entry from the database. *
-* dbit_obj_last - Fetches the last entry from the database. *
-* dbit_obj_next - Fetches the next entry from the database. *
-* dbit_obj_prev - Fetches the previous entry from the database. *
-* dbit_obj_exists - Returns true if the current entry exists. *
-* dbit_obj_remove - Remove the current entry from the database. *
-* dbit_obj_destroy - Destroys the iterator, unlocking the database and *
-* freeing used memory. *
-* db_obj_iterator - Return a new database iterator. *
-* db_obj_exists - Checks if an entry exists. *
-* db_obj_get - Get the data identified by the key. *
-* db_obj_vgetall - Get the data of the matched entries. *
-* db_obj_getall - Get the data of the matched entries. *
-* db_obj_vensure - Get the data identified by the key, creating if it *
-* doesn't exist yet. *
-* db_obj_ensure - Get the data identified by the key, creating if it *
-* doesn't exist yet. *
-* db_obj_put - Put data identified by the key in the database. *
-* db_obj_remove - Remove an entry from the database. *
-* db_obj_vforeach - Apply a function to every entry in the database. *
-* db_obj_foreach - Apply a function to every entry in the database. *
-* db_obj_vclear - Remove all entries from the database. *
-* db_obj_clear - Remove all entries from the database. *
-* db_obj_vdestroy - Destroy the database, freeing all the used memory. *
-* db_obj_destroy - Destroy the database, freeing all the used memory. *
-* db_obj_size - Return the size of the database. *
-* db_obj_type - Return the type of the database. *
-* db_obj_options - Return the options of the database. *
+ * (4) Section with protected functions used in the interface of the *
+ * database and interface of the iterator. *
+ * dbit_obj_first - Fetches the first entry from the database. *
+ * dbit_obj_last - Fetches the last entry from the database. *
+ * dbit_obj_next - Fetches the next entry from the database. *
+ * dbit_obj_prev - Fetches the previous entry from the database. *
+ * dbit_obj_exists - Returns true if the current entry exists. *
+ * dbit_obj_remove - Remove the current entry from the database. *
+ * dbit_obj_destroy - Destroys the iterator, unlocking the database and *
+ * freeing used memory. *
+ * db_obj_iterator - Return a new database iterator. *
+ * db_obj_exists - Checks if an entry exists. *
+ * db_obj_get - Get the data identified by the key. *
+ * db_obj_vgetall - Get the data of the matched entries. *
+ * db_obj_getall - Get the data of the matched entries. *
+ * db_obj_vensure - Get the data identified by the key, creating if it *
+ * doesn't exist yet. *
+ * db_obj_ensure - Get the data identified by the key, creating if it *
+ * doesn't exist yet. *
+ * db_obj_put - Put data identified by the key in the database. *
+ * db_obj_remove - Remove an entry from the database. *
+ * db_obj_vforeach - Apply a function to every entry in the database. *
+ * db_obj_foreach - Apply a function to every entry in the database. *
+ * db_obj_vclear - Remove all entries from the database. *
+ * db_obj_clear - Remove all entries from the database. *
+ * db_obj_vdestroy - Destroy the database, freeing all the used memory. *
+ * db_obj_destroy - Destroy the database, freeing all the used memory. *
+ * db_obj_size - Return the size of the database. *
+ * db_obj_type - Return the type of the database. *
+ * db_obj_options - Return the options of the database. *
\*****************************************************************************/
/**
-* Fetches the first entry in the database.
-* Returns the data of the entry.
-* Puts the key in out_key, if out_key is not NULL.
-* @param self Iterator
-* @param out_key Key of the entry
-* @return Data of the entry
-* @protected
-* @see DBIterator#first
-*/
+ * Fetches the first entry in the database.
+ * Returns the data of the entry.
+ * Puts the key in out_key, if out_key is not NULL.
+ * @param self Iterator
+ * @param out_key Key of the entry
+ * @return Data of the entry
+ * @protected
+ * @see DBIterator#first
+ */
DBData* dbit_obj_first(DBIterator* self, DBKey* out_key)
{
DBIterator_impl* it = (DBIterator_impl*)self;
-
+
DB_COUNTSTAT(dbit_first);
// position before the first entry
it->ht_index = -1;
@@ -1133,19 +1133,19 @@ DBData* dbit_obj_first(DBIterator* self, DBKey* out_key)
}
/**
-* Fetches the last entry in the database.
-* Returns the data of the entry.
-* Puts the key in out_key, if out_key is not NULL.
-* @param self Iterator
-* @param out_key Key of the entry
-* @return Data of the entry
-* @protected
-* @see DBIterator#last
-*/
+ * Fetches the last entry in the database.
+ * Returns the data of the entry.
+ * Puts the key in out_key, if out_key is not NULL.
+ * @param self Iterator
+ * @param out_key Key of the entry
+ * @return Data of the entry
+ * @protected
+ * @see DBIterator#last
+ */
DBData* dbit_obj_last(DBIterator* self, DBKey* out_key)
{
DBIterator_impl* it = (DBIterator_impl*)self;
-
+
DB_COUNTSTAT(dbit_last);
// position after the last entry
it->ht_index = HASH_SIZE;
@@ -1155,15 +1155,15 @@ DBData* dbit_obj_last(DBIterator* self, DBKey* out_key)
}
/**
-* Fetches the next entry in the database.
-* Returns the data of the entry.
-* Puts the key in out_key, if out_key is not NULL.
-* @param self Iterator
-* @param out_key Key of the entry
-* @return Data of the entry
-* @protected
-* @see DBIterator#next
-*/
+ * Fetches the next entry in the database.
+ * Returns the data of the entry.
+ * Puts the key in out_key, if out_key is not NULL.
+ * @param self Iterator
+ * @param out_key Key of the entry
+ * @return Data of the entry
+ * @protected
+ * @see DBIterator#next
+ */
DBData* dbit_obj_next(DBIterator* self, DBKey* out_key)
{
DBIterator_impl* it = (DBIterator_impl*)self;
@@ -1231,15 +1231,15 @@ DBData* dbit_obj_next(DBIterator* self, DBKey* out_key)
}
/**
-* Fetches the previous entry in the database.
-* Returns the data of the entry.
-* Puts the key in out_key, if out_key is not NULL.
-* @param self Iterator
-* @param out_key Key of the entry
-* @return Data of the entry
-* @protected
-* @see DBIterator#prev
-*/
+ * Fetches the previous entry in the database.
+ * Returns the data of the entry.
+ * Puts the key in out_key, if out_key is not NULL.
+ * @param self Iterator
+ * @param out_key Key of the entry
+ * @return Data of the entry
+ * @protected
+ * @see DBIterator#prev
+ */
DBData* dbit_obj_prev(DBIterator* self, DBKey* out_key)
{
DBIterator_impl* it = (DBIterator_impl*)self;
@@ -1267,7 +1267,7 @@ DBData* dbit_obj_prev(DBIterator* self, DBKey* out_key)
node = &fake;
}
-
+
while( node )
{// next node
if( node->left )
@@ -1308,14 +1308,14 @@ DBData* dbit_obj_prev(DBIterator* self, DBKey* out_key)
}
/**
-* Returns true if the fetched entry exists.
-* The databases entries might have NULL data, so use this to to test if
-* the iterator is done.
-* @param self Iterator
-* @return true if the entry exists
-* @protected
-* @see DBIterator#exists
-*/
+ * Returns true if the fetched entry exists.
+ * The databases entries might have NULL data, so use this to to test if
+ * the iterator is done.
+ * @param self Iterator
+ * @return true if the entry exists
+ * @protected
+ * @see DBIterator#exists
+ */
bool dbit_obj_exists(DBIterator* self)
{
DBIterator_impl* it = (DBIterator_impl*)self;
@@ -1325,17 +1325,17 @@ bool dbit_obj_exists(DBIterator* self)
}
/**
-* Removes the current entry from the database.
-* NOTE: {@link DBIterator#exists} will return false until another entry
-* is fetched
-* Puts data of the removed entry in out_data, if out_data is not NULL.
-* @param self Iterator
-* @param out_data Data of the removed entry.
-* @return 1 if entry was removed, 0 otherwise
-* @protected
-* @see DBMap#remove
-* @see DBIterator#remove
-*/
+ * Removes the current entry from the database.
+ * NOTE: {@link DBIterator#exists} will return false until another entry
+ * is fetched
+ * Puts data of the removed entry in out_data, if out_data is not NULL.
+ * @param self Iterator
+ * @param out_data Data of the removed entry.
+ * @return 1 if entry was removed, 0 otherwise
+ * @protected
+ * @see DBMap#remove
+ * @see DBIterator#remove
+ */
int dbit_obj_remove(DBIterator* self, DBData *out_data)
{
DBIterator_impl* it = (DBIterator_impl*)self;
@@ -1359,10 +1359,10 @@ int dbit_obj_remove(DBIterator* self, DBData *out_data)
}
/**
-* Destroys this iterator and unlocks the database.
-* @param self Iterator
-* @protected
-*/
+ * Destroys this iterator and unlocks the database.
+ * @param self Iterator
+ * @protected
+ */
void dbit_obj_destroy(DBIterator* self)
{
DBIterator_impl* it = (DBIterator_impl*)self;
@@ -1375,14 +1375,14 @@ void dbit_obj_destroy(DBIterator* self)
}
/**
-* Returns a new iterator for this database.
-* The iterator keeps the database locked until it is destroyed.
-* The database will keep functioning normally but will only free internal
-* memory when unlocked, so destroy the iterator as soon as possible.
-* @param self Database
-* @return New iterator
-* @protected
-*/
+ * Returns a new iterator for this database.
+ * The iterator keeps the database locked until it is destroyed.
+ * The database will keep functioning normally but will only free internal
+ * memory when unlocked, so destroy the iterator as soon as possible.
+ * @param self Database
+ * @return New iterator
+ * @protected
+ */
static DBIterator* db_obj_iterator(DBMap* self)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -1408,13 +1408,13 @@ static DBIterator* db_obj_iterator(DBMap* self)
}
/**
-* Returns true if the entry exists.
-* @param self Interface of the database
-* @param key Key that identifies the entry
-* @return true is the entry exists
-* @protected
-* @see DBMap#exists
-*/
+ * Returns true if the entry exists.
+ * @param self Interface of the database
+ * @param key Key that identifies the entry
+ * @return true is the entry exists
+ * @protected
+ * @see DBMap#exists
+ */
static bool db_obj_exists(DBMap* self, DBKey key)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -1459,13 +1459,13 @@ static bool db_obj_exists(DBMap* self, DBKey key)
}
/**
-* Get the data of the entry identified by the key.
-* @param self Interface of the database
-* @param key Key that identifies the entry
-* @return Data of the entry or NULL if not found
-* @protected
-* @see DBMap#get
-*/
+ * Get the data of the entry identified by the key.
+ * @param self Interface of the database
+ * @param key Key that identifies the entry
+ * @return Data of the entry or NULL if not found
+ * @protected
+ * @see DBMap#get
+ */
static DBData* db_obj_get(DBMap* self, DBKey key)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -1511,21 +1511,21 @@ static DBData* db_obj_get(DBMap* self, DBKey key)
}
/**
-* Get the data of the entries matched by <code>match</code>.
-* It puts a maximum of <code>max</code> entries into <code>buf</code>.
-* If <code>buf</code> is NULL, it only counts the matches.
-* Returns the number of entries that matched.
-* NOTE: if the value returned is greater than <code>max</code>, only the
-* first <code>max</code> entries found are put into the buffer.
-* @param self Interface of the database
-* @param buf Buffer to put the data of the matched entries
-* @param max Maximum number of data entries to be put into buf
-* @param match Function that matches the database entries
-* @param ... Extra arguments for match
-* @return The number of entries that matched
-* @protected
-* @see DBMap#vgetall
-*/
+ * Get the data of the entries matched by <code>match</code>.
+ * It puts a maximum of <code>max</code> entries into <code>buf</code>.
+ * If <code>buf</code> is NULL, it only counts the matches.
+ * Returns the number of entries that matched.
+ * NOTE: if the value returned is greater than <code>max</code>, only the
+ * first <code>max</code> entries found are put into the buffer.
+ * @param self Interface of the database
+ * @param buf Buffer to put the data of the matched entries
+ * @param max Maximum number of data entries to be put into buf
+ * @param match Function that matches the database entries
+ * @param ... Extra arguments for match
+ * @return The number of entries that matched
+ * @protected
+ * @see DBMap#vgetall
+ */
static unsigned int db_obj_vgetall(DBMap* self, DBData **buf, unsigned int max, DBMatcher match, va_list args)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -1554,17 +1554,17 @@ static unsigned int db_obj_vgetall(DBMap* self, DBData **buf, unsigned int max,
}
va_end(argscopy);
}
-
+
if (node->left) {
node = node->left;
continue;
}
-
+
if (node->right) {
node = node->right;
continue;
}
-
+
while (node) {
parent = node->parent;
if (parent && parent->right && parent->left == node) {
@@ -1581,23 +1581,23 @@ static unsigned int db_obj_vgetall(DBMap* self, DBData **buf, unsigned int max,
}
/**
-* Just calls {@link DBMap#vgetall}.
-* Get the data of the entries matched by <code>match</code>.
-* It puts a maximum of <code>max</code> entries into <code>buf</code>.
-* If <code>buf</code> is NULL, it only counts the matches.
-* Returns the number of entries that matched.
-* NOTE: if the value returned is greater than <code>max</code>, only the
-* first <code>max</code> entries found are put into the buffer.
-* @param self Interface of the database
-* @param buf Buffer to put the data of the matched entries
-* @param max Maximum number of data entries to be put into buf
-* @param match Function that matches the database entries
-* @param ... Extra arguments for match
-* @return The number of entries that matched
-* @protected
-* @see DBMap#vgetall
-* @see DBMap#getall
-*/
+ * Just calls {@link DBMap#vgetall}.
+ * Get the data of the entries matched by <code>match</code>.
+ * It puts a maximum of <code>max</code> entries into <code>buf</code>.
+ * If <code>buf</code> is NULL, it only counts the matches.
+ * Returns the number of entries that matched.
+ * NOTE: if the value returned is greater than <code>max</code>, only the
+ * first <code>max</code> entries found are put into the buffer.
+ * @param self Interface of the database
+ * @param buf Buffer to put the data of the matched entries
+ * @param max Maximum number of data entries to be put into buf
+ * @param match Function that matches the database entries
+ * @param ... Extra arguments for match
+ * @return The number of entries that matched
+ * @protected
+ * @see DBMap#vgetall
+ * @see DBMap#getall
+ */
static unsigned int db_obj_getall(DBMap* self, DBData **buf, unsigned int max, DBMatcher match, ...)
{
va_list args;
@@ -1613,17 +1613,17 @@ static unsigned int db_obj_getall(DBMap* self, DBData **buf, unsigned int max, D
}
/**
-* Get the data of the entry identified by the key.
-* If the entry does not exist, an entry is added with the data returned by
-* <code>create</code>.
-* @param self Interface of the database
-* @param key Key that identifies the entry
-* @param create Function used to create the data if the entry doesn't exist
-* @param args Extra arguments for create
-* @return Data of the entry
-* @protected
-* @see DBMap#vensure
-*/
+ * Get the data of the entry identified by the key.
+ * If the entry does not exist, an entry is added with the data returned by
+ * <code>create</code>.
+ * @param self Interface of the database
+ * @param key Key that identifies the entry
+ * @param create Function used to create the data if the entry doesn't exist
+ * @param args Extra arguments for create
+ * @return Data of the entry
+ * @protected
+ * @see DBMap#vensure
+ */
static DBData* db_obj_vensure(DBMap* self, DBKey key, DBCreateData create, va_list args)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -1666,9 +1666,9 @@ static DBData* db_obj_vensure(DBMap* self, DBKey key, DBCreateData create, va_li
va_list argscopy;
if (db->item_count == UINT32_MAX) {
ShowError("db_vensure: item_count overflow, aborting item insertion.\n"
- "Database allocated at %s:%d",
- db->alloc_file, db->alloc_line);
- return NULL;
+ "Database allocated at %s:%d",
+ db->alloc_file, db->alloc_line);
+ return NULL;
}
DB_COUNTSTAT(db_node_alloc);
node = ers_alloc(db->nodes, struct dbn);
@@ -1711,19 +1711,19 @@ static DBData* db_obj_vensure(DBMap* self, DBKey key, DBCreateData create, va_li
}
/**
-* Just calls {@link DBMap#vensure}.
-* Get the data of the entry identified by the key.
-* If the entry does not exist, an entry is added with the data returned by
-* <code>create</code>.
-* @param self Interface of the database
-* @param key Key that identifies the entry
-* @param create Function used to create the data if the entry doesn't exist
-* @param ... Extra arguments for create
-* @return Data of the entry
-* @protected
-* @see DBMap#vensure
-* @see DBMap#ensure
-*/
+ * Just calls {@link DBMap#vensure}.
+ * Get the data of the entry identified by the key.
+ * If the entry does not exist, an entry is added with the data returned by
+ * <code>create</code>.
+ * @param self Interface of the database
+ * @param key Key that identifies the entry
+ * @param create Function used to create the data if the entry doesn't exist
+ * @param ... Extra arguments for create
+ * @return Data of the entry
+ * @protected
+ * @see DBMap#vensure
+ * @see DBMap#ensure
+ */
static DBData* db_obj_ensure(DBMap* self, DBKey key, DBCreateData create, ...)
{
va_list args;
@@ -1739,18 +1739,18 @@ static DBData* db_obj_ensure(DBMap* self, DBKey key, DBCreateData create, ...)
}
/**
-* Put the data identified by the key in the database.
-* Puts the previous data in out_data, if out_data is not NULL.
-* NOTE: Uses the new key, the old one is released.
-* @param self Interface of the database
-* @param key Key that identifies the data
-* @param data Data to be put in the database
-* @param out_data Previous data if the entry exists
-* @return 1 if if the entry already exists, 0 otherwise
-* @protected
-* @see #db_malloc_dbn(void)
-* @see DBMap#put
-*/
+ * Put the data identified by the key in the database.
+ * Puts the previous data in out_data, if out_data is not NULL.
+ * NOTE: Uses the new key, the old one is released.
+ * @param self Interface of the database
+ * @param key Key that identifies the data
+ * @param data Data to be put in the database
+ * @param out_data Previous data if the entry exists
+ * @return 1 if if the entry already exists, 0 otherwise
+ * @protected
+ * @see #db_malloc_dbn(void)
+ * @see DBMap#put
+ */
static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -1763,8 +1763,8 @@ static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data)
if (db == NULL) return 0; // nullpo candidate
if (db->global_lock) {
ShowError("db_put: Database is being destroyed, aborting entry insertion.\n"
- "Database allocated at %s:%d\n",
- db->alloc_file, db->alloc_line);
+ "Database allocated at %s:%d\n",
+ db->alloc_file, db->alloc_line);
return 0; // nullpo candidate
}
if (!(db->options&DB_OPT_ALLOW_NULL_KEY) && db_is_key_null(db->type, key)) {
@@ -1778,8 +1778,8 @@ static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data)
if (db->item_count == UINT32_MAX) {
ShowError("db_put: item_count overflow, aborting item insertion.\n"
- "Database allocated at %s:%d",
- db->alloc_file, db->alloc_line);
+ "Database allocated at %s:%d",
+ db->alloc_file, db->alloc_line);
return 0;
}
// search for an equal node
@@ -1845,17 +1845,17 @@ static int db_obj_put(DBMap* self, DBKey key, DBData data, DBData *out_data)
}
/**
-* Remove an entry from the database.
-* Puts the previous data in out_data, if out_data is not NULL.
-* NOTE: The key (of the database) is released in {@link #db_free_add(DBMap_impl*,DBNode,DBNode *)}.
-* @param self Interface of the database
-* @param key Key that identifies the entry
-* @param out_data Previous data if the entry exists
-* @return 1 if if the entry already exists, 0 otherwise
-* @protected
-* @see #db_free_add(DBMap_impl*,DBNode,DBNode *)
-* @see DBMap#remove
-*/
+ * Remove an entry from the database.
+ * Puts the previous data in out_data, if out_data is not NULL.
+ * NOTE: The key (of the database) is released in {@link #db_free_add(DBMap_impl*,DBNode,DBNode *)}.
+ * @param self Interface of the database
+ * @param key Key that identifies the entry
+ * @param out_data Previous data if the entry exists
+ * @return 1 if if the entry already exists, 0 otherwise
+ * @protected
+ * @see #db_free_add(DBMap_impl*,DBNode,DBNode *)
+ * @see DBMap#remove
+ */
static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -1867,8 +1867,8 @@ static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data)
if (db == NULL) return 0; // nullpo candidate
if (db->global_lock) {
ShowError("db_remove: Database is being destroyed. Aborting entry deletion.\n"
- "Database allocated at %s:%d\n",
- db->alloc_file, db->alloc_line);
+ "Database allocated at %s:%d\n",
+ db->alloc_file, db->alloc_line);
return 0; // nullpo candidate
}
if (!(db->options&DB_OPT_ALLOW_NULL_KEY) && db_is_key_null(db->type, key)) {
@@ -1902,15 +1902,15 @@ static int db_obj_remove(DBMap* self, DBKey key, DBData *out_data)
}
/**
-* Apply <code>func</code> to every entry in the database.
-* Returns the sum of values returned by func.
-* @param self Interface of the database
-* @param func Function to be applied
-* @param args Extra arguments for func
-* @return Sum of the values returned by func
-* @protected
-* @see DBMap#vforeach
-*/
+ * Apply <code>func</code> to every entry in the database.
+ * Returns the sum of values returned by func.
+ * @param self Interface of the database
+ * @param func Function to be applied
+ * @param args Extra arguments for func
+ * @return Sum of the values returned by func
+ * @protected
+ * @see DBMap#vforeach
+ */
static int db_obj_vforeach(DBMap* self, DBApply func, va_list args)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -1960,17 +1960,17 @@ static int db_obj_vforeach(DBMap* self, DBApply func, va_list args)
}
/**
-* Just calls {@link DBMap#vforeach}.
-* Apply <code>func</code> to every entry in the database.
-* Returns the sum of values returned by func.
-* @param self Interface of the database
-* @param func Function to be applyed
-* @param ... Extra arguments for func
-* @return Sum of the values returned by func
-* @protected
-* @see DBMap#vforeach
-* @see DBMap#foreach
-*/
+ * Just calls {@link DBMap#vforeach}.
+ * Apply <code>func</code> to every entry in the database.
+ * Returns the sum of values returned by func.
+ * @param self Interface of the database
+ * @param func Function to be applyed
+ * @param ... Extra arguments for func
+ * @return Sum of the values returned by func
+ * @protected
+ * @see DBMap#vforeach
+ * @see DBMap#foreach
+ */
static int db_obj_foreach(DBMap* self, DBApply func, ...)
{
va_list args;
@@ -1986,17 +1986,17 @@ static int db_obj_foreach(DBMap* self, DBApply func, ...)
}
/**
-* Removes all entries from the database.
-* Before deleting an entry, func is applied to it.
-* Releases the key and the data.
-* Returns the sum of values returned by func, if it exists.
-* @param self Interface of the database
-* @param func Function to be applied to every entry before deleting
-* @param args Extra arguments for func
-* @return Sum of values returned by func
-* @protected
-* @see DBMap#vclear
-*/
+ * Removes all entries from the database.
+ * Before deleting an entry, func is applied to it.
+ * Releases the key and the data.
+ * Returns the sum of values returned by func, if it exists.
+ * @param self Interface of the database
+ * @param func Function to be applied to every entry before deleting
+ * @param args Extra arguments for func
+ * @return Sum of values returned by func
+ * @protected
+ * @see DBMap#vclear
+ */
static int db_obj_vclear(DBMap* self, DBApply func, va_list args)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -2056,21 +2056,21 @@ static int db_obj_vclear(DBMap* self, DBApply func, va_list args)
}
/**
-* Just calls {@link DBMap#vclear}.
-* Removes all entries from the database.
-* Before deleting an entry, func is applied to it.
-* Releases the key and the data.
-* Returns the sum of values returned by func, if it exists.
-* NOTE: This locks the database globally. Any attempt to insert or remove
-* a database entry will give an error and be aborted (except for clearing).
-* @param self Interface of the database
-* @param func Function to be applied to every entry before deleting
-* @param ... Extra arguments for func
-* @return Sum of values returned by func
-* @protected
-* @see DBMap#vclear
-* @see DBMap#clear
-*/
+ * Just calls {@link DBMap#vclear}.
+ * Removes all entries from the database.
+ * Before deleting an entry, func is applied to it.
+ * Releases the key and the data.
+ * Returns the sum of values returned by func, if it exists.
+ * NOTE: This locks the database globally. Any attempt to insert or remove
+ * a database entry will give an error and be aborted (except for clearing).
+ * @param self Interface of the database
+ * @param func Function to be applied to every entry before deleting
+ * @param ... Extra arguments for func
+ * @return Sum of values returned by func
+ * @protected
+ * @see DBMap#vclear
+ * @see DBMap#clear
+ */
static int db_obj_clear(DBMap* self, DBApply func, ...)
{
va_list args;
@@ -2086,18 +2086,18 @@ static int db_obj_clear(DBMap* self, DBApply func, ...)
}
/**
-* Finalize the database, feeing all the memory it uses.
-* Before deleting an entry, func is applied to it.
-* Returns the sum of values returned by func, if it exists.
-* NOTE: This locks the database globally. Any attempt to insert or remove
-* a database entry will give an error and be aborted (except for clearing).
-* @param self Interface of the database
-* @param func Function to be applied to every entry before deleting
-* @param args Extra arguments for func
-* @return Sum of values returned by func
-* @protected
-* @see DBMap#vdestroy
-*/
+ * Finalize the database, feeing all the memory it uses.
+ * Before deleting an entry, func is applied to it.
+ * Returns the sum of values returned by func, if it exists.
+ * NOTE: This locks the database globally. Any attempt to insert or remove
+ * a database entry will give an error and be aborted (except for clearing).
+ * @param self Interface of the database
+ * @param func Function to be applied to every entry before deleting
+ * @param args Extra arguments for func
+ * @return Sum of values returned by func
+ * @protected
+ * @see DBMap#vdestroy
+ */
static int db_obj_vdestroy(DBMap* self, DBApply func, va_list args)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -2107,21 +2107,21 @@ static int db_obj_vdestroy(DBMap* self, DBApply func, va_list args)
if (db == NULL) return 0; // nullpo candidate
if (db->global_lock) {
ShowError("db_vdestroy: Database is already locked for destruction. Aborting second database destruction.\n"
- "Database allocated at %s:%d\n",
- db->alloc_file, db->alloc_line);
+ "Database allocated at %s:%d\n",
+ db->alloc_file, db->alloc_line);
return 0;
}
if (db->free_lock)
ShowWarning("db_vdestroy: Database is still in use, %u lock(s) left. Continuing database destruction.\n"
- "Database allocated at %s:%d\n",
- db->free_lock, db->alloc_file, db->alloc_line);
+ "Database allocated at %s:%d\n",
+ db->free_lock, db->alloc_file, db->alloc_line);
#ifdef DB_ENABLE_STATS
switch (db->type) {
- case DB_INT: DB_COUNTSTAT(db_int_destroy); break;
- case DB_UINT: DB_COUNTSTAT(db_uint_destroy); break;
- case DB_STRING: DB_COUNTSTAT(db_string_destroy); break;
- case DB_ISTRING: DB_COUNTSTAT(db_istring_destroy); break;
+ case DB_INT: DB_COUNTSTAT(db_int_destroy); break;
+ case DB_UINT: DB_COUNTSTAT(db_uint_destroy); break;
+ case DB_STRING: DB_COUNTSTAT(db_string_destroy); break;
+ case DB_ISTRING: DB_COUNTSTAT(db_istring_destroy); break;
}
#endif /* DB_ENABLE_STATS */
db_free_lock(db);
@@ -2137,21 +2137,21 @@ static int db_obj_vdestroy(DBMap* self, DBApply func, va_list args)
}
/**
-* Just calls {@link DBMap#db_vdestroy}.
-* Finalize the database, feeing all the memory it uses.
-* Before deleting an entry, func is applied to it.
-* Releases the key and the data.
-* Returns the sum of values returned by func, if it exists.
-* NOTE: This locks the database globally. Any attempt to insert or remove
-* a database entry will give an error and be aborted.
-* @param self Database
-* @param func Function to be applied to every entry before deleting
-* @param ... Extra arguments for func
-* @return Sum of values returned by func
-* @protected
-* @see DBMap#vdestroy
-* @see DBMap#destroy
-*/
+ * Just calls {@link DBMap#db_vdestroy}.
+ * Finalize the database, feeing all the memory it uses.
+ * Before deleting an entry, func is applied to it.
+ * Releases the key and the data.
+ * Returns the sum of values returned by func, if it exists.
+ * NOTE: This locks the database globally. Any attempt to insert or remove
+ * a database entry will give an error and be aborted.
+ * @param self Database
+ * @param func Function to be applied to every entry before deleting
+ * @param ... Extra arguments for func
+ * @return Sum of values returned by func
+ * @protected
+ * @see DBMap#vdestroy
+ * @see DBMap#destroy
+ */
static int db_obj_destroy(DBMap* self, DBApply func, ...)
{
va_list args;
@@ -2167,13 +2167,13 @@ static int db_obj_destroy(DBMap* self, DBApply func, ...)
}
/**
-* Return the size of the database (number of items in the database).
-* @param self Interface of the database
-* @return Size of the database
-* @protected
-* @see DBMap_impl#item_count
-* @see DBMap#size
-*/
+ * Return the size of the database (number of items in the database).
+ * @param self Interface of the database
+ * @return Size of the database
+ * @protected
+ * @see DBMap_impl#item_count
+ * @see DBMap#size
+ */
static unsigned int db_obj_size(DBMap* self)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -2190,13 +2190,13 @@ static unsigned int db_obj_size(DBMap* self)
}
/**
-* Return the type of database.
-* @param self Interface of the database
-* @return Type of the database
-* @protected
-* @see DBMap_impl#type
-* @see DBMap#type
-*/
+ * Return the type of database.
+ * @param self Interface of the database
+ * @return Type of the database
+ * @protected
+ * @see DBMap_impl#type
+ * @see DBMap#type
+ */
static DBType db_obj_type(DBMap* self)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -2213,13 +2213,13 @@ static DBType db_obj_type(DBMap* self)
}
/**
-* Return the options of the database.
-* @param self Interface of the database
-* @return Options of the database
-* @protected
-* @see DBMap_impl#options
-* @see DBMap#options
-*/
+ * Return the options of the database.
+ * @param self Interface of the database
+ * @return Options of the database
+ * @protected
+ * @see DBMap_impl#options
+ * @see DBMap#options
+ */
static DBOptions db_obj_options(DBMap* self)
{
DBMap_impl* db = (DBMap_impl*)self;
@@ -2236,121 +2236,120 @@ static DBOptions db_obj_options(DBMap* self)
}
/*****************************************************************************\
-* (5) Section with public functions.
-* db_fix_options - Apply database type restrictions to the options.
-* db_default_cmp - Get the default comparator for a type of database.
-* db_default_hash - Get the default hasher for a type of database.
-* db_default_release - Get the default releaser for a type of database with the specified options.
-* db_custom_release - Get a releaser that behaves a certains way.
-* db_alloc - Allocate a new database.
-* db_i2key - Manual cast from 'int' to 'DBKey'.
-* db_ui2key - Manual cast from 'unsigned int' to 'DBKey'.
-* db_str2key - Manual cast from 'unsigned char *' to 'DBKey'.
-* db_i2data - Manual cast from 'int' to 'DBData'.
-* db_ui2data - Manual cast from 'unsigned int' to 'DBData'.
-* db_ptr2data - Manual cast from 'void*' to 'DBData'.
-* db_data2i - Gets 'int' value from 'DBData'.
-* db_data2ui - Gets 'unsigned int' value from 'DBData'.
-* db_data2ptr - Gets 'void*' value from 'DBData'.
-* db_init - Initializes the database system.
-* db_final - Finalizes the database system.
+ * (5) Section with public functions.
+ * db_fix_options - Apply database type restrictions to the options.
+ * db_default_cmp - Get the default comparator for a type of database.
+ * db_default_hash - Get the default hasher for a type of database.
+ * db_default_release - Get the default releaser for a type of database with the specified options.
+ * db_custom_release - Get a releaser that behaves a certains way.
+ * db_alloc - Allocate a new database.
+ * db_i2key - Manual cast from 'int' to 'DBKey'.
+ * db_ui2key - Manual cast from 'unsigned int' to 'DBKey'.
+ * db_str2key - Manual cast from 'unsigned char *' to 'DBKey'.
+ * db_i2data - Manual cast from 'int' to 'DBData'.
+ * db_ui2data - Manual cast from 'unsigned int' to 'DBData'.
+ * db_ptr2data - Manual cast from 'void*' to 'DBData'.
+ * db_data2i - Gets 'int' value from 'DBData'.
+ * db_data2ui - Gets 'unsigned int' value from 'DBData'.
+ * db_data2ptr - Gets 'void*' value from 'DBData'.
+ * db_init - Initializes the database system.
+ * db_final - Finalizes the database system.
\*****************************************************************************/
/**
-* Returns the fixed options according to the database type.
-* Sets required options and unsets unsupported options.
-* For numeric databases DB_OPT_DUP_KEY and DB_OPT_RELEASE_KEY are unset.
-* @param type Type of the database
-* @param options Original options of the database
-* @return Fixed options of the database
-* @private
-* @see #db_default_release(DBType,DBOptions)
-* @see #db_alloc(const char *,int,DBType,DBOptions,unsigned short)
-*/
+ * Returns the fixed options according to the database type.
+ * Sets required options and unsets unsupported options.
+ * For numeric databases DB_OPT_DUP_KEY and DB_OPT_RELEASE_KEY are unset.
+ * @param type Type of the database
+ * @param options Original options of the database
+ * @return Fixed options of the database
+ * @private
+ * @see #db_default_release(DBType,DBOptions)
+ * @see #db_alloc(const char *,int,DBType,DBOptions,unsigned short)
+ */
DBOptions db_fix_options(DBType type, DBOptions options)
{
DB_COUNTSTAT(db_fix_options);
switch (type) {
- case DB_INT:
- case DB_UINT: // Numeric database, do nothing with the keys
- return (DBOptions)(options&~(DB_OPT_DUP_KEY|DB_OPT_RELEASE_KEY));
-
- default:
- ShowError("db_fix_options: Unknown database type %u with options %x\n", type, options);
- case DB_STRING:
- case DB_ISTRING: // String databases, no fix required
- return options;
+ case DB_INT:
+ case DB_UINT: // Numeric database, do nothing with the keys
+ return (DBOptions)(options&~(DB_OPT_DUP_KEY|DB_OPT_RELEASE_KEY));
+
+ default:
+ ShowError("db_fix_options: Unknown database type %u with options %x\n", type, options);
+ case DB_STRING:
+ case DB_ISTRING: // String databases, no fix required
+ return options;
}
}
-
/**
-* Returns the default comparator for the specified type of database.
-* @param type Type of database
-* @return Comparator for the type of database or NULL if unknown database
-* @public
-* @see #db_int_cmp(DBKey,DBKey,unsigned short)
-* @see #db_uint_cmp(DBKey,DBKey,unsigned short)
-* @see #db_string_cmp(DBKey,DBKey,unsigned short)
-* @see #db_istring_cmp(DBKey,DBKey,unsigned short)
-*/
+ * Returns the default comparator for the specified type of database.
+ * @param type Type of database
+ * @return Comparator for the type of database or NULL if unknown database
+ * @public
+ * @see #db_int_cmp(DBKey,DBKey,unsigned short)
+ * @see #db_uint_cmp(DBKey,DBKey,unsigned short)
+ * @see #db_string_cmp(DBKey,DBKey,unsigned short)
+ * @see #db_istring_cmp(DBKey,DBKey,unsigned short)
+ */
DBComparator db_default_cmp(DBType type)
{
DB_COUNTSTAT(db_default_cmp);
switch (type) {
- case DB_INT: return &db_int_cmp;
- case DB_UINT: return &db_uint_cmp;
- case DB_STRING: return &db_string_cmp;
- case DB_ISTRING: return &db_istring_cmp;
- default:
- ShowError("db_default_cmp: Unknown database type %u\n", type);
- return NULL;
+ case DB_INT: return &db_int_cmp;
+ case DB_UINT: return &db_uint_cmp;
+ case DB_STRING: return &db_string_cmp;
+ case DB_ISTRING: return &db_istring_cmp;
+ default:
+ ShowError("db_default_cmp: Unknown database type %u\n", type);
+ return NULL;
}
}
/**
-* Returns the default hasher for the specified type of database.
-* @param type Type of database
-* @return Hasher of the type of database or NULL if unknown database
-* @public
-* @see #db_int_hash(DBKey,unsigned short)
-* @see #db_uint_hash(DBKey,unsigned short)
-* @see #db_string_hash(DBKey,unsigned short)
-* @see #db_istring_hash(DBKey,unsigned short)
-*/
+ * Returns the default hasher for the specified type of database.
+ * @param type Type of database
+ * @return Hasher of the type of database or NULL if unknown database
+ * @public
+ * @see #db_int_hash(DBKey,unsigned short)
+ * @see #db_uint_hash(DBKey,unsigned short)
+ * @see #db_string_hash(DBKey,unsigned short)
+ * @see #db_istring_hash(DBKey,unsigned short)
+ */
DBHasher db_default_hash(DBType type)
{
DB_COUNTSTAT(db_default_hash);
switch (type) {
- case DB_INT: return &db_int_hash;
- case DB_UINT: return &db_uint_hash;
- case DB_STRING: return &db_string_hash;
- case DB_ISTRING: return &db_istring_hash;
- default:
- ShowError("db_default_hash: Unknown database type %u\n", type);
- return NULL;
+ case DB_INT: return &db_int_hash;
+ case DB_UINT: return &db_uint_hash;
+ case DB_STRING: return &db_string_hash;
+ case DB_ISTRING: return &db_istring_hash;
+ default:
+ ShowError("db_default_hash: Unknown database type %u\n", type);
+ return NULL;
}
}
/**
-* Returns the default releaser for the specified type of database with the
-* specified options.
-* NOTE: the options are fixed with {@link #db_fix_options(DBType,DBOptions)}
-* before choosing the releaser.
-* @param type Type of database
-* @param options Options of the database
-* @return Default releaser for the type of database with the specified options
-* @public
-* @see #db_release_nothing(DBKey,DBData,DBRelease)
-* @see #db_release_key(DBKey,DBData,DBRelease)
-* @see #db_release_data(DBKey,DBData,DBRelease)
-* @see #db_release_both(DBKey,DBData,DBRelease)
-* @see #db_custom_release(DBRelease)
-*/
+ * Returns the default releaser for the specified type of database with the
+ * specified options.
+ * NOTE: the options are fixed with {@link #db_fix_options(DBType,DBOptions)}
+ * before choosing the releaser.
+ * @param type Type of database
+ * @param options Options of the database
+ * @return Default releaser for the type of database with the specified options
+ * @public
+ * @see #db_release_nothing(DBKey,DBData,DBRelease)
+ * @see #db_release_key(DBKey,DBData,DBRelease)
+ * @see #db_release_data(DBKey,DBData,DBRelease)
+ * @see #db_release_both(DBKey,DBData,DBRelease)
+ * @see #db_custom_release(DBRelease)
+ */
DBReleaser db_default_release(DBType type, DBOptions options)
{
DB_COUNTSTAT(db_default_release);
- options = DB->fix_options(type, options);
+ options = iDB->fix_options(type, options);
if (options&DB_OPT_RELEASE_DATA) { // Release data, what about the key?
if (options&(DB_OPT_DUP_KEY|DB_OPT_RELEASE_KEY))
return &db_release_both; // Release both key and data
@@ -2362,62 +2361,62 @@ DBReleaser db_default_release(DBType type, DBOptions options)
}
/**
-* Returns the releaser that releases the specified release options.
-* @param which Options that specified what the releaser releases
-* @return Releaser for the specified release options
-* @public
-* @see #db_release_nothing(DBKey,DBData,DBRelease)
-* @see #db_release_key(DBKey,DBData,DBRelease)
-* @see #db_release_data(DBKey,DBData,DBRelease)
-* @see #db_release_both(DBKey,DBData,DBRelease)
-* @see #db_default_release(DBType,DBOptions)
-*/
+ * Returns the releaser that releases the specified release options.
+ * @param which Options that specified what the releaser releases
+ * @return Releaser for the specified release options
+ * @public
+ * @see #db_release_nothing(DBKey,DBData,DBRelease)
+ * @see #db_release_key(DBKey,DBData,DBRelease)
+ * @see #db_release_data(DBKey,DBData,DBRelease)
+ * @see #db_release_both(DBKey,DBData,DBRelease)
+ * @see #db_default_release(DBType,DBOptions)
+ */
DBReleaser db_custom_release(DBRelease which)
{
DB_COUNTSTAT(db_custom_release);
switch (which) {
- case DB_RELEASE_NOTHING: return &db_release_nothing;
- case DB_RELEASE_KEY: return &db_release_key;
- case DB_RELEASE_DATA: return &db_release_data;
- case DB_RELEASE_BOTH: return &db_release_both;
- default:
- ShowError("db_custom_release: Unknown release options %u\n", which);
- return NULL;
+ case DB_RELEASE_NOTHING: return &db_release_nothing;
+ case DB_RELEASE_KEY: return &db_release_key;
+ case DB_RELEASE_DATA: return &db_release_data;
+ case DB_RELEASE_BOTH: return &db_release_both;
+ default:
+ ShowError("db_custom_release: Unknown release options %u\n", which);
+ return NULL;
}
}
/**
-* Allocate a new database of the specified type.
-* NOTE: the options are fixed by {@link #db_fix_options(DBType,DBOptions)}
-* before creating the database.
-* @param file File where the database is being allocated
-* @param line Line of the file where the database is being allocated
-* @param type Type of database
-* @param options Options of the database
-* @param maxlen Maximum length of the string to be used as key in string
-* databases. If 0, the maximum number of maxlen is used (64K).
-* @return The interface of the database
-* @public
-* @see #DBMap_impl
-* @see #db_fix_options(DBType,DBOptions)
-*/
-DBMap* db_alloc(const char *file, int line, DBType type, DBOptions options, unsigned short maxlen)
-{
+ * Allocate a new database of the specified type.
+ * NOTE: the options are fixed by {@link #db_fix_options(DBType,DBOptions)}
+ * before creating the database.
+ * @param file File where the database is being allocated
+ * @param line Line of the file where the database is being allocated
+ * @param type Type of database
+ * @param options Options of the database
+ * @param maxlen Maximum length of the string to be used as key in string
+ * databases. If 0, the maximum number of maxlen is used (64K).
+ * @return The interface of the database
+ * @public
+ * @see #DBMap_impl
+ * @see #db_fix_options(DBType,DBOptions)
+ */
+DBMap* db_alloc(const char *file, const char *func, int line, DBType type, DBOptions options, unsigned short maxlen) {
DBMap_impl* db;
unsigned int i;
+ char ers_name[50];
#ifdef DB_ENABLE_STATS
DB_COUNTSTAT(db_alloc);
switch (type) {
- case DB_INT: DB_COUNTSTAT(db_int_alloc); break;
- case DB_UINT: DB_COUNTSTAT(db_uint_alloc); break;
- case DB_STRING: DB_COUNTSTAT(db_string_alloc); break;
- case DB_ISTRING: DB_COUNTSTAT(db_istring_alloc); break;
+ case DB_INT: DB_COUNTSTAT(db_int_alloc); break;
+ case DB_UINT: DB_COUNTSTAT(db_uint_alloc); break;
+ case DB_STRING: DB_COUNTSTAT(db_string_alloc); break;
+ case DB_ISTRING: DB_COUNTSTAT(db_istring_alloc); break;
}
#endif /* DB_ENABLE_STATS */
db = ers_alloc(db_alloc_ers, struct DBMap_impl);
- options = DB->fix_options(type, options);
+ options = iDB->fix_options(type, options);
/* Interface of the database */
db->vtable.iterator = db_obj_iterator;
db->vtable.exists = db_obj_exists;
@@ -2446,10 +2445,11 @@ DBMap* db_alloc(const char *file, int line, DBType type, DBOptions options, unsi
db->free_max = 0;
db->free_lock = 0;
/* Other */
- db->nodes = ers_new(sizeof(struct dbn),"db.c::db_alloc",ERS_OPT_NONE);
- db->cmp = DB->default_cmp(type);
- db->hash = DB->default_hash(type);
- db->release = DB->default_release(type, options);
+ snprintf(ers_name, 50, "db_alloc:nodes:%s:%s:%d",func,file,line);
+ db->nodes = ers_new(sizeof(struct dbn),ers_name,ERS_OPT_WAIT|ERS_OPT_FREE_NAME);
+ db->cmp = iDB->default_cmp(type);
+ db->hash = iDB->default_hash(type);
+ db->release = iDB->default_release(type, options);
for (i = 0; i < HASH_SIZE; i++)
db->ht[i] = NULL;
db->cache = NULL;
@@ -2466,11 +2466,11 @@ DBMap* db_alloc(const char *file, int line, DBType type, DBOptions options, unsi
}
/**
-* Manual cast from 'int' to the union DBKey.
-* @param key Key to be casted
-* @return The key as a DBKey union
-* @public
-*/
+ * Manual cast from 'int' to the union DBKey.
+ * @param key Key to be casted
+ * @return The key as a DBKey union
+ * @public
+ */
DBKey db_i2key(int key)
{
DBKey ret;
@@ -2481,11 +2481,11 @@ DBKey db_i2key(int key)
}
/**
-* Manual cast from 'unsigned int' to the union DBKey.
-* @param key Key to be casted
-* @return The key as a DBKey union
-* @public
-*/
+ * Manual cast from 'unsigned int' to the union DBKey.
+ * @param key Key to be casted
+ * @return The key as a DBKey union
+ * @public
+ */
DBKey db_ui2key(unsigned int key)
{
DBKey ret;
@@ -2496,11 +2496,11 @@ DBKey db_ui2key(unsigned int key)
}
/**
-* Manual cast from 'const char *' to the union DBKey.
-* @param key Key to be casted
-* @return The key as a DBKey union
-* @public
-*/
+ * Manual cast from 'const char *' to the union DBKey.
+ * @param key Key to be casted
+ * @return The key as a DBKey union
+ * @public
+ */
DBKey db_str2key(const char *key)
{
DBKey ret;
@@ -2511,11 +2511,11 @@ DBKey db_str2key(const char *key)
}
/**
-* Manual cast from 'int' to the struct DBData.
-* @param data Data to be casted
-* @return The data as a DBData struct
-* @public
-*/
+ * Manual cast from 'int' to the struct DBData.
+ * @param data Data to be casted
+ * @return The data as a DBData struct
+ * @public
+ */
DBData db_i2data(int data)
{
DBData ret;
@@ -2527,11 +2527,11 @@ DBData db_i2data(int data)
}
/**
-* Manual cast from 'unsigned int' to the struct DBData.
-* @param data Data to be casted
-* @return The data as a DBData struct
-* @public
-*/
+ * Manual cast from 'unsigned int' to the struct DBData.
+ * @param data Data to be casted
+ * @return The data as a DBData struct
+ * @public
+ */
DBData db_ui2data(unsigned int data)
{
DBData ret;
@@ -2543,11 +2543,11 @@ DBData db_ui2data(unsigned int data)
}
/**
-* Manual cast from 'void *' to the struct DBData.
-* @param data Data to be casted
-* @return The data as a DBData struct
-* @public
-*/
+ * Manual cast from 'void *' to the struct DBData.
+ * @param data Data to be casted
+ * @return The data as a DBData struct
+ * @public
+ */
DBData db_ptr2data(void *data)
{
DBData ret;
@@ -2559,12 +2559,12 @@ DBData db_ptr2data(void *data)
}
/**
-* Gets int type data from struct DBData.
-* If data is not int type, returns 0.
-* @param data Data
-* @return Integer value of the data.
-* @public
-*/
+ * Gets int type data from struct DBData.
+ * If data is not int type, returns 0.
+ * @param data Data
+ * @return Integer value of the data.
+ * @public
+ */
int db_data2i(DBData *data)
{
DB_COUNTSTAT(db_data2i);
@@ -2574,12 +2574,12 @@ int db_data2i(DBData *data)
}
/**
-* Gets unsigned int type data from struct DBData.
-* If data is not unsigned int type, returns 0.
-* @param data Data
-* @return Unsigned int value of the data.
-* @public
-*/
+ * Gets unsigned int type data from struct DBData.
+ * If data is not unsigned int type, returns 0.
+ * @param data Data
+ * @return Unsigned int value of the data.
+ * @public
+ */
unsigned int db_data2ui(DBData *data)
{
DB_COUNTSTAT(db_data2ui);
@@ -2589,12 +2589,12 @@ unsigned int db_data2ui(DBData *data)
}
/**
-* Gets void* type data from struct DBData.
-* If data is not void* type, returns NULL.
-* @param data Data
-* @return Void* value of the data.
-* @public
-*/
+ * Gets void* type data from struct DBData.
+ * If data is not void* type, returns NULL.
+ * @param data Data
+ * @return Void* value of the data.
+ * @public
+ */
void* db_data2ptr(DBData *data)
{
DB_COUNTSTAT(db_data2ptr);
@@ -2604,10 +2604,10 @@ void* db_data2ptr(DBData *data)
}
/**
-* Initializes the database system.
-* @public
-* @see #db_final(void)
-*/
+ * Initializes the database system.
+ * @public
+ * @see #db_final(void)
+ */
void db_init(void) {
db_iterator_ers = ers_new(sizeof(struct DBIterator_impl),"db.c::db_iterator_ers",ERS_OPT_NONE);
db_alloc_ers = ers_new(sizeof(struct DBMap_impl),"db.c::db_alloc_ers",ERS_OPT_NONE);
@@ -2615,93 +2615,93 @@ void db_init(void) {
}
/**
-* Finalizes the database system.
-* @public
-* @see #db_init(void)
-*/
+ * Finalizes the database system.
+ * @public
+ * @see #db_init(void)
+ */
void db_final(void)
{
#ifdef DB_ENABLE_STATS
DB_COUNTSTAT(db_final);
ShowInfo(CL_WHITE"Database nodes"CL_RESET":\n"
- "allocated %u, freed %u\n",
- stats.db_node_alloc, stats.db_node_free);
+ "allocated %u, freed %u\n",
+ stats.db_node_alloc, stats.db_node_free);
ShowInfo(CL_WHITE"Database types"CL_RESET":\n"
- "DB_INT : allocated %10u, destroyed %10u\n"
- "DB_UINT : allocated %10u, destroyed %10u\n"
- "DB_STRING : allocated %10u, destroyed %10u\n"
- "DB_ISTRING : allocated %10u, destroyed %10u\n",
- stats.db_int_alloc, stats.db_int_destroy,
- stats.db_uint_alloc, stats.db_uint_destroy,
- stats.db_string_alloc, stats.db_string_destroy,
- stats.db_istring_alloc, stats.db_istring_destroy);
+ "DB_INT : allocated %10u, destroyed %10u\n"
+ "DB_UINT : allocated %10u, destroyed %10u\n"
+ "DB_STRING : allocated %10u, destroyed %10u\n"
+ "DB_ISTRING : allocated %10u, destroyed %10u\n",
+ stats.db_int_alloc, stats.db_int_destroy,
+ stats.db_uint_alloc, stats.db_uint_destroy,
+ stats.db_string_alloc, stats.db_string_destroy,
+ stats.db_istring_alloc, stats.db_istring_destroy);
ShowInfo(CL_WHITE"Database function counters"CL_RESET":\n"
- "db_rotate_left %10u, db_rotate_right %10u,\n"
- "db_rebalance %10u, db_rebalance_erase %10u,\n"
- "db_is_key_null %10u,\n"
- "db_dup_key %10u, db_dup_key_free %10u,\n"
- "db_free_add %10u, db_free_remove %10u,\n"
- "db_free_lock %10u, db_free_unlock %10u,\n"
- "db_int_cmp %10u, db_uint_cmp %10u,\n"
- "db_string_cmp %10u, db_istring_cmp %10u,\n"
- "db_int_hash %10u, db_uint_hash %10u,\n"
- "db_string_hash %10u, db_istring_hash %10u,\n"
- "db_release_nothing %10u, db_release_key %10u,\n"
- "db_release_data %10u, db_release_both %10u,\n"
- "dbit_first %10u, dbit_last %10u,\n"
- "dbit_next %10u, dbit_prev %10u,\n"
- "dbit_exists %10u, dbit_remove %10u,\n"
- "dbit_destroy %10u, db_iterator %10u,\n"
- "db_exits %10u, db_get %10u,\n"
- "db_getall %10u, db_vgetall %10u,\n"
- "db_ensure %10u, db_vensure %10u,\n"
- "db_put %10u, db_remove %10u,\n"
- "db_foreach %10u, db_vforeach %10u,\n"
- "db_clear %10u, db_vclear %10u,\n"
- "db_destroy %10u, db_vdestroy %10u,\n"
- "db_size %10u, db_type %10u,\n"
- "db_options %10u, db_fix_options %10u,\n"
- "db_default_cmp %10u, db_default_hash %10u,\n"
- "db_default_release %10u, db_custom_release %10u,\n"
- "db_alloc %10u, db_i2key %10u,\n"
- "db_ui2key %10u, db_str2key %10u,\n"
- "db_i2data %10u, db_ui2data %10u,\n"
- "db_ptr2data %10u, db_data2i %10u,\n"
- "db_data2ui %10u, db_data2ptr %10u,\n"
- "db_init %10u, db_final %10u\n",
- stats.db_rotate_left, stats.db_rotate_right,
- stats.db_rebalance, stats.db_rebalance_erase,
- stats.db_is_key_null,
- stats.db_dup_key, stats.db_dup_key_free,
- stats.db_free_add, stats.db_free_remove,
- stats.db_free_lock, stats.db_free_unlock,
- stats.db_int_cmp, stats.db_uint_cmp,
- stats.db_string_cmp, stats.db_istring_cmp,
- stats.db_int_hash, stats.db_uint_hash,
- stats.db_string_hash, stats.db_istring_hash,
- stats.db_release_nothing, stats.db_release_key,
- stats.db_release_data, stats.db_release_both,
- stats.dbit_first, stats.dbit_last,
- stats.dbit_next, stats.dbit_prev,
- stats.dbit_exists, stats.dbit_remove,
- stats.dbit_destroy, stats.db_iterator,
- stats.db_exists, stats.db_get,
- stats.db_getall, stats.db_vgetall,
- stats.db_ensure, stats.db_vensure,
- stats.db_put, stats.db_remove,
- stats.db_foreach, stats.db_vforeach,
- stats.db_clear, stats.db_vclear,
- stats.db_destroy, stats.db_vdestroy,
- stats.db_size, stats.db_type,
- stats.db_options, stats.db_fix_options,
- stats.db_default_cmp, stats.db_default_hash,
- stats.db_default_release, stats.db_custom_release,
- stats.db_alloc, stats.db_i2key,
- stats.db_ui2key, stats.db_str2key,
- stats.db_i2data, stats.db_ui2data,
- stats.db_ptr2data, stats.db_data2i,
- stats.db_data2ui, stats.db_data2ptr,
- stats.db_init, stats.db_final);
+ "db_rotate_left %10u, db_rotate_right %10u,\n"
+ "db_rebalance %10u, db_rebalance_erase %10u,\n"
+ "db_is_key_null %10u,\n"
+ "db_dup_key %10u, db_dup_key_free %10u,\n"
+ "db_free_add %10u, db_free_remove %10u,\n"
+ "db_free_lock %10u, db_free_unlock %10u,\n"
+ "db_int_cmp %10u, db_uint_cmp %10u,\n"
+ "db_string_cmp %10u, db_istring_cmp %10u,\n"
+ "db_int_hash %10u, db_uint_hash %10u,\n"
+ "db_string_hash %10u, db_istring_hash %10u,\n"
+ "db_release_nothing %10u, db_release_key %10u,\n"
+ "db_release_data %10u, db_release_both %10u,\n"
+ "dbit_first %10u, dbit_last %10u,\n"
+ "dbit_next %10u, dbit_prev %10u,\n"
+ "dbit_exists %10u, dbit_remove %10u,\n"
+ "dbit_destroy %10u, db_iterator %10u,\n"
+ "db_exits %10u, db_get %10u,\n"
+ "db_getall %10u, db_vgetall %10u,\n"
+ "db_ensure %10u, db_vensure %10u,\n"
+ "db_put %10u, db_remove %10u,\n"
+ "db_foreach %10u, db_vforeach %10u,\n"
+ "db_clear %10u, db_vclear %10u,\n"
+ "db_destroy %10u, db_vdestroy %10u,\n"
+ "db_size %10u, db_type %10u,\n"
+ "db_options %10u, db_fix_options %10u,\n"
+ "db_default_cmp %10u, db_default_hash %10u,\n"
+ "db_default_release %10u, db_custom_release %10u,\n"
+ "db_alloc %10u, db_i2key %10u,\n"
+ "db_ui2key %10u, db_str2key %10u,\n"
+ "db_i2data %10u, db_ui2data %10u,\n"
+ "db_ptr2data %10u, db_data2i %10u,\n"
+ "db_data2ui %10u, db_data2ptr %10u,\n"
+ "db_init %10u, db_final %10u\n",
+ stats.db_rotate_left, stats.db_rotate_right,
+ stats.db_rebalance, stats.db_rebalance_erase,
+ stats.db_is_key_null,
+ stats.db_dup_key, stats.db_dup_key_free,
+ stats.db_free_add, stats.db_free_remove,
+ stats.db_free_lock, stats.db_free_unlock,
+ stats.db_int_cmp, stats.db_uint_cmp,
+ stats.db_string_cmp, stats.db_istring_cmp,
+ stats.db_int_hash, stats.db_uint_hash,
+ stats.db_string_hash, stats.db_istring_hash,
+ stats.db_release_nothing, stats.db_release_key,
+ stats.db_release_data, stats.db_release_both,
+ stats.dbit_first, stats.dbit_last,
+ stats.dbit_next, stats.dbit_prev,
+ stats.dbit_exists, stats.dbit_remove,
+ stats.dbit_destroy, stats.db_iterator,
+ stats.db_exists, stats.db_get,
+ stats.db_getall, stats.db_vgetall,
+ stats.db_ensure, stats.db_vensure,
+ stats.db_put, stats.db_remove,
+ stats.db_foreach, stats.db_vforeach,
+ stats.db_clear, stats.db_vclear,
+ stats.db_destroy, stats.db_vdestroy,
+ stats.db_size, stats.db_type,
+ stats.db_options, stats.db_fix_options,
+ stats.db_default_cmp, stats.db_default_hash,
+ stats.db_default_release, stats.db_custom_release,
+ stats.db_alloc, stats.db_i2key,
+ stats.db_ui2key, stats.db_str2key,
+ stats.db_i2data, stats.db_ui2data,
+ stats.db_ptr2data, stats.db_data2i,
+ stats.db_data2ui, stats.db_data2ptr,
+ stats.db_init, stats.db_final);
#endif /* DB_ENABLE_STATS */
ers_destroy(db_iterator_ers);
ers_destroy(db_alloc_ers);
@@ -2829,25 +2829,23 @@ void linkdb_final( struct linkdb_node** head )
}
*head = NULL;
}
-
-void db_defaults(void)
-{
- DB = &DB_s;
- DB->alloc = db_alloc;
- DB->custom_release = db_custom_release;
- DB->data2i = db_data2i;
- DB->data2ptr = db_data2ptr;
- DB->data2ui = db_data2ui;
- DB->default_cmp = db_default_cmp;
- DB->default_hash = db_default_hash;
- DB->default_release = db_default_release;
- DB->final = db_final;
- DB->fix_options = db_fix_options;
- DB->i2data = db_i2data;
- DB->i2key = db_i2key;
- DB->init = db_init;
- DB->ptr2data = db_ptr2data;
- DB->str2key = db_str2key;
- DB->ui2data = db_ui2data;
- DB->ui2key = db_ui2key;
-} \ No newline at end of file
+void db_defaults(void) {
+ iDB = &iDB_s;
+ iDB->alloc = db_alloc;
+ iDB->custom_release = db_custom_release;
+ iDB->data2i = db_data2i;
+ iDB->data2ptr = db_data2ptr;
+ iDB->data2ui = db_data2ui;
+ iDB->default_cmp = db_default_cmp;
+ iDB->default_hash = db_default_hash;
+ iDB->default_release = db_default_release;
+ iDB->final = db_final;
+ iDB->fix_options = db_fix_options;
+ iDB->i2data = db_i2data;
+ iDB->i2key = db_i2key;
+ iDB->init = db_init;
+ iDB->ptr2data = db_ptr2data;
+ iDB->str2key = db_str2key;
+ iDB->ui2data = db_ui2data;
+ iDB->ui2key = db_ui2key;
+}
diff --git a/src/common/db.h b/src/common/db.h
index f1f6146be..8ad033cce 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -599,73 +599,73 @@ struct DBMap {
// For easy access to the common functions.
#define db_exists(db,k) ( (db)->exists((db),(k)) )
-#define idb_exists(db,k) ( (db)->exists((db),DB->i2key(k)) )
-#define uidb_exists(db,k) ( (db)->exists((db),DB->ui2key(k)) )
-#define strdb_exists(db,k) ( (db)->exists((db),DB->str2key(k)) )
+#define idb_exists(db,k) ( (db)->exists((db),iDB->i2key(k)) )
+#define uidb_exists(db,k) ( (db)->exists((db),iDB->ui2key(k)) )
+#define strdb_exists(db,k) ( (db)->exists((db),iDB->str2key(k)) )
// Get pointer-type data from DBMaps of various key types
-#define db_get(db,k) ( DB->data2ptr((db)->get((db),(k))) )
-#define idb_get(db,k) ( DB->data2ptr((db)->get((db),DB->i2key(k))) )
-#define uidb_get(db,k) ( DB->data2ptr((db)->get((db),DB->ui2key(k))) )
-#define strdb_get(db,k) ( DB->data2ptr((db)->get((db),DB->str2key(k))) )
+#define db_get(db,k) ( iDB->data2ptr((db)->get((db),(k))) )
+#define idb_get(db,k) ( iDB->data2ptr((db)->get((db),iDB->i2key(k))) )
+#define uidb_get(db,k) ( iDB->data2ptr((db)->get((db),iDB->ui2key(k))) )
+#define strdb_get(db,k) ( iDB->data2ptr((db)->get((db),iDB->str2key(k))) )
// Get int-type data from DBMaps of various key types
-#define db_iget(db,k) ( DB->data2i((db)->get((db),(k))) )
-#define idb_iget(db,k) ( DB->data2i((db)->get((db),DB->i2key(k))) )
-#define uidb_iget(db,k) ( DB->data2i((db)->get((db),DB->ui2key(k))) )
-#define strdb_iget(db,k) ( DB->data2i((db)->get((db),DB->str2key(k))) )
+#define db_iget(db,k) ( iDB->data2i((db)->get((db),(k))) )
+#define idb_iget(db,k) ( iDB->data2i((db)->get((db),iDB->i2key(k))) )
+#define uidb_iget(db,k) ( iDB->data2i((db)->get((db),iDB->ui2key(k))) )
+#define strdb_iget(db,k) ( iDB->data2i((db)->get((db),iDB->str2key(k))) )
// Get uint-type data from DBMaps of various key types
-#define db_uiget(db,k) ( DB->data2ui((db)->get((db),(k))) )
-#define idb_uiget(db,k) ( DB->data2ui((db)->get((db),DB->i2key(k))) )
-#define uidb_uiget(db,k) ( DB->data2ui((db)->get((db),DB->ui2key(k))) )
-#define strdb_uiget(db,k) ( DB->data2ui((db)->get((db),DB->str2key(k))) )
+#define db_uiget(db,k) ( iDB->data2ui((db)->get((db),(k))) )
+#define idb_uiget(db,k) ( iDB->data2ui((db)->get((db),iDB->i2key(k))) )
+#define uidb_uiget(db,k) ( iDB->data2ui((db)->get((db),iDB->ui2key(k))) )
+#define strdb_uiget(db,k) ( iDB->data2ui((db)->get((db),iDB->str2key(k))) )
// Put pointer-type data into DBMaps of various key types
-#define db_put(db,k,d) ( (db)->put((db),(k),DB->ptr2data(d),NULL) )
-#define idb_put(db,k,d) ( (db)->put((db),DB->i2key(k),DB->ptr2data(d),NULL) )
-#define uidb_put(db,k,d) ( (db)->put((db),DB->ui2key(k),DB->ptr2data(d),NULL) )
-#define strdb_put(db,k,d) ( (db)->put((db),DB->str2key(k),DB->ptr2data(d),NULL) )
+#define db_put(db,k,d) ( (db)->put((db),(k),iDB->ptr2data(d),NULL) )
+#define idb_put(db,k,d) ( (db)->put((db),iDB->i2key(k),iDB->ptr2data(d),NULL) )
+#define uidb_put(db,k,d) ( (db)->put((db),iDB->ui2key(k),iDB->ptr2data(d),NULL) )
+#define strdb_put(db,k,d) ( (db)->put((db),iDB->str2key(k),iDB->ptr2data(d),NULL) )
// Put int-type data into DBMaps of various key types
-#define db_iput(db,k,d) ( (db)->put((db),(k),DB->i2data(d),NULL) )
-#define idb_iput(db,k,d) ( (db)->put((db),DB->i2key(k),DB->i2data(d),NULL) )
-#define uidb_iput(db,k,d) ( (db)->put((db),DB->ui2key(k),DB->i2data(d),NULL) )
-#define strdb_iput(db,k,d) ( (db)->put((db),DB->str2key(k),DB->i2data(d),NULL) )
+#define db_iput(db,k,d) ( (db)->put((db),(k),iDB->i2data(d),NULL) )
+#define idb_iput(db,k,d) ( (db)->put((db),iDB->i2key(k),iDB->i2data(d),NULL) )
+#define uidb_iput(db,k,d) ( (db)->put((db),iDB->ui2key(k),iDB->i2data(d),NULL) )
+#define strdb_iput(db,k,d) ( (db)->put((db),iDB->str2key(k),iDB->i2data(d),NULL) )
// Put uint-type data into DBMaps of various key types
-#define db_uiput(db,k,d) ( (db)->put((db),(k),DB->ui2data(d),NULL) )
-#define idb_uiput(db,k,d) ( (db)->put((db),DB->i2key(k),DB->ui2data(d),NULL) )
-#define uidb_uiput(db,k,d) ( (db)->put((db),DB->ui2key(k),DB->ui2data(d),NULL) )
-#define strdb_uiput(db,k,d) ( (db)->put((db),DB->str2key(k),DB->ui2data(d),NULL) )
+#define db_uiput(db,k,d) ( (db)->put((db),(k),iDB->ui2data(d),NULL) )
+#define idb_uiput(db,k,d) ( (db)->put((db),iDB->i2key(k),iDB->ui2data(d),NULL) )
+#define uidb_uiput(db,k,d) ( (db)->put((db),iDB->ui2key(k),iDB->ui2data(d),NULL) )
+#define strdb_uiput(db,k,d) ( (db)->put((db),iDB->str2key(k),iDB->ui2data(d),NULL) )
// Remove entry from DBMaps of various key types
#define db_remove(db,k) ( (db)->remove((db),(k),NULL) )
-#define idb_remove(db,k) ( (db)->remove((db),DB->i2key(k),NULL) )
-#define uidb_remove(db,k) ( (db)->remove((db),DB->ui2key(k),NULL) )
-#define strdb_remove(db,k) ( (db)->remove((db),DB->str2key(k),NULL) )
+#define idb_remove(db,k) ( (db)->remove((db),iDB->i2key(k),NULL) )
+#define uidb_remove(db,k) ( (db)->remove((db),iDB->ui2key(k),NULL) )
+#define strdb_remove(db,k) ( (db)->remove((db),iDB->str2key(k),NULL) )
//These are discarding the possible vargs you could send to the function, so those
//that require vargs must not use these defines.
-#define db_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),(k),(f))) )
-#define idb_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),DB->i2key(k),(f))) )
-#define uidb_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),DB->ui2key(k),(f))) )
-#define strdb_ensure(db,k,f) ( DB->data2ptr((db)->ensure((db),DB->str2key(k),(f))) )
+#define db_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),(k),(f))) )
+#define idb_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),iDB->i2key(k),(f))) )
+#define uidb_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),iDB->ui2key(k),(f))) )
+#define strdb_ensure(db,k,f) ( iDB->data2ptr((db)->ensure((db),iDB->str2key(k),(f))) )
// Database creation and destruction macros
-#define idb_alloc(opt) DB->alloc(__FILE__,__LINE__,DB_INT,(opt),sizeof(int))
-#define uidb_alloc(opt) DB->alloc(__FILE__,__LINE__,DB_UINT,(opt),sizeof(unsigned int))
-#define strdb_alloc(opt,maxlen) DB->alloc(__FILE__,__LINE__,DB_STRING,(opt),(maxlen))
-#define stridb_alloc(opt,maxlen) DB->alloc(__FILE__,__LINE__,DB_ISTRING,(opt),(maxlen))
+#define idb_alloc(opt) iDB->alloc(__FILE__,__func__,__LINE__,DB_INT,(opt),sizeof(int))
+#define uidb_alloc(opt) iDB->alloc(__FILE__,__func__,__LINE__,DB_UINT,(opt),sizeof(unsigned int))
+#define strdb_alloc(opt,maxlen) iDB->alloc(__FILE__,__func__,__LINE__,DB_STRING,(opt),(maxlen))
+#define stridb_alloc(opt,maxlen) iDB->alloc(__FILE__,__func__,__LINE__,DB_ISTRING,(opt),(maxlen))
#define db_destroy(db) ( (db)->destroy((db),NULL) )
// Other macros
#define db_clear(db) ( (db)->clear(db,NULL) )
#define db_size(db) ( (db)->size(db) )
#define db_iterator(db) ( (db)->iterator(db) )
-#define dbi_first(dbi) ( DB->data2ptr((dbi)->first(dbi,NULL)) )
-#define dbi_last(dbi) ( DB->data2ptr((dbi)->last(dbi,NULL)) )
-#define dbi_next(dbi) ( DB->data2ptr((dbi)->next(dbi,NULL)) )
-#define dbi_prev(dbi) ( DB->data2ptr((dbi)->prev(dbi,NULL)) )
+#define dbi_first(dbi) ( iDB->data2ptr((dbi)->first(dbi,NULL)) )
+#define dbi_last(dbi) ( iDB->data2ptr((dbi)->last(dbi,NULL)) )
+#define dbi_next(dbi) ( iDB->data2ptr((dbi)->next(dbi,NULL)) )
+#define dbi_prev(dbi) ( iDB->data2ptr((dbi)->prev(dbi,NULL)) )
#define dbi_remove(dbi) ( (dbi)->remove(dbi,NULL) )
#define dbi_exists(dbi) ( (dbi)->exists(dbi) )
#define dbi_destroy(dbi) ( (dbi)->destroy(dbi) )
@@ -776,7 +776,7 @@ DBReleaser (*custom_release) (DBRelease which);
* @see #db_default_release(DBType,DBOptions)
* @see #db_fix_options(DBType,DBOptions)
*/
-DBMap* (*alloc) (const char *file, int line, DBType type, DBOptions options, unsigned short maxlen);
+DBMap* (*alloc) (const char *file, const char *func, int line, DBType type, DBOptions options, unsigned short maxlen);
/**
* Manual cast from 'int' to the union DBKey.
@@ -867,9 +867,9 @@ void (*init) (void);
* @see #db_init(void)
*/
void (*final) (void);
-} DB_s;
+} iDB_s;
-struct db_interface *DB;
+struct db_interface *iDB;
void db_defaults(void);
// Link DB System - From jAthena
diff --git a/src/common/des.c b/src/common/des.c
index 917fc33e0..ed6d098dc 100644
--- a/src/common/des.c
+++ b/src/common/des.c
@@ -78,8 +78,8 @@ static void E(BIT64* src)
{
BIT64 tmp = {{0}};
-if( false )
-{// original
+#if 0
+ // original
static const uint8_t expand_table[48] = {
32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
@@ -98,9 +98,8 @@ if( false )
if( src->b[j / 8 + 4] & mask[j % 8] )
tmp .b[i / 6 + 0] |= mask[i % 6];
}
-}
-else
-{// optimized
+#endif
+ // optimized
tmp.b[0] = ((src->b[7]<<5) | (src->b[4]>>3)) & 0x3f; // ..0 vutsr
tmp.b[1] = ((src->b[4]<<1) | (src->b[5]>>7)) & 0x3f; // ..srqpo n
tmp.b[2] = ((src->b[4]<<5) | (src->b[5]>>3)) & 0x3f; // ..o nmlkj
@@ -109,7 +108,6 @@ else
tmp.b[5] = ((src->b[6]<<1) | (src->b[7]>>7)) & 0x3f; // ..cba98 7
tmp.b[6] = ((src->b[6]<<5) | (src->b[7]>>3)) & 0x3f; // ..8 76543
tmp.b[7] = ((src->b[7]<<1) | (src->b[4]>>7)) & 0x3f; // ..43210 v
-}
*src = tmp;
}
diff --git a/src/common/ers.c b/src/common/ers.c
index 13e54b393..69b7609d6 100644
--- a/src/common/ers.c
+++ b/src/common/ers.c
@@ -50,11 +50,14 @@
#define ERS_BLOCK_ENTRIES 2048
+
struct ers_list
{
struct ers_list *Next;
};
+struct ers_instance_t;
+
typedef struct ers_cache
{
// Allocated object size, including ers_list size
@@ -75,21 +78,23 @@ typedef struct ers_cache
// Free objects count
unsigned int Free;
- // Used objects count
+ // Used blocks count
unsigned int Used;
-
+
+ // Objects in-use count
+ unsigned int UsedObjs;
+
// Linked list
struct ers_cache *Next, *Prev;
} ers_cache_t;
-typedef struct
-{
+struct ers_instance_t {
// Interface to ERS
struct eri VTable;
// Name, used for debbuging purpouses
char *Name;
-
+
// Misc options
enum ERSOptions Options;
@@ -98,11 +103,21 @@ typedef struct
// Count of objects in use, used for detecting memory leaks
unsigned int Count;
-} ers_instance_t;
+
+#ifdef DEBUG
+ /* for data analysis [Ind/Hercules] */
+ unsigned int Peak;
+ struct ers_instance_t *Next, *Prev;
+#endif
+
+};
// Array containing a pointer for all ers_cache structures
-static ers_cache_t *CacheList;
+static ers_cache_t *CacheList = NULL;
+#ifdef DEBUG
+ static struct ers_instance_t *InstanceList = NULL;
+#endif
static ers_cache_t *ers_find_cache(unsigned int size)
{
@@ -119,6 +134,7 @@ static ers_cache_t *ers_find_cache(unsigned int size)
cache->Blocks = NULL;
cache->Free = 0;
cache->Used = 0;
+ cache->UsedObjs = 0;
cache->Max = 0;
if (CacheList == NULL)
@@ -157,7 +173,7 @@ static void ers_free_cache(ers_cache_t *cache, bool remove)
static void *ers_obj_alloc_entry(ERS self)
{
- ers_instance_t *instance = (ers_instance_t *)self;
+ struct ers_instance_t *instance = (struct ers_instance_t *)self;
void *ret;
if (instance == NULL)
@@ -192,13 +208,19 @@ static void *ers_obj_alloc_entry(ERS self)
}
instance->Count++;
+ instance->Cache->UsedObjs++;
+
+#ifdef DEBUG
+ if( instance->Count > instance->Peak )
+ instance->Peak = instance->Count;
+#endif
return ret;
}
static void ers_obj_free_entry(ERS self, void *entry)
{
- ers_instance_t *instance = (ers_instance_t *)self;
+ struct ers_instance_t *instance = (struct ers_instance_t *)self;
struct ers_list *reuse = (struct ers_list *)((unsigned char *)entry - sizeof(struct ers_list));
if (instance == NULL)
@@ -215,11 +237,12 @@ static void ers_obj_free_entry(ERS self, void *entry)
reuse->Next = instance->Cache->ReuseList;
instance->Cache->ReuseList = reuse;
instance->Count--;
+ instance->Cache->UsedObjs--;
}
static size_t ers_obj_entry_size(ERS self)
{
- ers_instance_t *instance = (ers_instance_t *)self;
+ struct ers_instance_t *instance = (struct ers_instance_t *)self;
if (instance == NULL)
{
@@ -232,7 +255,7 @@ static size_t ers_obj_entry_size(ERS self)
static void ers_obj_destroy(ERS self)
{
- ers_instance_t *instance = (ers_instance_t *)self;
+ struct ers_instance_t *instance = (struct ers_instance_t *)self;
if (instance == NULL)
{
@@ -247,13 +270,26 @@ static void ers_obj_destroy(ERS self)
if (--instance->Cache->ReferenceCount <= 0)
ers_free_cache(instance->Cache, true);
+#ifdef DEBUG
+ if (instance->Next)
+ instance->Next->Prev = instance->Prev;
+
+ if (instance->Prev)
+ instance->Prev->Next = instance->Next;
+ else
+ InstanceList = instance->Next;
+#endif
+
+ if( instance->Options & ERS_OPT_FREE_NAME )
+ aFree(instance->Name);
+
aFree(instance);
}
ERS ers_new(uint32 size, char *name, enum ERSOptions options)
{
- ers_instance_t *instance;
- CREATE(instance, ers_instance_t, 1);
+ struct ers_instance_t *instance;
+ CREATE(instance,struct ers_instance_t, 1);
size += sizeof(struct ers_list);
if (size % ERS_ALIGNED)
@@ -264,29 +300,66 @@ ERS ers_new(uint32 size, char *name, enum ERSOptions options)
instance->VTable.entry_size = ers_obj_entry_size;
instance->VTable.destroy = ers_obj_destroy;
- instance->Name = name;
+ instance->Name = ( options & ERS_OPT_FREE_NAME ) ? aStrdup(name) : name;
instance->Options = options;
instance->Cache = ers_find_cache(size);
instance->Cache->ReferenceCount++;
+#ifdef DEBUG
+ if (InstanceList == NULL) {
+ InstanceList = instance;
+ } else {
+ instance->Next = InstanceList;
+ instance->Next->Prev = instance;
+ InstanceList = instance;
+ InstanceList->Prev = NULL;
+ }
+#endif
instance->Count = 0;
return &instance->VTable;
}
-void ers_report(void)
-{
+void ers_report(void) {
ers_cache_t *cache;
- int i = 0;
+ unsigned int cache_c = 0, blocks_u = 0, blocks_a = 0, memory_b = 0, memory_t = 0;
+#ifdef DEBUG
+ struct ers_instance_t *instance;
+ unsigned int instance_c = 0, instance_c_d = 0;
+
+ for (instance = InstanceList; instance; instance = instance->Next) {
+ instance_c++;
+ if( (instance->Options & ERS_OPT_WAIT) && !instance->Count )
+ continue;
+ instance_c_d++;
+ ShowMessage(CL_BOLD"[ERS Instance "CL_NORMAL""CL_WHITE"%s"CL_NORMAL""CL_BOLD" report]\n"CL_NORMAL, instance->Name);
+ ShowMessage("\tblock size : %u\n", instance->Cache->ObjectSize);
+ ShowMessage("\tblocks being used : %u\n", instance->Count);
+ ShowMessage("\tpeak blocks : %u\n", instance->Peak);
+ ShowMessage("\tmemory in use : %.2f MB\n", instance->Count == 0 ? 0. : (double)((instance->Count * instance->Cache->ObjectSize)/1024)/1024);
+ }
+#endif
+
for (cache = CacheList; cache; cache = cache->Next) {
- ShowMessage(CL_BOLD"[Entry manager #%u report]\n"CL_NORMAL, ++i);
+ cache_c++;
+ ShowMessage(CL_BOLD"[ERS Cache of size '"CL_NORMAL""CL_WHITE"%u"CL_NORMAL""CL_BOLD"' report]\n"CL_NORMAL, cache->ObjectSize);
ShowMessage("\tinstances : %u\n", cache->ReferenceCount);
- ShowMessage("\tblock array size : %u\n", cache->ObjectSize);
- ShowMessage("\tallocated blocks : %u\n", cache->Free+cache->Used);
- ShowMessage("\tentries being used : %u\n", cache->Used);
- ShowMessage("\tunused entries : %u\n", cache->Free);
+ ShowMessage("\tblocks in use : %u/%u\n", cache->UsedObjs, cache->UsedObjs+cache->Free);
+ ShowMessage("\tblocks unused : %u\n", cache->Free);
+ ShowMessage("\tmemory in use : %.2f MB\n", cache->UsedObjs == 0 ? 0. : (double)((cache->UsedObjs * cache->ObjectSize)/1024)/1024);
+ ShowMessage("\tmemory allocated : %.2f MB\n", (cache->Free+cache->UsedObjs) == 0 ? 0. : (double)(((cache->UsedObjs+cache->Free) * cache->ObjectSize)/1024)/1024);
+ blocks_u += cache->UsedObjs;
+ blocks_a += cache->UsedObjs + cache->Free;
+ memory_b += cache->UsedObjs * cache->ObjectSize;
+ memory_t += (cache->UsedObjs+cache->Free) * cache->ObjectSize;
}
+#ifdef DEBUG
+ ShowInfo("ers_report: '"CL_WHITE"%u"CL_NORMAL"' instances in use, '"CL_WHITE"%u"CL_NORMAL"' displayed\n",instance_c,instance_c_d);
+#endif
+ ShowInfo("ers_report: '"CL_WHITE"%u"CL_NORMAL"' caches in use\n",cache_c);
+ ShowInfo("ers_report: '"CL_WHITE"%u"CL_NORMAL"' blocks in use, consuming '"CL_WHITE"%.2f MB"CL_NORMAL"'\n",blocks_u,(double)((memory_b)/1024)/1024);
+ ShowInfo("ers_report: '"CL_WHITE"%u"CL_NORMAL"' blocks total, consuming '"CL_WHITE"%.2f MB"CL_NORMAL"' \n",blocks_a,(double)((memory_t)/1024)/1024);
}
void ers_force_destroy_all(void)
diff --git a/src/common/ers.h b/src/common/ers.h
index dc66af5ef..4871d8d50 100644
--- a/src/common/ers.h
+++ b/src/common/ers.h
@@ -71,8 +71,10 @@
#endif /* not ERS_ALIGN_ENTRY */
enum ERSOptions {
- ERS_OPT_NONE = 0,
- ERS_OPT_CLEAR = 1,/* silently clears any entries left in the manager upon destruction */
+ ERS_OPT_NONE = 0x0,
+ ERS_OPT_CLEAR = 0x1,/* silently clears any entries left in the manager upon destruction */
+ ERS_OPT_WAIT = 0x2,/* wait for entries to come in order to list! */
+ ERS_OPT_FREE_NAME = 0x4,/* name is dynamic memory, and should be freed */
};
/**
diff --git a/src/common/grfio.c b/src/common/grfio.c
index bf66dba52..77b976926 100644
--- a/src/common/grfio.c
+++ b/src/common/grfio.c
@@ -171,7 +171,7 @@ static void grf_decode_full(unsigned char* buf, size_t len, int cycle)
scycle = 7;
// so decrypt/de-shuffle periodically
- j = -1; // 0, adjusted to fit the ++j step
+ j = (size_t)-1; // 0, adjusted to fit the ++j step
for( i = 20; i < nblocks; ++i )
{
if( i % dcycle == 0 )
@@ -408,7 +408,7 @@ void* grfio_reads(const char* fname, int* size)
declen = ftell(in);
fseek(in,0,SEEK_SET);
buf2 = (unsigned char *)aMalloc(declen+1); // +1 for resnametable zero-termination
- if(fread(buf2, 1, declen, in) != declen) ShowError("An error occured in fread grfio_reads, fname=%s \n",fname);
+ if(fread(buf2, 1, declen, in) != (size_t)declen) ShowError("An error occured in fread grfio_reads, fname=%s \n",fname);
fclose(in);
if( size )
@@ -430,7 +430,7 @@ void* grfio_reads(const char* fname, int* size)
int fsize = entry->srclen_aligned;
unsigned char *buf = (unsigned char *)aMalloc(fsize);
fseek(in, entry->srcpos, 0);
- if(fread(buf, 1, fsize, in) != fsize) ShowError("An error occured in fread in grfio_reads, grfname=%s\n",grfname);
+ if(fread(buf, 1, fsize, in) != (size_t)fsize) ShowError("An error occured in fread in grfio_reads, grfname=%s\n",grfname);
fclose(in);
buf2 = (unsigned char *)aMalloc(entry->declen+1); // +1 for resnametable zero-termination
@@ -526,7 +526,7 @@ static int grfio_entryread(const char* grfname, int gentry)
long list_size;
list_size = grf_size - ftell(fp);
grf_filelist = (unsigned char *) aMalloc(list_size);
- if(fread(grf_filelist,1,list_size,fp) != list_size) { ShowError("Couldn't read all grf_filelist element of %s \n", grfname); }
+ if(fread(grf_filelist,1,list_size,fp) != (size_t)list_size) { ShowError("Couldn't read all grf_filelist element of %s \n", grfname); }
fclose(fp);
entrys = getlong(grf_header+0x26) - getlong(grf_header+0x22) - 7;
@@ -559,7 +559,7 @@ static int grfio_entryread(const char* grfname, int gentry)
#ifdef GRFIO_LOCAL
aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck
#else
- aentry.gentry = gentry+1; // With no first time LocalFileCheck
+ aentry.gentry = (char)(gentry+1); // With no first time LocalFileCheck
#endif
filelist_modify(&aentry);
}
@@ -611,13 +611,13 @@ static int grfio_entryread(const char* grfname, int gentry)
aentry.srclen_aligned = getlong(grf_filelist+ofs2+4);
aentry.declen = getlong(grf_filelist+ofs2+8);
aentry.srcpos = getlong(grf_filelist+ofs2+13)+0x2e;
- aentry.type = type;
+ aentry.type = (char)type;
safestrncpy(aentry.fn, fname, sizeof(aentry.fn));
aentry.fnd = NULL;
#ifdef GRFIO_LOCAL
aentry.gentry = -(gentry+1); // As Flag for making it a negative number carrying out the first time LocalFileCheck
#else
- aentry.gentry = gentry+1; // With no first time LocalFileCheck
+ aentry.gentry = (char)(gentry+1); // With no first time LocalFileCheck
#endif
filelist_modify(&aentry);
}
diff --git a/src/common/malloc.c b/src/common/malloc.c
index 4874aa0f4..d629aa63f 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -200,6 +200,8 @@ static struct unit_head_large *unit_head_large_first = NULL;
static struct block* block_malloc(unsigned short hash);
static void block_free(struct block* p);
static size_t memmgr_usage_bytes;
+static size_t memmgr_usage_bytes_t;
+
#define block2unit(p, n) ((struct unit_head*)(&(p)->data[ p->unit_size * (n) ]))
#define memmgr_assert(v) do { if(!(v)) { ShowError("Memory manager: assertion '" #v "' failed!\n"); } } while(0)
@@ -245,12 +247,13 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
/* At that time, the distinction by assigning NULL to unit_head.block */
if(hash2size(size_hash) > BLOCK_DATA_SIZE - sizeof(struct unit_head)) {
struct unit_head_large* p = (struct unit_head_large*)MALLOC(sizeof(struct unit_head_large)+size,file,line,func);
+ memmgr_usage_bytes_t += size+sizeof(struct unit_head_large);
if(p != NULL) {
p->size = size;
p->unit_head.block = NULL;
p->unit_head.size = 0;
p->unit_head.file = file;
- p->unit_head.line = line;
+ p->unit_head.line = (unsigned short)line;
p->prev = NULL;
if (unit_head_large_first == NULL)
p->next = NULL;
@@ -324,7 +327,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
head->block = block;
head->file = file;
- head->line = line;
+ head->line = (unsigned short)line;
head->size = (unsigned short)size;
*(long*)((char*)head + sizeof(struct unit_head) - sizeof(long) + size) = 0xdeadbeaf;
return (char *)head + sizeof(struct unit_head) - sizeof(long);
@@ -332,7 +335,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
void* _mcalloc(size_t num, size_t size, const char *file, int line, const char *func )
{
- void *p = malloclib->malloc(num * size,file,line,func);
+ void *p = iMalloc->malloc(num * size,file,line,func);
memset(p,0,num * size);
return p;
}
@@ -341,7 +344,7 @@ void* _mrealloc(void *memblock, size_t size, const char *file, int line, const c
{
size_t old_size;
if(memblock == NULL) {
- return malloclib->malloc(size,file,line,func);
+ return iMalloc->malloc(size,file,line,func);
}
old_size = ((struct unit_head *)((char *)memblock - sizeof(struct unit_head) + sizeof(long)))->size;
@@ -353,11 +356,11 @@ void* _mrealloc(void *memblock, size_t size, const char *file, int line, const c
return memblock;
} else {
// Size Large
- void *p = malloclib->malloc(size,file,line,func);
+ void *p = iMalloc->malloc(size,file,line,func);
if(p != NULL) {
memcpy(p,memblock,old_size);
}
- malloclib->free(memblock,file,line,func);
+ iMalloc->free(memblock,file,line,func);
return p;
}
}
@@ -368,7 +371,7 @@ char* _mstrdup(const char *p, const char *file, int line, const char *func )
return NULL;
} else {
size_t len = strlen(p);
- char *string = (char *)malloclib->malloc(len + 1,file,line,func);
+ char *string = (char *)iMalloc->malloc(len + 1,file,line,func);
memcpy(string,p,len+1);
return string;
}
@@ -401,6 +404,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func )
head_large->next->prev = head_large->prev;
}
memmgr_usage_bytes -= head_large->size;
+ memmgr_usage_bytes_t -= head_large->size + sizeof(struct unit_head_large);
#ifdef DEBUG_MEMMGR
// set freed memory to 0xfd
memset(ptr, 0xfd, head_large->size);
@@ -422,7 +426,7 @@ void _mfree(void *ptr, const char *file, int line, const char *func )
#ifdef DEBUG_MEMMGR
memset(ptr, 0xfd, block->unit_size - sizeof(struct unit_head) + sizeof(long) );
head->file = file;
- head->line = line;
+ head->line = (unsigned short)line;
#endif
memmgr_assert( block->unit_used > 0 );
if(--block->unit_used == 0) {
@@ -457,6 +461,7 @@ static struct block* block_malloc(unsigned short hash)
} else {
/* Newly allocated space for the block */
p = (struct block*)MALLOC(sizeof(struct block) * (BLOCK_ALLOC), __FILE__, __LINE__, __func__ );
+ memmgr_usage_bytes_t += sizeof(struct block) * (BLOCK_ALLOC);
if(p == NULL) {
ShowFatalError("Memory manager::block_alloc failed.\n");
exit(EXIT_FAILURE);
@@ -621,7 +626,7 @@ static void memmgr_final (void)
memmgr_log (buf);
#endif /* LOG_MEMMGR */
// get block pointer and free it [celest]
- malloclib->free(ptr, ALC_MARK);
+ iMalloc->free(ptr, ALC_MARK);
}
}
}
@@ -650,6 +655,86 @@ static void memmgr_final (void)
}
#endif /* LOG_MEMMGR */
}
+/* [Ind/Hercules] */
+void memmgr_report (int extra) {
+ struct block *block = block_first;
+ struct unit_head_large *large = unit_head_large_first;
+ unsigned int count = 0, size = 0;
+ int j;
+ unsigned short msize = 1024;
+ struct {
+ const char *file;
+ unsigned short line;
+ unsigned int size;
+ unsigned int count;
+ } data[100];
+ memset(&data, 0, sizeof(data));
+
+ if( extra != 0 )
+ msize = extra;
+
+ while (block) {
+ if (block->unit_used) {
+ int i;
+ for (i = 0; i < block->unit_maxused; i++) {
+ struct unit_head *head = block2unit(block, i);
+ if( head->block != NULL && head->size > msize ) {
+ for( j = 0; j < 100; j++ ) {
+ if( data[j].file == head->file && data[j].line == head->line ) {
+ data[j].size += head->size;
+ data[j].count += 1;
+ break;
+ } else if( data[j].size == 0 ) {
+ data[j].file = head->file;
+ data[j].line = head->line;
+ data[j].size = head->size;
+ data[j].count += 1;
+ break;
+ }
+ }
+ size += (unsigned int)head->size;
+ count++;
+ }
+ }
+ }
+ block = block->block_next;
+ }
+
+ while(large) {
+ if( large->size > msize ) {
+ for( j = 0; j < 100; j++ ) {
+ if( data[j].file == large->unit_head.file && data[j].line == large->unit_head.line ) {
+ data[j].size += large->size;
+ data[j].count += 1;
+ break;
+ } else if( data[j].size == 0 ) {
+ data[j].file = large->unit_head.file;
+ data[j].line = large->unit_head.line;
+ data[j].size = large->size;
+ data[j].count += 1;
+ break;
+ }
+ }
+ size += (unsigned int)large->size;
+ count++;
+ }
+ large = large->next;
+ }
+ for( j = 0; j < 100; j++ ) {
+ if( data[j].size != 0 ) {
+ ShowMessage("[malloc] : "CL_WHITE"%s"CL_RESET":"CL_WHITE"%d"CL_RESET" %d instances => %.2f MB\n",data[j].file,data[j].line,data[j].count,(double)((data[j].size)/1024)/1024);
+ }
+ }
+ ShowMessage("[malloc] : reporting %u instances | %.2f MB\n",count,(double)((size)/1024)/1024);
+ ShowMessage("[malloc] : internal usage %.2f MB | %.2f MB\n",(double)((memmgr_usage_bytes_t-memmgr_usage_bytes)/1024)/1024,(double)((memmgr_usage_bytes_t)/1024)/1024);
+
+ if( extra ) {
+ ShowMessage("[malloc] : unit_head_large: %d bytes\n",sizeof(struct unit_head_large));
+ ShowMessage("[malloc] : unit_head: %d bytes\n",sizeof(struct unit_head));
+ ShowMessage("[malloc] : block: %d bytes\n",sizeof(struct block));
+ }
+
+}
static void memmgr_init (void)
{
@@ -677,8 +762,7 @@ void malloc_memory_check(void)
/// Returns true if a pointer is valid.
/// The check is best-effort, false positives are possible.
-bool malloc_verify_ptr(void* ptr)
-{
+bool malloc_verify_ptr(void* ptr) {
#ifdef USE_MEMMGR
return memmgr_verify(ptr) && MEMORY_VERIFY(ptr);
#else
@@ -687,8 +771,7 @@ bool malloc_verify_ptr(void* ptr)
}
-size_t malloc_usage (void)
-{
+size_t malloc_usage (void) {
#ifdef USE_MEMMGR
return memmgr_usage ();
#else
@@ -696,16 +779,16 @@ size_t malloc_usage (void)
#endif
}
-void malloc_final (void)
-{
+void malloc_final (void) {
#ifdef USE_MEMMGR
memmgr_final ();
#endif
MEMORY_CHECK();
}
-void malloc_init (void)
-{
+void malloc_init (void) {
+ memmgr_usage_bytes_t = 0;
+ memmgr_usage_bytes = 0;
#if defined(DMALLOC) && defined(CYGWIN)
// http://dmalloc.com/docs/latest/online/dmalloc_19.html
dmalloc_debug_setup(getenv("DMALLOC_OPTIONS"));
@@ -720,27 +803,26 @@ void malloc_init (void)
#endif
}
-void malloc_defaults()
-{
- malloclib = &malloclib_s;
- malloclib->init = malloc_init;
- malloclib->final = malloc_final;
- malloclib->memory_check = malloc_memory_check;
- malloclib->usage = malloc_usage;
- malloclib->verify_ptr = malloc_verify_ptr;
+void malloc_defaults(void) {
+ iMalloc = &iMalloc_s;
+ iMalloc->init = malloc_init;
+ iMalloc->final = malloc_final;
+ iMalloc->memory_check = malloc_memory_check;
+ iMalloc->usage = malloc_usage;
+ iMalloc->verify_ptr = malloc_verify_ptr;
// Athena's built-in Memory Manager
#ifdef USE_MEMMGR
- malloclib->malloc = _mmalloc;
- malloclib->calloc = _mcalloc;
- malloclib->realloc = _mrealloc;
- malloclib->astrdup = _mstrdup;
- malloclib->free = _mfree;
+ iMalloc->malloc = _mmalloc;
+ iMalloc->calloc = _mcalloc;
+ iMalloc->realloc = _mrealloc;
+ iMalloc->astrdup = _mstrdup;
+ iMalloc->free = _mfree;
#else
- malloclib->malloc = aMalloc_;
- malloclib->calloc = aCalloc_;
- malloclib->realloc = aRealloc_;
- malloclib->astrdup = aStrdup_;
- malloclib->free = aFree_;
+ iMalloc->malloc = aMalloc_;
+ iMalloc->calloc = aCalloc_;
+ iMalloc->realloc = aRealloc_;
+ iMalloc->astrdup = aStrdup_;
+ iMalloc->free = aFree_;
#endif
}
diff --git a/src/common/malloc.h b/src/common/malloc.h
index 34a26b56e..834781905 100644
--- a/src/common/malloc.h
+++ b/src/common/malloc.h
@@ -30,11 +30,11 @@
#undef LOG_MEMMGR
#endif
-# define aMalloc(n) malloclib->malloc (n,ALC_MARK)
-# define aCalloc(m,n) malloclib->calloc (m,n,ALC_MARK)
-# define aRealloc(p,n) malloclib->realloc (p,n,ALC_MARK)
-# define aStrdup(p) malloclib->astrdup (p,ALC_MARK)
-# define aFree(p) malloclib->free (p,ALC_MARK)
+# define aMalloc(n) iMalloc->malloc (n,ALC_MARK)
+# define aCalloc(m,n) iMalloc->calloc (m,n,ALC_MARK)
+# define aRealloc(p,n) iMalloc->realloc (p,n,ALC_MARK)
+# define aStrdup(p) iMalloc->astrdup (p,ALC_MARK)
+# define aFree(p) iMalloc->free (p,ALC_MARK)
/////////////// Buffer Creation /////////////////
// Full credit for this goes to Shinomori [Ajarn]
@@ -78,7 +78,9 @@ struct malloc_interface {
size_t (*usage) (void);
void (*init) (void);
void (*final) (void);
-} malloclib_s;
+} iMalloc_s;
-struct malloc_interface *malloclib;
+void memmgr_report (int extra);
+
+struct malloc_interface *iMalloc;
#endif /* _MALLOC_H_ */
diff --git a/src/common/mapindex.c b/src/common/mapindex.c
index 4649e299d..83de21b2b 100644
--- a/src/common/mapindex.c
+++ b/src/common/mapindex.c
@@ -148,7 +148,7 @@ void mapindex_init(void) {
exit(EXIT_FAILURE); //Server can't really run without this file.
}
memset (&indexes, 0, sizeof (indexes));
- mapindex_db = strdb_alloc(DB_RELEASE_KEY, MAP_NAME_LENGTH);
+ mapindex_db = strdb_alloc(DB_OPT_DUP_KEY, MAP_NAME_LENGTH);
while(fgets(line, sizeof(line), fp)) {
if(line[0] == '/' && line[1] == '/')
continue;
diff --git a/src/common/mapindex.h b/src/common/mapindex.h
index d35d9899c..43953a8e0 100644
--- a/src/common/mapindex.h
+++ b/src/common/mapindex.h
@@ -7,7 +7,7 @@
#include "../common/db.h"
-/* when a map index search fails, return results from what map? default:prontera */
+// When a map index search fails, return results from what map? default:prontera
#define MAP_DEFAULT "prontera"
#define MAP_DEFAULT_X 150
#define MAP_DEFAULT_Y 150
diff --git a/src/common/mmo.h b/src/common/mmo.h
index d45dea212..c2fdfe43a 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -51,13 +51,14 @@
#define PACKETVER 20120418
#endif
-/// comment following line if your client is NOT ragexeRE (required because of conflicting packets in ragexe vs ragexeRE)
+// Comment the following line if your client is NOT ragexeRE (required because of conflicting packets in ragexe vs ragexeRE).
#define PACKETVER_RE
-//Remove/Comment this line to disable sc_data saving. [Skotlex]
+// Comment the following line to disable sc_data saving. [Skotlex]
#define ENABLE_SC_SAVING
-//Remove/Comment this line to disable server-side hot-key saving support [Skotlex]
-//Note that newer clients no longer save hotkeys in the registry!
+
+// Comment the following like to disable server-side hot-key saving support. [Skotlex]
+// Note that newer clients no longer save hotkeys in the registry!
#define HOTKEY_SAVING
#if PACKETVER < 20090603
@@ -71,7 +72,6 @@
#define MAX_HOTKEYS 38
#endif
-#define MAX_MAP_PER_SERVER 1500 // Increased to allow creation of Instance Maps
#define MAX_INVENTORY 100
//Max number of characters per account. Note that changing this setting alone is not enough if the client is not hexed to support more characters as well.
#define MAX_CHARS 9
@@ -84,10 +84,10 @@
#define MAX_FAME 1000000000
#define MAX_CART 100
#define MAX_SKILL 1477
-#define MAX_SKILL_ID 10015 //[Ind/Hercules] max used skill id
-#define GLOBAL_REG_NUM 256 // max permanent character variables per char
-#define ACCOUNT_REG_NUM 64 // max permanent local account variables per account
-#define ACCOUNT_REG2_NUM 16 // max permanent global account variables per account
+#define MAX_SKILL_ID 10015 // [Ind/Hercules] max used skill ID
+#define GLOBAL_REG_NUM 256 // Max permanent character variables per char
+#define ACCOUNT_REG_NUM 64 // Max permanent local account variables per account
+#define ACCOUNT_REG2_NUM 16 // Max permanent global account variables per account
//Should hold the max of GLOBAL/ACCOUNT/ACCOUNT2 (needed for some arrays that hold all three)
#define MAX_REG_NUM 256
#define DEFAULT_WALK_SPEED 150
@@ -96,16 +96,16 @@
#define MAX_STORAGE 600
#define MAX_GUILD_STORAGE 600
#define MAX_PARTY 12
-#define MAX_GUILD 16+10*6 // increased max guild members +6 per 1 extension levels [Lupus]
-#define MAX_GUILDPOSITION 20 // increased max guild positions to accomodate for all members [Valaris] (removed) [PoW]
+#define MAX_GUILD 16+10*6 // Increased max guild members +6 per 1 extension levels [Lupus]
+#define MAX_GUILDPOSITION 20 // Increased max guild positions to accomodate for all members [Valaris] (removed) [PoW]
#define MAX_GUILDEXPULSION 32
#define MAX_GUILDALLIANCE 16
-#define MAX_GUILDSKILL 15 // increased max guild skills because of new skills [Sara-chan]
+#define MAX_GUILDSKILL 15 // Increased max guild skills because of new skills [Sara-chan]
#define MAX_GUILDLEVEL 50
-#define MAX_GUARDIANS 8 //Local max per castle. [Skotlex]
-#define MAX_QUEST_DB 2400 //Max quests that the server will load
-#define MAX_QUEST_OBJECTIVES 3 //Max quest objectives for a quest
-#define MAX_START_ITEMS 32 //Max number of items allowed to be given to a char whenever it's created. [mkbu95]
+#define MAX_GUARDIANS 8 // Local max per castle. [Skotlex]
+#define MAX_QUEST_DB 2410 // Max quests that the server will load
+#define MAX_QUEST_OBJECTIVES 3 // Max quest objectives for a quest
+#define MAX_START_ITEMS 32 // Max number of items allowed to be given to a char whenever it's created. [mkbu95]
// for produce
#define MIN_ATTRIBUTE 0
@@ -124,43 +124,43 @@
#define NAME_LENGTH (23 + 1)
//For item names, which tend to have much longer names.
#define ITEM_NAME_LENGTH 50
-//For Map Names, which the client considers to be 16 in length including the .gat extension
+//For Map Names, which the client considers to be 16 in length including the .gat extension.
#define MAP_NAME_LENGTH (11 + 1)
#define MAP_NAME_LENGTH_EXT (MAP_NAME_LENGTH + 4)
#define MAX_FRIENDS 40
#define MAX_MEMOPOINTS 3
-//Size of the fame list arrays.
+// Size of the fame list arrays.
#define MAX_FAME_LIST 10
-//Limits to avoid ID collision with other game objects
+// Limits to avoid ID collision with other game objects
#define START_ACCOUNT_NUM 2000000
#define END_ACCOUNT_NUM 100000000
#define START_CHAR_NUM 150000
-//Guilds
+// Guilds
#define MAX_GUILDMES1 60
#define MAX_GUILDMES2 120
-//Base Homun skill.
+// Base Homun skill.
#define HM_SKILLBASE 8001
#define MAX_HOMUNSKILL 43
-#define MAX_HOMUNCULUS_CLASS 52 //[orn], Increased to 60 from 16 to allow new Homun-S.
+#define MAX_HOMUNCULUS_CLASS 52 // [orn] Increased to 60 from 16 to allow new Homun-S.
#define HM_CLASS_BASE 6001
#define HM_CLASS_MAX (HM_CLASS_BASE+MAX_HOMUNCULUS_CLASS-1)
-//Mail System
+// Mail System
#define MAIL_MAX_INBOX 30
#define MAIL_TITLE_LENGTH 40
#define MAIL_BODY_LENGTH 200
-//Mercenary System
+// Mercenary System
#define MC_SKILLBASE 8201
#define MAX_MERCSKILL 40
#define MAX_MERCENARY_CLASS 61
-//Elemental System
+// Elemental System
#define MAX_ELEMENTALSKILL 42
#define EL_SKILLBASE 8401
#define MAX_ELESKILLTREE 3
@@ -186,7 +186,7 @@ enum item_types {
};
-//Questlog system [Kevin] [Inkfish]
+// Questlog system [Kevin] [Inkfish]
typedef enum quest_state { Q_INACTIVE, Q_ACTIVE, Q_COMPLETE } quest_state;
struct quest {
@@ -200,7 +200,7 @@ struct item {
int id;
short nameid;
short amount;
- unsigned short equip; // location(s) where item is equipped (using enum equip_pos for bitmasking)
+ unsigned short equip; // Location(s) where item is equipped (using enum equip_pos for bitmasking).
char identify;
char refine;
char attribute;
@@ -220,8 +220,8 @@ enum e_skill_flag
SKILL_FLAG_PERMANENT,
SKILL_FLAG_TEMPORARY,
SKILL_FLAG_PLAGIARIZED,
- SKILL_FLAG_REPLACED_LV_0, // temporary skill overshadowing permanent skill of level 'N - SKILL_FLAG_REPLACED_LV_0',
- SKILL_FLAG_PERM_GRANTED, // permanent, granted through someway e.g. script
+ SKILL_FLAG_REPLACED_LV_0, // Temporary skill overshadowing permanent skill of level 'N - SKILL_FLAG_REPLACED_LV_0',
+ SKILL_FLAG_PERM_GRANTED, // Permanent, granted through someway (e.g. script).
//...
};
@@ -234,7 +234,7 @@ enum e_mmo_charstatus_opt {
struct s_skill {
unsigned short id;
unsigned char lv;
- unsigned char flag; // see enum e_skill_flag
+ unsigned char flag; // See enum e_skill_flag
};
struct global_reg {
@@ -242,14 +242,14 @@ struct global_reg {
char value[256];
};
-//Holds array of global registries, used by the char server and converter.
+// Holds array of global registries, used by the char server and converter.
struct accreg {
int account_id, char_id;
int reg_num;
struct global_reg reg[MAX_REG_NUM];
};
-//For saving status changes across sessions. [Skotlex]
+// For saving status changes across sessions. [Skotlex]
struct status_change_data {
unsigned short type; //SC_type
long val1, val2, val3, val4, tick; //Remaining duration.
@@ -526,6 +526,10 @@ struct guild {
/* TODO: still used for something?|: */
unsigned short save_flag; // for TXT saving
+
+ unsigned short *instance;
+ unsigned short instances;
+
void *channel;
};
diff --git a/src/common/mutex.c b/src/common/mutex.c
index 6b4f55119..6bb1efdab 100644
--- a/src/common/mutex.c
+++ b/src/common/mutex.c
@@ -201,7 +201,7 @@ void racond_wait( racond c, ramutex m, sysint timeout_ticks){
pthread_cond_wait( &c->hCond, &m->hMutex );
}else{
struct timespec wtime;
- int64 exact_timeout = gettick() + timeout_ticks;
+ int64 exact_timeout = iTimer->gettick() + timeout_ticks;
wtime.tv_sec = exact_timeout/1000;
wtime.tv_nsec = (exact_timeout%1000)*1000000;
diff --git a/src/common/random.c b/src/common/random.c
index 5c048c7eb..a7d432e34 100644
--- a/src/common/random.c
+++ b/src/common/random.c
@@ -17,7 +17,7 @@
/// Initializes the random number generator with an appropriate seed.
void rnd_init(void)
{
- uint32 seed = gettick();
+ uint32 seed = iTimer->gettick();
seed += (uint32)time(NULL);
#if defined(WIN32)
seed += GetCurrentProcessId();
diff --git a/src/common/socket.c b/src/common/socket.c
index 5126d231b..15b20b16f 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -280,9 +280,10 @@ void set_nonblocking(int fd, unsigned long yes)
ShowError("set_nonblocking: Failed to set socket #%d to non-blocking mode (%s) - Please report this!!!\n", fd, error_msg());
}
-void setsocketopts(int fd)
-{
+void setsocketopts(int fd, struct hSockOpt *opt) {
int yes = 1; // reuse fix
+ struct linger lopt;
+
#if !defined(WIN32)
// set SO_REAUSEADDR to true, unix only. on windows this option causes
// the previous owner of the socket to give up, which is not desirable
@@ -297,15 +298,22 @@ void setsocketopts(int fd)
// The RO protocol is mainly single-packet request/response, plus the FIFO model already does packet grouping anyway.
sSetsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&yes, sizeof(yes));
+ if( opt && opt->setTimeo ) {
+ struct timeval timeout;
+
+ timeout.tv_sec = 5;
+ timeout.tv_usec = 0;
+
+ sSetsockopt(fd,SOL_SOCKET,SO_RCVTIMEO,(char *)&timeout,sizeof(timeout));
+ sSetsockopt(fd,SOL_SOCKET,SO_SNDTIMEO,(char *)&timeout,sizeof(timeout));
+ }
+
// force the socket into no-wait, graceful-close mode (should be the default, but better make sure)
//(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/closesocket_2.asp)
- {
- struct linger opt;
- opt.l_onoff = 0; // SO_DONTLINGER
- opt.l_linger = 0; // Do not care
- if( sSetsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&opt, sizeof(opt)) )
+ lopt.l_onoff = 0; // SO_DONTLINGER
+ lopt.l_linger = 0; // Do not care
+ if( sSetsockopt(fd, SOL_SOCKET, SO_LINGER, (char*)&lopt, sizeof(lopt)) )
ShowWarning("setsocketopts: Unable to set SO_LINGER mode for connection #%d!\n", fd);
- }
}
/*======================================
@@ -404,8 +412,7 @@ void flush_fifos(void)
/*======================================
* CORE : Connection functions
*--------------------------------------*/
-int connect_client(int listen_fd)
-{
+int connect_client(int listen_fd) {
int fd;
struct sockaddr_in client_address;
socklen_t len;
@@ -417,20 +424,18 @@ int connect_client(int listen_fd)
ShowError("connect_client: accept failed (%s)!\n", error_msg());
return -1;
}
- if( fd == 0 )
- {// reserved
+ if( fd == 0 ) { // reserved
ShowError("connect_client: Socket #0 is reserved - Please report this!!!\n");
sClose(fd);
return -1;
}
- if( fd >= FD_SETSIZE )
- {// socket number too big
+ if( fd >= FD_SETSIZE ) { // socket number too big
ShowError("connect_client: New socket #%d is greater than can we handle! Increase the value of FD_SETSIZE (currently %d) for your OS to fix this!\n", fd, FD_SETSIZE);
sClose(fd);
return -1;
}
- setsocketopts(fd);
+ setsocketopts(fd,NULL);
set_nonblocking(fd, 1);
#ifndef MINICORE
@@ -457,25 +462,22 @@ int make_listen_bind(uint32 ip, uint16 port)
fd = sSocket(AF_INET, SOCK_STREAM, 0);
- if( fd == -1 )
- {
+ if( fd == -1 ) {
ShowError("make_listen_bind: socket creation failed (%s)!\n", error_msg());
exit(EXIT_FAILURE);
}
- if( fd == 0 )
- {// reserved
+ if( fd == 0 ) { // reserved
ShowError("make_listen_bind: Socket #0 is reserved - Please report this!!!\n");
sClose(fd);
return -1;
}
- if( fd >= FD_SETSIZE )
- {// socket number too big
+ if( fd >= FD_SETSIZE ) { // socket number too big
ShowError("make_listen_bind: New socket #%d is greater than can we handle! Increase the value of FD_SETSIZE (currently %d) for your OS to fix this!\n", fd, FD_SETSIZE);
sClose(fd);
return -1;
}
- setsocketopts(fd);
+ setsocketopts(fd,NULL);
set_nonblocking(fd, 1);
server_address.sin_family = AF_INET;
@@ -503,7 +505,7 @@ int make_listen_bind(uint32 ip, uint16 port)
return fd;
}
-int make_connection(uint32 ip, uint16 port, bool silent) {
+int make_connection(uint32 ip, uint16 port, struct hSockOpt *opt) {
struct sockaddr_in remote_address;
int fd;
int result;
@@ -514,31 +516,29 @@ int make_connection(uint32 ip, uint16 port, bool silent) {
ShowError("make_connection: socket creation failed (%s)!\n", error_msg());
return -1;
}
- if( fd == 0 )
- {// reserved
+ if( fd == 0 ) {// reserved
ShowError("make_connection: Socket #0 is reserved - Please report this!!!\n");
sClose(fd);
return -1;
}
- if( fd >= FD_SETSIZE )
- {// socket number too big
+ if( fd >= FD_SETSIZE ) {// socket number too big
ShowError("make_connection: New socket #%d is greater than can we handle! Increase the value of FD_SETSIZE (currently %d) for your OS to fix this!\n", fd, FD_SETSIZE);
sClose(fd);
return -1;
}
- setsocketopts(fd);
+ setsocketopts(fd,opt);
remote_address.sin_family = AF_INET;
remote_address.sin_addr.s_addr = htonl(ip);
remote_address.sin_port = htons(port);
- if( !silent )
+ if( !( opt && opt->silent ) )
ShowStatus("Connecting to %d.%d.%d.%d:%i\n", CONVIP(ip), port);
result = sConnect(fd, (struct sockaddr *)(&remote_address), sizeof(struct sockaddr_in));
if( result == SOCKET_ERROR ) {
- if( !silent )
+ if( !( opt && opt->silent ) )
ShowError("make_connection: connect failed (socket #%d, %s)!\n", fd, error_msg());
do_close(fd);
return -1;
@@ -947,9 +947,9 @@ static int connect_check_(uint32 ip)
if( hist->ddos )
{// flagged as DDoS
return (connect_ok == 2 ? 1 : 0);
- } else if( DIFF_TICK(gettick(),hist->tick) < ddos_interval )
+ } else if( DIFF_TICK(iTimer->gettick(),hist->tick) < ddos_interval )
{// connection within ddos_interval
- hist->tick = gettick();
+ hist->tick = iTimer->gettick();
if( hist->count++ >= ddos_count )
{// DDoS attack detected
hist->ddos = 1;
@@ -959,7 +959,7 @@ static int connect_check_(uint32 ip)
return connect_ok;
} else
{// not within ddos_interval, clear data
- hist->tick = gettick();
+ hist->tick = iTimer->gettick();
hist->count = 0;
return connect_ok;
}
@@ -970,7 +970,7 @@ static int connect_check_(uint32 ip)
CREATE(hist, ConnectHistory, 1);
memset(hist, 0, sizeof(ConnectHistory));
hist->ip = ip;
- hist->tick = gettick();
+ hist->tick = iTimer->gettick();
hist->next = connect_history[ip&0xFFFF];
connect_history[ip&0xFFFF] = hist;
return connect_ok;
@@ -1331,8 +1331,8 @@ void socket_init(void)
#ifndef MINICORE
// Delete old connection history every 5 minutes
memset(connect_history, 0, sizeof(connect_history));
- add_timer_func_list(connect_check_clear, "connect_check_clear");
- add_timer_interval(gettick()+1000, connect_check_clear, 0, 0, 5*60*1000);
+ iTimer->add_timer_func_list(connect_check_clear, "connect_check_clear");
+ iTimer->add_timer_interval(iTimer->gettick()+1000, connect_check_clear, 0, 0, 5*60*1000);
#endif
ShowInfo("Server supports up to '"CL_WHITE"%u"CL_RESET"' concurrent connections.\n", rlim_cur);
diff --git a/src/common/socket.h b/src/common/socket.h
index 4879cb109..b58cbdccf 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -1,5 +1,6 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#ifndef _SOCKET_H_
#define _SOCKET_H_
@@ -48,6 +49,9 @@
} \
} while(0)
+/* [Ind/Hercules] */
+#define RFIFO2PTR(fd,len) (void*)(session[fd]->rdata + len)
+
// buffer I/O macros
#define RBUFP(p,pos) (((uint8*)(p)) + (pos))
#define RBUFB(p,pos) (*(uint8*)RBUFP((p),(pos)))
@@ -94,6 +98,10 @@ struct socket_data
void* session_data; // stores application-specific data related to the session
};
+struct hSockOpt {
+ unsigned int silent : 1;
+ unsigned int setTimeo : 1;
+};
// Data prototype declaration
@@ -113,7 +121,7 @@ extern bool session_isActive(int fd);
// Function prototype declaration
int make_listen_bind(uint32 ip, uint16 port);
-int make_connection(uint32 ip, uint16 port, bool silent);
+int make_connection(uint32 ip, uint16 port, struct hSockOpt *opt);
int realloc_fifo(int fd, unsigned int rfifo_size, unsigned int wfifo_size);
int realloc_writefifo(int fd, size_t addition);
int WFIFOSET(int fd, size_t len);
diff --git a/src/common/sql.c b/src/common/sql.c
index 391211183..d4bea7c12 100644
--- a/src/common/sql.c
+++ b/src/common/sql.c
@@ -210,7 +210,7 @@ static int Sql_P_Keepalive(Sql* self)
// establish keepalive
ping_interval = timeout - 30; // 30-second reserve
//add_timer_func_list(Sql_P_KeepaliveTimer, "Sql_P_KeepaliveTimer");
- return add_timer_interval(gettick() + ping_interval*1000, Sql_P_KeepaliveTimer, 0, (intptr_t)self, ping_interval*1000);
+ return iTimer->add_timer_interval(iTimer->gettick() + ping_interval*1000, Sql_P_KeepaliveTimer, 0, (intptr_t)self, ping_interval*1000);
}
@@ -404,7 +404,7 @@ void Sql_Free(Sql* self)
{
SQL->FreeResult(self);
StrBuf->Destroy(&self->buf);
- if( self->keepalive != INVALID_TIMER ) delete_timer(self->keepalive, Sql_P_KeepaliveTimer);
+ if( self->keepalive != INVALID_TIMER ) iTimer->delete_timer(self->keepalive, Sql_P_KeepaliveTimer);
aFree(self);
}
}
diff --git a/src/common/timer.c b/src/common/timer.c
index edb46bd71..955a971c8 100644
--- a/src/common/timer.c
+++ b/src/common/timer.c
@@ -257,7 +257,7 @@ int timer_add_interval(unsigned int tick, TimerFunc func, int id, intptr_t data,
int tid;
if( interval < 1 ) {
- ShowError("timer_add_interval: invalid interval (tick=%u %p[%s] id=%d data=%d diff_tick=%d)\n", tick, func, search_timer_func_list(func), id, data, DIFF_TICK(tick, gettick()));
+ ShowError("timer_add_interval: invalid interval (tick=%u %p[%s] id=%d data=%d diff_tick=%d)\n", tick, func, search_timer_func_list(func), id, data, DIFF_TICK(tick, iTimer->gettick()));
return INVALID_TIMER;
}
@@ -300,7 +300,7 @@ int timer_do_delete(int tid, TimerFunc func) {
/// Adjusts a timer's expiration time.
/// Returns the new tick value, or -1 if it fails.
int timer_addtick(int tid, unsigned int tick) {
- return settick_timer(tid, timer_data[tid].tick+tick);
+ return iTimer->settick_timer(tid, timer_data[tid].tick+tick);
}
/// Modifies a timer's expiration time (an alternative to deleting a timer and starting a new one).
@@ -409,15 +409,26 @@ void timer_final(void) {
BHEAP_CLEAR(timer_heap);
if (free_timer_list) aFree(free_timer_list);
}
-void timer_defaults(void) {
- gettick = timer_gettick;
- gettick_nocache = timer_gettick_nocache;
- add_timer = timer_add;
- add_timer_interval = timer_add_interval;
- add_timer_func_list = timer_add_func_list;
- get_timer = timer_get;
- delete_timer = timer_do_delete;
- addtick_timer = timer_addtick;
- settick_timer = timer_settick;
- get_uptime = timer_get_uptime;
+/*=====================================
+* Default Functions : timer.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+void timer_defaults(void) {
+ iTimer = &iTimer_s;
+
+ /* funcs */
+ iTimer->gettick = timer_gettick;
+ iTimer->gettick_nocache = timer_gettick_nocache;
+ iTimer->add_timer = timer_add;
+ iTimer->add_timer_interval = timer_add_interval;
+ iTimer->add_timer_func_list = timer_add_func_list;
+ iTimer->get_timer = timer_get;
+ iTimer->delete_timer = timer_do_delete;
+ iTimer->addtick_timer = timer_addtick;
+ iTimer->settick_timer = timer_settick;
+ iTimer->get_uptime = timer_get_uptime;
+ iTimer->do_timer = do_timer;
+ iTimer->init = timer_init;
+ iTimer->final = timer_final;
}
diff --git a/src/common/timer.h b/src/common/timer.h
index 902679f51..d68b5ed0f 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -34,27 +34,36 @@ struct TimerData {
intptr_t data;
};
-// Function prototype declaration
+/* Hercules Renewal Phase One */
+/*=====================================
+* Interface : timer.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+struct timer_interface {
-int do_timer(unsigned int tick);
-void timer_init(void);
-void timer_final(void);
+ /* funcs */
+ unsigned int (*gettick) (void);
+ unsigned int (*gettick_nocache) (void);
-/* Hercules Renewal Phase One */
-unsigned int (*gettick) (void);
-unsigned int (*gettick_nocache) (void);
+ int (*add_timer) (unsigned int tick, TimerFunc func, int id, intptr_t data);
+ int (*add_timer_interval) (unsigned int tick, TimerFunc func, int id, intptr_t data, int interval);
+ const struct TimerData *(*get_timer) (int tid);
+ int (*delete_timer) (int tid, TimerFunc func);
+
+ int (*addtick_timer) (int tid, unsigned int tick);
+ int (*settick_timer) (int tid, unsigned int tick);
-int (*add_timer) (unsigned int tick, TimerFunc func, int id, intptr_t data);
-int (*add_timer_interval) (unsigned int tick, TimerFunc func, int id, intptr_t data, int interval);
-const struct TimerData *(*get_timer) (int tid);
-int (*delete_timer) (int tid, TimerFunc func);
+ int (*add_timer_func_list) (TimerFunc func, char* name);
-int (*addtick_timer) (int tid, unsigned int tick);
-int (*settick_timer) (int tid, unsigned int tick);
+ unsigned long (*get_uptime) (void);
-int (*add_timer_func_list) (TimerFunc func, char* name);
+ int (*do_timer) (unsigned int tick);
+ void (*init) (void);
+ void (*final) (void);
+} iTimer_s;
-unsigned long (*get_uptime) (void);
+struct timer_interface *iTimer;
void timer_defaults(void);
diff --git a/src/login/account_sql.c b/src/login/account_sql.c
index 565dd0460..d3a7aafff 100644
--- a/src/login/account_sql.c
+++ b/src/login/account_sql.c
@@ -315,7 +315,7 @@ static bool account_db_sql_set_property(AccountDB* self, const char* key, const
safestrncpy(db->codepage, value, sizeof(db->codepage));
else
if( strcmpi(key, "case_sensitive") == 0 )
- db->case_sensitive = config_switch(value);
+ db->case_sensitive = (bool)config_switch(value);
else
if( strcmpi(key, "account_db") == 0 )
safestrncpy(db->account_db, value, sizeof(db->account_db));
@@ -549,7 +549,7 @@ static bool mmo_auth_fromsql(AccountDB_SQL* db, struct mmo_account* acc, int acc
SQL->GetData(sql_handle, 10, &data, NULL); safestrncpy(acc->lastlogin, data, sizeof(acc->lastlogin));
SQL->GetData(sql_handle, 11, &data, NULL); safestrncpy(acc->last_ip, data, sizeof(acc->last_ip));
SQL->GetData(sql_handle, 12, &data, NULL); safestrncpy(acc->birthdate, data, sizeof(acc->birthdate));
- SQL->GetData(sql_handle, 13, &data, NULL); acc->char_slots = atoi(data);
+ SQL->GetData(sql_handle, 13, &data, NULL); acc->char_slots = (uint8)atoi(data);
SQL->GetData(sql_handle, 14, &data, NULL); safestrncpy(acc->pincode, data, sizeof(acc->pincode));
SQL->GetData(sql_handle, 15, &data, NULL); acc->pincode_change = atol(data);
diff --git a/src/login/ipban_sql.c b/src/login/ipban_sql.c
index 701d3bc1d..fd9f1a4a1 100644
--- a/src/login/ipban_sql.c
+++ b/src/login/ipban_sql.c
@@ -86,8 +86,8 @@ void ipban_init(void)
if( login_config.ipban_cleanup_interval > 0 )
{ // set up periodic cleanup of connection history and active bans
- add_timer_func_list(ipban_cleanup, "ipban_cleanup");
- cleanup_timer_id = add_timer_interval(gettick()+10, ipban_cleanup, 0, 0, login_config.ipban_cleanup_interval*1000);
+ iTimer->add_timer_func_list(ipban_cleanup, "ipban_cleanup");
+ cleanup_timer_id = iTimer->add_timer_interval(iTimer->gettick()+10, ipban_cleanup, 0, 0, login_config.ipban_cleanup_interval*1000);
} else // make sure it gets cleaned up on login-server start regardless of interval-based cleanups
ipban_cleanup(0,0,0,0);
}
@@ -100,7 +100,7 @@ void ipban_final(void)
if( login_config.ipban_cleanup_interval > 0 )
// release data
- delete_timer(cleanup_timer_id, ipban_cleanup);
+ iTimer->delete_timer(cleanup_timer_id, ipban_cleanup);
ipban_cleanup(0,0,0,0); // always clean up on login-server stop
diff --git a/src/login/login.c b/src/login/login.c
index 8dd5ce20a..159d99fee 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -109,7 +109,7 @@ static DBData create_online_user(DBKey key, va_list args)
p->account_id = key.i;
p->char_server = -1;
p->waiting_disconnect = INVALID_TIMER;
- return DB->ptr2data(p);
+ return iDB->ptr2data(p);
}
struct online_login_data* add_online_user(int char_server, int account_id)
@@ -119,7 +119,7 @@ struct online_login_data* add_online_user(int char_server, int account_id)
p->char_server = char_server;
if( p->waiting_disconnect != INVALID_TIMER )
{
- delete_timer(p->waiting_disconnect, waiting_disconnect_timer);
+ iTimer->delete_timer(p->waiting_disconnect, waiting_disconnect_timer);
p->waiting_disconnect = INVALID_TIMER;
}
return p;
@@ -132,7 +132,7 @@ void remove_online_user(int account_id)
if( p == NULL )
return;
if( p->waiting_disconnect != INVALID_TIMER )
- delete_timer(p->waiting_disconnect, waiting_disconnect_timer);
+ iTimer->delete_timer(p->waiting_disconnect, waiting_disconnect_timer);
idb_remove(online_db, account_id);
}
@@ -154,14 +154,14 @@ static int waiting_disconnect_timer(int tid, unsigned int tick, int id, intptr_t
*/
static int online_db_setoffline(DBKey key, DBData *data, va_list ap)
{
- struct online_login_data* p = DB->data2ptr(data);
+ struct online_login_data* p = iDB->data2ptr(data);
int server = va_arg(ap, int);
if( server == -1 )
{
p->char_server = -1;
if( p->waiting_disconnect != INVALID_TIMER )
{
- delete_timer(p->waiting_disconnect, waiting_disconnect_timer);
+ iTimer->delete_timer(p->waiting_disconnect, waiting_disconnect_timer);
p->waiting_disconnect = INVALID_TIMER;
}
}
@@ -175,7 +175,7 @@ static int online_db_setoffline(DBKey key, DBData *data, va_list ap)
*/
static int online_data_cleanup_sub(DBKey key, DBData *data, va_list ap)
{
- struct online_login_data *character= DB->data2ptr(data);
+ struct online_login_data *character= iDB->data2ptr(data);
if (character->char_server == -2) //Unknown server.. set them offline
remove_online_user(character->account_id);
return 0;
@@ -467,7 +467,7 @@ int parse_fromchar(int fd)
{
ShowStatus("set users %s : %d\n", server[id].name, users);
- server[id].users = users;
+ server[id].users = (uint16)users;
}
}
break;
@@ -804,7 +804,7 @@ int parse_fromchar(int fd)
p->char_server = id;
if (p->waiting_disconnect != INVALID_TIMER)
{
- delete_timer(p->waiting_disconnect, waiting_disconnect_timer);
+ iTimer->delete_timer(p->waiting_disconnect, waiting_disconnect_timer);
p->waiting_disconnect = INVALID_TIMER;
}
}
@@ -913,12 +913,12 @@ int parse_fromchar(int fd)
int mmo_auth_new(const char* userid, const char* pass, const char sex, const char* last_ip) {
static int num_regs = 0; // registration counter
static unsigned int new_reg_tick = 0;
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
struct mmo_account acc;
//Account Registration Flood Protection by [Kevin]
if( new_reg_tick == 0 )
- new_reg_tick = gettick();
+ new_reg_tick = iTimer->gettick();
if( DIFF_TICK(tick, new_reg_tick) < 0 && num_regs >= allowed_regs ) {
ShowNotice("Account registration denied (registration limit exceeded)\n");
return 3;
@@ -1083,7 +1083,7 @@ int mmo_auth(struct login_session_data* sd, bool isServer) {
sd->login_id2 = rnd() + 1;
safestrncpy(sd->lastlogin, acc.lastlogin, sizeof(sd->lastlogin));
sd->sex = acc.sex;
- sd->group_id = acc.group_id;
+ sd->group_id = (uint8)acc.group_id;
// update account data
timestamp2string(acc.lastlogin, sizeof(acc.lastlogin), time(NULL), "%Y-%m-%d %H:%M:%S");
@@ -1162,7 +1162,7 @@ void login_auth_ok(struct login_session_data* sd)
WBUFL(buf,2) = sd->account_id;
charif_sendallwos(-1, buf, 6);
if( data->waiting_disconnect == INVALID_TIMER )
- data->waiting_disconnect = add_timer(gettick()+AUTH_TIMEOUT, waiting_disconnect_timer, sd->account_id, 0);
+ data->waiting_disconnect = iTimer->add_timer(iTimer->gettick()+AUTH_TIMEOUT, waiting_disconnect_timer, sd->account_id, 0);
WFIFOHEAD(fd,3);
WFIFOW(fd,0) = 0x81;
@@ -1229,7 +1229,7 @@ void login_auth_ok(struct login_session_data* sd)
data = add_online_user(-1, sd->account_id);
// schedule deletion of this node
- data->waiting_disconnect = add_timer(gettick()+AUTH_TIMEOUT, waiting_disconnect_timer, sd->account_id, 0);
+ data->waiting_disconnect = iTimer->add_timer(iTimer->gettick()+AUTH_TIMEOUT, waiting_disconnect_timer, sd->account_id, 0);
}
}
@@ -1836,7 +1836,7 @@ int do_init(int argc, char** argv)
// Online user database init
online_db = idb_alloc(DB_OPT_RELEASE_DATA);
- add_timer_func_list(waiting_disconnect_timer, "waiting_disconnect_timer");
+ iTimer->add_timer_func_list(waiting_disconnect_timer, "waiting_disconnect_timer");
// Interserver auth init
auth_db = idb_alloc(DB_OPT_RELEASE_DATA);
@@ -1845,13 +1845,13 @@ int do_init(int argc, char** argv)
set_defaultparse(parse_login);
// every 10 minutes cleanup online account db.
- add_timer_func_list(online_data_cleanup, "online_data_cleanup");
- add_timer_interval(gettick() + 600*1000, online_data_cleanup, 0, 0, 600*1000);
+ iTimer->add_timer_func_list(online_data_cleanup, "online_data_cleanup");
+ iTimer->add_timer_interval(iTimer->gettick() + 600*1000, online_data_cleanup, 0, 0, 600*1000);
// add timer to detect ip address change and perform update
if (login_config.ip_sync_interval) {
- add_timer_func_list(sync_ip_addresses, "sync_ip_addresses");
- add_timer_interval(gettick() + login_config.ip_sync_interval, sync_ip_addresses, 0, 0, login_config.ip_sync_interval);
+ iTimer->add_timer_func_list(sync_ip_addresses, "sync_ip_addresses");
+ iTimer->add_timer_interval(iTimer->gettick() + login_config.ip_sync_interval, sync_ip_addresses, 0, 0, login_config.ip_sync_interval);
}
// Account database init
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index d923027dd..f0e5e34d3 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -403,17 +403,17 @@ ACMD(mapmove)
mapindex = mapindex_name2id(map_name);
if (mapindex)
- m = map_mapindex2mapid(mapindex);
+ m = iMap->mapindex2mapid(mapindex);
if (!mapindex) { // m < 0 means on different server! [Kevin]
clif->message(fd, msg_txt(1)); // Map not found.
return false;
}
- if ((x || y) && map_getcell(m, x, y, CELL_CHKNOPASS) && pc_get_group_level(sd) < battle_config.gm_ignore_warpable_area)
- { //This is to prevent the pc_setpos call from printing an error.
+ if ((x || y) && iMap->getcell(m, x, y, CELL_CHKNOPASS) && iPc->get_group_level(sd) < battle_config.gm_ignore_warpable_area)
+ { //This is to prevent the iPc->setpos call from printing an error.
clif->message(fd, msg_txt(2));
- if (!map_search_freecell(NULL, m, &x, &y, 10, 10, 1))
+ if (!iMap->search_freecell(NULL, m, &x, &y, 10, 10, 1))
x = y = 0; //Invalid cell, use random spot.
}
if (map[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
@@ -424,7 +424,7 @@ ACMD(mapmove)
clif->message(fd, msg_txt(248));
return false;
}
- if (pc_setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) {
+ if (iPc->setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) {
clif->message(fd, msg_txt(1)); // Map not found.
return false;
}
@@ -448,10 +448,10 @@ ACMD(where)
return false;
}
- pl_sd = map_nick2sd(atcmd_player_name);
+ pl_sd = iMap->nick2sd(atcmd_player_name);
if (pl_sd == NULL ||
strncmp(pl_sd->status.name, atcmd_player_name, NAME_LENGTH) != 0 ||
- (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && pc_get_group_level(pl_sd) > pc_get_group_level(sd) && !pc_has_permission(sd, PC_PERM_WHO_DISPLAY_AID))
+ (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && iPc->get_group_level(pl_sd) > iPc->get_group_level(sd) && !pc_has_permission(sd, PC_PERM_WHO_DISPLAY_AID))
) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -477,7 +477,7 @@ ACMD(jumpto)
return false;
}
- if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL)
+ if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -501,7 +501,7 @@ ACMD(jumpto)
return false;
}
- pc_setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
+ iPc->setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(4), pl_sd->status.name); // Jumped to %s
clif->message(fd, atcmd_output);
@@ -532,14 +532,14 @@ ACMD(jump)
return false;
}
- if ((x || y) && map_getcell(sd->bl.m, x, y, CELL_CHKNOPASS))
- { //This is to prevent the pc_setpos call from printing an error.
+ if ((x || y) && iMap->getcell(sd->bl.m, x, y, CELL_CHKNOPASS))
+ { //This is to prevent the iPc->setpos call from printing an error.
clif->message(fd, msg_txt(2));
- if (!map_search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1))
+ if (!iMap->search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1))
x = y = 0; //Invalid cell, use random spot.
}
- pc_setpos(sd, sd->mapindex, x, y, CLR_TELEPORT);
+ iPc->setpos(sd, sd->mapindex, x, y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(5), sd->bl.x, sd->bl.y); // Jumped to %d %d
clif->message(fd, atcmd_output);
return true;
@@ -569,7 +569,7 @@ ACMD(who)
nullpo_retr(-1, sd);
if (strstr(command, "map") != NULL) {
- if (sscanf(message, "%15s %23s", map_name, player_name) < 1 || (map_id = map_mapname2mapid(map_name)) < 0)
+ if (sscanf(message, "%15s %23s", map_name, player_name) < 1 || (map_id = iMap->mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
} else {
sscanf(message, "%23s", player_name);
@@ -580,12 +580,12 @@ ACMD(who)
else if (strstr(command, "3") != NULL)
display_type = 3;
- level = pc_get_group_level(sd);
+ level = iPc->get_group_level(sd);
StrBuf->Init(&buf);
iter = mapit_getallusers();
for (pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter)) {
- if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || (pl_sd->sc.option & OPTION_INVISIBLE)) && pc_get_group_level(pl_sd) > level)) { // you can look only lower or same level
+ if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || (pl_sd->sc.option & OPTION_INVISIBLE)) && iPc->get_group_level(pl_sd) > level)) { // you can look only lower or same level
if (stristr(pl_sd->status.name, player_name) == NULL // search with no case sensitive
|| (map_id >= 0 && pl_sd->bl.m != map_id))
continue;
@@ -595,7 +595,7 @@ ACMD(who)
if (pc_get_group_id(pl_sd) > 0) // Player title, if exists
StrBuf->Printf(&buf, msg_txt(344), pc_group_id2name(pc_get_group_id(pl_sd))); // "(%s) "
StrBuf->Printf(&buf, msg_txt(347), pl_sd->status.base_level, pl_sd->status.job_level,
- job_name(pl_sd->status.class_)); // "| Lv:%d/%d | Job: %s"
+ iPc->job_name(pl_sd->status.class_)); // "| Lv:%d/%d | Job: %s"
break;
}
case 3: {
@@ -608,7 +608,7 @@ ACMD(who)
break;
}
default: {
- struct party_data *p = party_search(pl_sd->status.party_id);
+ struct party_data *p = iParty->search(pl_sd->status.party_id);
struct guild *g = pl_sd->guild;
StrBuf->Printf(&buf, msg_txt(343), pl_sd->status.name); // "Name: %s "
@@ -674,12 +674,12 @@ ACMD(whogm)
match_text[j] = TOLOWER(match_text[j]);
count = 0;
- level = pc_get_group_level(sd);
+ level = iPc->get_group_level(sd);
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- pl_level = pc_get_group_level(pl_sd);
+ pl_level = iPc->get_group_level(pl_sd);
if (!pl_level)
continue;
@@ -708,10 +708,10 @@ ACMD(whogm)
sprintf(atcmd_output, msg_txt(915), // BLvl: %d | Job: %s (Lvl: %d)
pl_sd->status.base_level,
- job_name(pl_sd->status.class_), pl_sd->status.job_level);
+ iPc->job_name(pl_sd->status.class_), pl_sd->status.job_level);
clif->message(fd, atcmd_output);
- p = party_search(pl_sd->status.party_id);
+ p = iParty->search(pl_sd->status.party_id);
g = pl_sd->guild;
sprintf(atcmd_output,msg_txt(916), // Party: '%s' | Guild: '%s'
@@ -741,7 +741,7 @@ ACMD(save)
{
nullpo_retr(-1, sd);
- pc_setsavepoint(sd, sd->mapindex, sd->bl.x, sd->bl.y);
+ iPc->setsavepoint(sd, sd->mapindex, sd->bl.x, sd->bl.y);
if (sd->status.pet_id > 0 && sd->pd)
intif_save_petdata(sd->status.account_id, &sd->pd->pet);
@@ -761,7 +761,7 @@ ACMD(load)
nullpo_retr(-1, sd);
- m = map_mapindex2mapid(sd->status.save_point.map);
+ m = iMap->mapindex2mapid(sd->status.save_point.map);
if (m >= 0 && map[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
clif->message(fd, msg_txt(249)); // You are not authorized to warp to your save map.
return false;
@@ -771,7 +771,7 @@ ACMD(load)
return false;
}
- pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
+ iPc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
clif->message(fd, msg_txt(7)); // Warping to save point..
return true;
@@ -885,7 +885,7 @@ ACMD(option)
sd->sc.opt1 = param1;
sd->sc.opt2 = param2;
- pc_setoption(sd, param3);
+ iPc->setoption(sd, param3);
clif->message(fd, msg_txt(9)); // Options changed.
@@ -911,10 +911,10 @@ ACMD(hide)
if( map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.pvp_nocalcrank )
{// register the player for ranking calculations
- sd->pvp_timer = add_timer( gettick() + 200, pc_calc_pvprank_timer, sd->bl.id, 0 );
+ sd->pvp_timer = iTimer->add_timer( iTimer->gettick() + 200, iPc->calc_pvprank_timer, sd->bl.id, 0 );
}
//bugreport:2266
- map_foreachinmovearea(clif->insight, &sd->bl, AREA_SIZE, sd->bl.x, sd->bl.y, BL_ALL, &sd->bl);
+ iMap->foreachinmovearea(clif->insight, &sd->bl, AREA_SIZE, sd->bl.x, sd->bl.y, BL_ALL, &sd->bl);
} else {
sd->sc.option |= OPTION_INVISIBLE;
sd->vd.class_ = INVISIBLE_CLASS;
@@ -925,7 +925,7 @@ ACMD(hide)
if( map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER )
{// unregister the player for ranking
- delete_timer( sd->pvp_timer, pc_calc_pvprank_timer );
+ iTimer->delete_timer( sd->pvp_timer, iPc->calc_pvprank_timer );
sd->pvp_timer = INVALID_TIMER;
}
}
@@ -951,7 +951,7 @@ ACMD(jobchange)
// Normal Jobs
for( i = JOB_NOVICE; i < JOB_MAX_BASIC && !found; i++ ){
- if (strncmpi(message, job_name(i), 16) == 0) {
+ if (strncmpi(message, iPc->job_name(i), 16) == 0) {
job = i;
found = true;
}
@@ -959,7 +959,7 @@ ACMD(jobchange)
// High Jobs, Babys and Third
for( i = JOB_NOVICE_HIGH; i < JOB_MAX && !found; i++ ){
- if (strncmpi(message, job_name(i), 16) == 0) {
+ if (strncmpi(message, iPc->job_name(i), 16) == 0) {
job = i;
found = true;
}
@@ -982,7 +982,7 @@ ACMD(jobchange)
if (pcdb_checkid(job))
{
- if (pc_jobchange(sd, job, upper) == 0)
+ if (iPc->jobchange(sd, job, upper) == 0)
clif->message(fd, msg_txt(12)); // Your job has been changed.
else {
clif->message(fd, msg_txt(155)); // You are unable to change your job.
@@ -1095,7 +1095,7 @@ ACMD(heal)
if ( hp < 0 && sp <= 0 ) {
status_damage(NULL, &sd->bl, -hp, -sp, 0, 0);
- clif->damage(&sd->bl,&sd->bl, gettick(), 0, 0, -hp, 0, 4, 0);
+ clif->damage(&sd->bl,&sd->bl, iTimer->gettick(), 0, 0, -hp, 0, 4, 0);
clif->message(fd, msg_txt(156)); // HP or/and SP modified.
return true;
}
@@ -1106,7 +1106,7 @@ ACMD(heal)
status_heal(&sd->bl, hp, 0, 0);
else {
status_damage(NULL, &sd->bl, -hp, 0, 0, 0);
- clif->damage(&sd->bl,&sd->bl, gettick(), 0, 0, -hp, 0, 4, 0);
+ clif->damage(&sd->bl,&sd->bl, iTimer->gettick(), 0, 0, -hp, 0, 4, 0);
}
}
@@ -1166,7 +1166,7 @@ ACMD(item)
item_tmp.nameid = item_id;
item_tmp.identify = 1;
- if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
+ if ((flag = iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
}
}
@@ -1239,7 +1239,7 @@ ACMD(item2)
item_tmp.card[1] = c2;
item_tmp.card[2] = c3;
item_tmp.card[3] = c4;
- if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
+ if ((flag = iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
}
@@ -1263,7 +1263,7 @@ ACMD(itemreset)
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) {
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_COMMAND);
+ iPc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_COMMAND);
}
}
clif->message(fd, msg_txt(20)); // All of your items have been removed.
@@ -1286,14 +1286,14 @@ ACMD(baselevelup)
}
if (level > 0) {
- if (sd->status.base_level >= pc_maxbaselv(sd)) { // check for max level by Valaris
+ if (sd->status.base_level >= iPc->maxbaselv(sd)) { // check for max level by Valaris
clif->message(fd, msg_txt(47)); // Base level can't go any higher.
return false;
} // End Addition
- if ((unsigned int)level > pc_maxbaselv(sd) || (unsigned int)level > pc_maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
- level = pc_maxbaselv(sd) - sd->status.base_level;
+ if ((unsigned int)level > iPc->maxbaselv(sd) || (unsigned int)level > iPc->maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
+ level = iPc->maxbaselv(sd) - sd->status.base_level;
for (i = 0; i < level; i++)
- status_point += pc_gets_status_point(sd->status.base_level + i);
+ status_point += iPc->gets_status_point(sd->status.base_level + i);
sd->status.status_point += status_point;
sd->status.base_level += (unsigned int)level;
@@ -1309,9 +1309,9 @@ ACMD(baselevelup)
if ((unsigned int)level >= sd->status.base_level)
level = sd->status.base_level-1;
for (i = 0; i > -level; i--)
- status_point += pc_gets_status_point(sd->status.base_level + i - 1);
+ status_point += iPc->gets_status_point(sd->status.base_level + i - 1);
if (sd->status.status_point < status_point)
- pc_resetstate(sd);
+ iPc->resetstate(sd);
if (sd->status.status_point < status_point)
sd->status.status_point = 0;
else
@@ -1325,9 +1325,9 @@ ACMD(baselevelup)
clif->updatestatus(sd, SP_BASEEXP);
clif->updatestatus(sd, SP_NEXTBASEEXP);
status_calc_pc(sd, 0);
- pc_baselevelchanged(sd);
+ iPc->baselevelchanged(sd);
if(sd->status.party_id)
- party_send_levelup(sd);
+ iParty->send_levelup(sd);
return true;
}
@@ -1346,12 +1346,12 @@ ACMD(joblevelup)
return false;
}
if (level > 0) {
- if (sd->status.job_level >= pc_maxjoblv(sd)) {
+ if (sd->status.job_level >= iPc->maxjoblv(sd)) {
clif->message(fd, msg_txt(23)); // Job level can't go any higher.
return false;
}
- if ((unsigned int)level > pc_maxjoblv(sd) || (unsigned int)level > pc_maxjoblv(sd) - sd->status.job_level) // fix positiv overflow
- level = pc_maxjoblv(sd) - sd->status.job_level;
+ if ((unsigned int)level > iPc->maxjoblv(sd) || (unsigned int)level > iPc->maxjoblv(sd) - sd->status.job_level) // fix positiv overflow
+ level = iPc->maxjoblv(sd) - sd->status.job_level;
sd->status.job_level += (unsigned int)level;
sd->status.skill_point += level;
clif->misceffect(&sd->bl, 1);
@@ -1366,7 +1366,7 @@ ACMD(joblevelup)
level = sd->status.job_level-1;
sd->status.job_level -= (unsigned int)level;
if (sd->status.skill_point < level)
- pc_resetskill(sd,0); //Reset skills since we need to substract more points.
+ iPc->resetskill(sd,0); //Reset skills since we need to substract more points.
if (sd->status.skill_point < level)
sd->status.skill_point = 0;
else
@@ -1469,7 +1469,7 @@ static int atcommand_pvpoff_sub(struct block_list *bl,va_list ap)
TBL_PC* sd = (TBL_PC*)bl;
clif->pvpset(sd, 0, 0, 2);
if (sd->pvp_timer != INVALID_TIMER) {
- delete_timer(sd->pvp_timer, pc_calc_pvprank_timer);
+ iTimer->delete_timer(sd->pvp_timer, iPc->calc_pvprank_timer);
sd->pvp_timer = INVALID_TIMER;
}
return 0;
@@ -1484,15 +1484,15 @@ ACMD(pvpoff)
return false;
}
- map_zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
+ iMap->zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
map[sd->bl.m].flag.pvp = 0;
if (!battle_config.pk_mode) {
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
}
- map_foreachinmap(atcommand_pvpoff_sub,sd->bl.m, BL_PC);
- map_foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
+ iMap->foreachinmap(atcommand_pvpoff_sub,sd->bl.m, BL_PC);
+ iMap->foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
clif->message(fd, msg_txt(31)); // PvP: Off.
return true;
}
@@ -1504,7 +1504,7 @@ static int atcommand_pvpon_sub(struct block_list *bl,va_list ap)
{
TBL_PC* sd = (TBL_PC*)bl;
if (sd->pvp_timer == INVALID_TIMER) {
- sd->pvp_timer = add_timer(gettick() + 200, pc_calc_pvprank_timer, sd->bl.id, 0);
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick() + 200, iPc->calc_pvprank_timer, sd->bl.id, 0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
sd->pvp_point = 5;
@@ -1523,13 +1523,13 @@ ACMD(pvpon)
return false;
}
- map_zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
+ iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
map[sd->bl.m].flag.pvp = 1;
if (!battle_config.pk_mode) {// display pvp circle and rank
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_FREEPVPZONE);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
- map_foreachinmap(atcommand_pvpon_sub,sd->bl.m, BL_PC);
+ iMap->foreachinmap(atcommand_pvpon_sub,sd->bl.m, BL_PC);
}
clif->message(fd, msg_txt(32)); // PvP: On.
@@ -1549,11 +1549,11 @@ ACMD(gvgoff)
return false;
}
- map_zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
+ iMap->zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
map[sd->bl.m].flag.gvg = 0;
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
- map_foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
+ iMap->foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0);
clif->message(fd, msg_txt(33)); // GvG: Off.
return true;
@@ -1571,7 +1571,7 @@ ACMD(gvgon)
return false;
}
- map_zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
+ iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
map[sd->bl.m].flag.gvg = 1;
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_AGITZONE);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
@@ -1600,9 +1600,9 @@ ACMD(model)
if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE &&
hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR &&
cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) {
- pc_changelook(sd, LOOK_HAIR, hair_style);
- pc_changelook(sd, LOOK_HAIR_COLOR, hair_color);
- pc_changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
+ iPc->changelook(sd, LOOK_HAIR, hair_style);
+ iPc->changelook(sd, LOOK_HAIR_COLOR, hair_color);
+ iPc->changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1629,7 +1629,7 @@ ACMD(dye)
}
if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) {
- pc_changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
+ iPc->changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1656,7 +1656,7 @@ ACMD(hair_style)
}
if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE) {
- pc_changelook(sd, LOOK_HAIR, hair_style);
+ iPc->changelook(sd, LOOK_HAIR, hair_style);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1683,7 +1683,7 @@ ACMD(hair_color)
}
if (hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR) {
- pc_changelook(sd, LOOK_HAIR_COLOR, hair_color);
+ iPc->changelook(sd, LOOK_HAIR_COLOR, hair_color);
clif->message(fd, msg_txt(36)); // Appearence changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
@@ -1864,7 +1864,7 @@ ACMD(go)
if (town >= 0 && town < ARRAYLENGTH(data))
{
- m = map_mapname2mapid(data[town].map);
+ m = iMap->mapname2mapid(data[town].map);
if (m >= 0 && map[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
clif->message(fd, msg_txt(247));
return false;
@@ -1873,7 +1873,7 @@ ACMD(go)
clif->message(fd, msg_txt(248));
return false;
}
- if (pc_setpos(sd, mapindex_name2id(data[town].map), data[town].x, data[town].y, CLR_TELEPORT) == 0) {
+ if (iPc->setpos(sd, mapindex_name2id(data[town].map), data[town].x, data[town].y, CLR_TELEPORT) == 0) {
clif->message(fd, msg_txt(0)); // Warped.
} else {
clif->message(fd, msg_txt(1)); // Map not found.
@@ -1964,7 +1964,7 @@ ACMD(monster)
count = 0;
range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around)
for (i = 0; i < number; i++) {
- map_search_freecell(&sd->bl, 0, &mx, &my, range, range, 0);
+ iMap->search_freecell(&sd->bl, 0, &mx, &my, range, range, 0);
k = mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, eventname, size, AI_NONE);
count += (k != 0) ? 1 : 0;
}
@@ -2016,13 +2016,13 @@ ACMD(killmonster)
if (!message || !*message || sscanf(message, "%15s", map_name) < 1)
map_id = sd->bl.m;
else {
- if ((map_id = map_mapname2mapid(map_name)) < 0)
+ if ((map_id = iMap->mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
}
drop_flag = strcmp(command+1, "killmonster2");
- map_foreachinmap(atkillmonster_sub, map_id, BL_MOB, -drop_flag);
+ iMap->foreachinmap(atkillmonster_sub, map_id, BL_MOB, -drop_flag);
clif->message(fd, msg_txt(165)); // All monsters killed!
@@ -2085,11 +2085,11 @@ ACMD(refine)
if (sd->status.inventory[i].refine != final_refine) {
sd->status.inventory[i].refine = final_refine;
current_position = sd->status.inventory[i].equip;
- pc_unequipitem(sd, i, 3);
+ iPc->unequipitem(sd, i, 3);
clif->refine(fd, 0, i, sd->status.inventory[i].refine);
clif->delitem(sd, i, 1, 3);
clif->additem(sd, i, 1, 0);
- pc_equipitem(sd, i, current_position);
+ iPc->equipitem(sd, i, current_position);
clif->misceffect(&sd->bl, 3);
count++;
}
@@ -2155,7 +2155,7 @@ ACMD(produce)
clif->produce_effect(sd, 0, item_id);
clif->misceffect(&sd->bl, 3);
- if ((flag = pc_additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
+ if ((flag = iPc->additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
} else {
sprintf(atcmd_output, msg_txt(169), item_id, item_data->name); // The item (%d: '%s') is not equipable.
@@ -2198,7 +2198,7 @@ ACMD(memo)
return false;
}
- pc_memo(sd, position);
+ iPc->memo(sd, position);
return true;
}
@@ -2215,11 +2215,11 @@ ACMD(gat)
for (y = 2; y >= -2; y--) {
sprintf(atcmd_output, "%s (x= %d, y= %d) %02X %02X %02X %02X %02X",
map[sd->bl.m].name, sd->bl.x - 2, sd->bl.y + y,
- map_getcell(sd->bl.m, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE),
- map_getcell(sd->bl.m, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE),
- map_getcell(sd->bl.m, sd->bl.x, sd->bl.y + y, CELL_GETTYPE),
- map_getcell(sd->bl.m, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE),
- map_getcell(sd->bl.m, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE));
+ iMap->getcell(sd->bl.m, sd->bl.x - 2, sd->bl.y + y, CELL_GETTYPE),
+ iMap->getcell(sd->bl.m, sd->bl.x - 1, sd->bl.y + y, CELL_GETTYPE),
+ iMap->getcell(sd->bl.m, sd->bl.x, sd->bl.y + y, CELL_GETTYPE),
+ iMap->getcell(sd->bl.m, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE),
+ iMap->getcell(sd->bl.m, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE));
clif->message(fd, atcmd_output);
}
@@ -2361,12 +2361,12 @@ ACMD(zeny)
}
if(zeny > 0){
- if((ret=pc_getzeny(sd,zeny,LOG_TYPE_COMMAND,NULL)) == 1)
+ if((ret=iPc->getzeny(sd,zeny,LOG_TYPE_COMMAND,NULL)) == 1)
clif->message(fd, msg_txt(149)); // Unable to increase the number/value.
}
else {
if( sd->status.zeny < -zeny ) zeny = -sd->status.zeny;
- if((ret=pc_payzeny(sd,-zeny,LOG_TYPE_COMMAND,NULL)) == 1)
+ if((ret=iPc->payzeny(sd,-zeny,LOG_TYPE_COMMAND,NULL)) == 1)
clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
}
if(!ret) clif->message(fd, msg_txt(176)); //ret=0 mean cmd success
@@ -2701,13 +2701,13 @@ ACMD(recall) {
return false;
}
- if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL)
+ if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
+ if ( iPc->get_group_level(sd) < iPc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level doesn't authorize you to preform this action on the specified player.
return false;
@@ -2724,7 +2724,7 @@ ACMD(recall) {
if (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y) {
return false;
}
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ iPc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
sprintf(atcmd_output, msg_txt(46), pl_sd->status.name); // %s recalled!
clif->message(fd, atcmd_output);
@@ -2838,7 +2838,7 @@ ACMD(char_ban)
tmtime->tm_min = tmtime->tm_min + minute;
tmtime->tm_sec = tmtime->tm_sec + second;
timestamp = mktime(tmtime);
- if( timestamp <= time(NULL) && !pc_can_use_command(sd, "@unban") ) {
+ if( timestamp <= time(NULL) && !iPc->can_use_command(sd, "@unban") ) {
clif->message(fd,msg_txt(1023)); // You are not allowed to reduce the length of a ban.
return false;
}
@@ -2898,8 +2898,8 @@ ACMD(night)
{
nullpo_retr(-1, sd);
- if (night_flag != 1) {
- map_night_timer(night_timer_tid, 0, 0, 1);
+ if (iMap->night_flag != 1) {
+ iPc->map_night_timer(iPc->night_timer_tid, 0, 0, 1);
} else {
clif->message(fd, msg_txt(89)); // Night mode is already enabled.
return false;
@@ -2915,8 +2915,8 @@ ACMD(day)
{
nullpo_retr(-1, sd);
- if (night_flag != 0) {
- map_day_timer(day_timer_tid, 0, 0, 1);
+ if (iMap->night_flag != 0) {
+ iPc->map_day_timer(iPc->day_timer_tid, 0, 0, 1);
} else {
clif->message(fd, msg_txt(90)); // Day mode is already enabled.
return false;
@@ -2938,7 +2938,7 @@ ACMD(doom)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (pl_sd->fd != fd && pc_get_group_level(sd) >= pc_get_group_level(pl_sd))
+ if (pl_sd->fd != fd && iPc->get_group_level(sd) >= iPc->get_group_level(pl_sd))
{
status_kill(&pl_sd->bl);
clif->specialeffect(&pl_sd->bl,450,AREA);
@@ -2965,7 +2965,7 @@ ACMD(doommap)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (pl_sd->fd != fd && sd->bl.m == pl_sd->bl.m && pc_get_group_level(sd) >= pc_get_group_level(pl_sd))
+ if (pl_sd->fd != fd && sd->bl.m == pl_sd->bl.m && iPc->get_group_level(sd) >= iPc->get_group_level(pl_sd))
{
status_kill(&pl_sd->bl);
clif->specialeffect(&pl_sd->bl,450,AREA);
@@ -3047,13 +3047,13 @@ ACMD(kick)
return false;
}
- if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL)
+ if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
+ if ( iPc->get_group_level(sd) < iPc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -3076,7 +3076,7 @@ ACMD(kickall)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // you can kick only lower or same gm level
+ if (iPc->get_group_level(sd) >= iPc->get_group_level(pl_sd)) { // you can kick only lower or same gm level
if (sd->status.account_id != pl_sd->status.account_id)
clif->GM_kick(NULL, pl_sd);
}
@@ -3094,7 +3094,7 @@ ACMD(kickall)
ACMD(allskill)
{
nullpo_retr(-1, sd);
- pc_allskillup(sd); // all skills
+ iPc->allskillup(sd); // all skills
sd->status.skill_point = 0; // 0 skill points
clif->updatestatus(sd, SP_SKILLPOINT); // update
clif->message(fd, msg_txt(76)); // All skills have been added to your skill tree.
@@ -3134,12 +3134,12 @@ ACMD(questskill)
clif->message(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill.
return false;
}
- if (pc_checkskill2(sd, index) > 0) {
+ if (iPc->checkskill2(sd, index) > 0) {
clif->message(fd, msg_txt(196)); // You already have this quest skill.
return false;
}
- pc_skill(sd, skill_id, 1, 0);
+ iPc->skill(sd, skill_id, 1, 0);
clif->message(fd, msg_txt(70)); // You have learned the skill.
return true;
@@ -3177,7 +3177,7 @@ ACMD(lostskill)
clif->message(fd, msg_txt(197)); // This skill number doesn't exist or isn't a quest skill.
return false;
}
- if (pc_checkskill2(sd, index) == 0) {
+ if (iPc->checkskill2(sd, index) == 0) {
clif->message(fd, msg_txt(201)); // You don't have this quest skill.
return false;
}
@@ -3210,7 +3210,7 @@ ACMD(spiritball)
}
if( sd->spiritball > 0 )
- pc_delspiritball(sd, sd->spiritball, 1);
+ iPc->delspiritball(sd, sd->spiritball, 1);
sd->spiritball = number;
clif->spiritball(&sd->bl);
// no message, player can look the difference
@@ -3233,7 +3233,7 @@ ACMD(party)
return false;
}
- party_create(sd, party, 0, 0);
+ iParty->create(sd, party, 0, 0);
return true;
}
@@ -3299,12 +3299,12 @@ ACMD(breakguild)
ACMD(agitstart)
{
nullpo_retr(-1, sd);
- if (agit_flag == 1) {
+ if (iMap->agit_flag == 1) {
clif->message(fd, msg_txt(73)); // War of Emperium is currently in progress.
return false;
}
- agit_flag = 1;
+ iMap->agit_flag = 1;
guild->agit_start();
clif->message(fd, msg_txt(72)); // War of Emperium has been initiated.
@@ -3317,12 +3317,12 @@ ACMD(agitstart)
ACMD(agitstart2)
{
nullpo_retr(-1, sd);
- if (agit2_flag == 1) {
+ if (iMap->agit2_flag == 1) {
clif->message(fd, msg_txt(404)); // "War of Emperium SE is currently in progress."
return false;
}
- agit2_flag = 1;
+ iMap->agit2_flag = 1;
guild->agit2_start();
clif->message(fd, msg_txt(403)); // "War of Emperium SE has been initiated."
@@ -3335,12 +3335,12 @@ ACMD(agitstart2)
ACMD(agitend)
{
nullpo_retr(-1, sd);
- if (agit_flag == 0) {
+ if (iMap->agit_flag == 0) {
clif->message(fd, msg_txt(75)); // War of Emperium is currently not in progress.
return false;
}
- agit_flag = 0;
+ iMap->agit_flag = 0;
guild->agit_end();
clif->message(fd, msg_txt(74)); // War of Emperium has been ended.
@@ -3353,12 +3353,12 @@ ACMD(agitend)
ACMD(agitend2)
{
nullpo_retr(-1, sd);
- if (agit2_flag == 0) {
+ if (iMap->agit2_flag == 0) {
clif->message(fd, msg_txt(406)); // "War of Emperium SE is currently not in progress."
return false;
}
- agit2_flag = 0;
+ iMap->agit2_flag = 0;
guild->agit2_end();
clif->message(fd, msg_txt(405)); // "War of Emperium SE has been ended."
@@ -3372,7 +3372,7 @@ ACMD(mapexit)
{
nullpo_retr(-1, sd);
- do_shutdown();
+ iMap->do_shutdown();
return true;
}
@@ -3433,7 +3433,7 @@ ACMD(recallall)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (sd->status.account_id != pl_sd->status.account_id && pc_get_group_level(sd) >= pc_get_group_level(pl_sd))
+ if (sd->status.account_id != pl_sd->status.account_id && iPc->get_group_level(sd) >= iPc->get_group_level(pl_sd))
{
if (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y)
continue; // Don't waste time warping the character to the same place.
@@ -3441,10 +3441,10 @@ ACMD(recallall)
count++;
else {
if (pc_isdead(pl_sd)) { //Wake them up
- pc_setstand(pl_sd);
- pc_setrestartvalue(pl_sd,1);
+ iPc->setstand(pl_sd);
+ iPc->setrestartvalue(pl_sd,1);
}
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ iPc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
}
@@ -3498,12 +3498,12 @@ ACMD(guildrecall)
{
if (sd->status.account_id != pl_sd->status.account_id && pl_sd->status.guild_id == g->guild_id)
{
- if (pc_get_group_level(pl_sd) > pc_get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
+ if (iPc->get_group_level(pl_sd) > iPc->get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
continue; // Skip GMs greater than you... or chars already on the cell
if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE))
count++;
else
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ iPc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
mapit->free(iter);
@@ -3543,8 +3543,8 @@ ACMD(partyrecall)
return false;
}
- if ((p = party_searchname(party_name)) == NULL && // name first to avoid error when name begin with a number
- (p = party_search(atoi(message))) == NULL)
+ if ((p = iParty->searchname(party_name)) == NULL && // name first to avoid error when name begin with a number
+ (p = iParty->search(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(96)); // Incorrect name or ID, or no one from the party is online.
return false;
@@ -3557,12 +3557,12 @@ ACMD(partyrecall)
{
if (sd->status.account_id != pl_sd->status.account_id && pl_sd->status.party_id == p->party.party_id)
{
- if (pc_get_group_level(pl_sd) > pc_get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
+ if (iPc->get_group_level(pl_sd) > iPc->get_group_level(sd) || (pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y))
continue; // Skip GMs greater than you... or chars already on the cell
if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE))
count++;
else
- pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
+ iPc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
mapit->free(iter);
@@ -3634,7 +3634,7 @@ ACMD(reloadatcommand) {
config_destroy(&run_test);
- if (conf_read_file(&run_test, ATCOMMAND_CONF_FILENAME)) {
+ if (conf_read_file(&run_test, iMap->ATCOMMAND_CONF_FILENAME)) {
clif->message(fd, msg_txt(1037)); // Error reading atcommand.conf, reload failed.
return false;
}
@@ -3654,7 +3654,7 @@ ACMD(reloadbattleconf)
struct Battle_Config prev_config;
memcpy(&prev_config, &battle_config, sizeof(prev_config));
- battle->config_read(BATTLE_CONF_FILENAME);
+ battle->config_read(iMap->BATTLE_CONF_FILENAME);
if( prev_config.item_rate_mvp != battle_config.item_rate_mvp
|| prev_config.item_rate_common != battle_config.item_rate_common
@@ -3708,22 +3708,12 @@ ACMD(reloadstatusdb)
*------------------------------------------*/
ACMD(reloadpcdb)
{
- pc_readdb();
+ iPc->readdb();
clif->message(fd, msg_txt(257));
return true;
}
/*==========================================
- * @reloadmotd - reloads motd.txt
- *------------------------------------------*/
-ACMD(reloadmotd)
-{
- pc_read_motd();
- clif->message(fd, msg_txt(268));
- return true;
-}
-
-/*==========================================
* @reloadscript - reloads all scripts (npcs, warps, mob spawns, ...)
*------------------------------------------*/
ACMD(reloadscript)
@@ -3733,7 +3723,7 @@ ACMD(reloadscript)
//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
flush_fifos();
- map_reloadnpc(true); // reload config files seeking for npcs
+ iMap->reloadnpc(true); // reload config files seeking for npcs
script_reload();
npc_reload();
@@ -3776,9 +3766,9 @@ ACMD(mapinfo) {
if (mapname[0] == '\0') {
safestrncpy(mapname, mapindex_id2name(sd->mapindex), MAP_NAME_LENGTH);
- m_id = map_mapindex2mapid(sd->mapindex);
+ m_id = iMap->mapindex2mapid(sd->mapindex);
} else {
- m_id = map_mapname2mapid(mapname);
+ m_id = iMap->mapname2mapid(mapname);
}
if (m_id < 0) {
@@ -3796,7 +3786,7 @@ ACMD(mapinfo) {
if( pl_sd->mapindex == m_index ) {
if( pl_sd->state.vending )
vend_num++;
- else if( (cd = (struct chat_data*)map_id2bl(pl_sd->chatID)) != NULL && cd->usersd[0] == pl_sd )
+ else if( (cd = (struct chat_data*)iMap->id2bl(pl_sd->chatID)) != NULL && cd->usersd[0] == pl_sd )
chat_num++;
}
}
@@ -3950,7 +3940,7 @@ ACMD(mapinfo) {
for (i = 0; i < map[m_id].npc_num;)
{
nd = map[m_id].npc[i];
- switch(nd->ud.dir) {
+ switch(nd->dir) {
case 0: strcpy(direction, msg_txt(1101)); break; // North
case 1: strcpy(direction, msg_txt(1102)); break; // North West
case 2: strcpy(direction, msg_txt(1103)); break; // West
@@ -3976,7 +3966,7 @@ ACMD(mapinfo) {
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if ((cd = (struct chat_data*)map_id2bl(pl_sd->chatID)) != NULL &&
+ if ((cd = (struct chat_data*)iMap->id2bl(pl_sd->chatID)) != NULL &&
pl_sd->mapindex == m_index &&
cd->usersd[0] == pl_sd)
{
@@ -4011,47 +4001,47 @@ ACMD(mount_peco)
return false;
}
- if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT && pc_checkskill(sd,RK_DRAGONTRAINING) > 0 ) {
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT && iPc->checkskill(sd,RK_DRAGONTRAINING) > 0 ) {
if( !(sd->sc.option&OPTION_DRAGON1) ) {
clif->message(sd->fd,msg_txt(1119)); // You have mounted your Dragon.
- pc_setoption(sd, sd->sc.option|OPTION_DRAGON1);
+ iPc->setoption(sd, sd->sc.option|OPTION_DRAGON1);
} else {
clif->message(sd->fd,msg_txt(1120)); // You have released your Dragon.
- pc_setoption(sd, sd->sc.option&~OPTION_DRAGON1);
+ iPc->setoption(sd, sd->sc.option&~OPTION_DRAGON1);
}
return true;
}
- if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER && pc_checkskill(sd,RA_WUGRIDER) > 0 ) {
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER && iPc->checkskill(sd,RA_WUGRIDER) > 0 ) {
if( !pc_isridingwug(sd) ) {
clif->message(sd->fd,msg_txt(1121)); // You have mounted your Warg.
- pc_setoption(sd, sd->sc.option|OPTION_WUGRIDER);
+ iPc->setoption(sd, sd->sc.option|OPTION_WUGRIDER);
} else {
clif->message(sd->fd,msg_txt(1122)); // You have released your Warg.
- pc_setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
+ iPc->setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
}
return true;
}
if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) {
if( !pc_ismadogear(sd) ) {
clif->message(sd->fd,msg_txt(1123)); // You have mounted your Mado Gear.
- pc_setoption(sd, sd->sc.option|OPTION_MADOGEAR);
+ iPc->setoption(sd, sd->sc.option|OPTION_MADOGEAR);
} else {
clif->message(sd->fd,msg_txt(1124)); // You have released your Mado Gear.
- pc_setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
+ iPc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
}
return true;
}
if (!pc_isriding(sd)) { // if actually no peco
- if (!pc_checkskill(sd, KN_RIDING)) {
+ if (!iPc->checkskill(sd, KN_RIDING)) {
clif->message(fd, msg_txt(213)); // You can not mount a Peco Peco with your current job.
return false;
}
- pc_setoption(sd, sd->sc.option | OPTION_RIDING);
+ iPc->setoption(sd, sd->sc.option | OPTION_RIDING);
clif->message(fd, msg_txt(102)); // You have mounted a Peco Peco.
} else {//Dismount
- pc_setoption(sd, sd->sc.option & ~OPTION_RIDING);
+ iPc->setoption(sd, sd->sc.option & ~OPTION_RIDING);
clif->message(fd, msg_txt(214)); // You have released your Peco Peco.
}
@@ -4070,7 +4060,7 @@ ACMD(guildspy)
memset(guild_name, '\0', sizeof(guild_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
- if (!enable_spy)
+ if (!iMap->enable_spy)
{
clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled.
return false;
@@ -4111,7 +4101,7 @@ ACMD(partyspy)
memset(party_name, '\0', sizeof(party_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
- if (!enable_spy)
+ if (!iMap->enable_spy)
{
clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled.
return false;
@@ -4122,8 +4112,8 @@ ACMD(partyspy)
return false;
}
- if ((p = party_searchname(party_name)) != NULL || // name first to avoid error when name begin with a number
- (p = party_search(atoi(message))) != NULL) {
+ if ((p = iParty->searchname(party_name)) != NULL || // name first to avoid error when name begin with a number
+ (p = iParty->search(atoi(message))) != NULL) {
if (sd->partyspy == p->party.party_id) {
sd->partyspy = 0;
sprintf(atcmd_output, msg_txt(105), p->party.name); // No longer spying on the %s party.
@@ -4185,9 +4175,9 @@ ACMD(nuke)
return false;
}
- if ((pl_sd = map_nick2sd(atcmd_player_name)) != NULL) {
- if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // you can kill only lower or same GM level
- skill->castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, gettick(), 0);
+ if ((pl_sd = iMap->nick2sd(atcmd_player_name)) != NULL) {
+ if (iPc->get_group_level(sd) >= iPc->get_group_level(pl_sd)) { // you can kill only lower or same GM level
+ skill->castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, iTimer->gettick(), 0);
clif->message(fd, msg_txt(109)); // Player has been nuked!
} else {
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
@@ -4219,7 +4209,7 @@ ACMD(tonpc)
}
if ((nd = npc_name2id(npcname)) != NULL) {
- if (pc_setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0)
+ if (iPc->setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0)
clif->message(fd, msg_txt(0)); // Warped.
else
return false;
@@ -4394,31 +4384,31 @@ ACMD(servertime)
clif->message(fd, temp);
if (battle_config.night_duration == 0 && battle_config.day_duration == 0) {
- if (night_flag == 0)
+ if (iMap->night_flag == 0)
clif->message(fd, msg_txt(231)); // Game time: The game is in permanent daylight.
else
clif->message(fd, msg_txt(232)); // Game time: The game is in permanent night.
} else if (battle_config.night_duration == 0)
- if (night_flag == 1) { // we start with night
- timer_data = get_timer(day_timer_tid);
- sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in night for %s.
+ if (iMap->night_flag == 1) { // we start with night
+ timer_data = iTimer->get_timer(iPc->day_timer_tid);
+ sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,iTimer->gettick())/1000)); // Game time: The game is actualy in night for %s.
clif->message(fd, temp);
clif->message(fd, msg_txt(234)); // Game time: After, the game will be in permanent daylight.
} else
clif->message(fd, msg_txt(231)); // Game time: The game is in permanent daylight.
else if (battle_config.day_duration == 0)
- if (night_flag == 0) { // we start with day
- timer_data = get_timer(night_timer_tid);
- sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in daylight for %s.
+ if (iMap->night_flag == 0) { // we start with day
+ timer_data = iTimer->get_timer(iPc->night_timer_tid);
+ sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,iTimer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
clif->message(fd, temp);
clif->message(fd, msg_txt(236)); // Game time: After, the game will be in permanent night.
} else
clif->message(fd, msg_txt(232)); // Game time: The game is in permanent night.
else {
- if (night_flag == 0) {
- timer_data = get_timer(night_timer_tid);
- timer_data2 = get_timer(day_timer_tid);
- sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,gettick())/1000)); // Game time: The game is actualy in daylight for %s.
+ if (iMap->night_flag == 0) {
+ timer_data = iTimer->get_timer(iPc->night_timer_tid);
+ timer_data2 = iTimer->get_timer(iPc->day_timer_tid);
+ sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,iTimer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
clif->message(fd, temp);
if (DIFF_TICK(timer_data->tick, timer_data2->tick) > 0)
sprintf(temp, msg_txt(237), txt_time(DIFF_TICK(timer_data->interval,DIFF_TICK(timer_data->tick,timer_data2->tick)) / 1000)); // Game time: After, the game will be in night for %s.
@@ -4428,9 +4418,9 @@ ACMD(servertime)
sprintf(temp, msg_txt(238), txt_time(timer_data->interval / 1000)); // Game time: A day cycle has a normal duration of %s.
clif->message(fd, temp);
} else {
- timer_data = get_timer(day_timer_tid);
- timer_data2 = get_timer(night_timer_tid);
- sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,gettick()) / 1000)); // Game time: The game is actualy in night for %s.
+ timer_data = iTimer->get_timer(iPc->day_timer_tid);
+ timer_data2 = iTimer->get_timer(iPc->night_timer_tid);
+ sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,iTimer->gettick()) / 1000)); // Game time: The game is actualy in night for %s.
clif->message(fd, temp);
if (DIFF_TICK(timer_data->tick,timer_data2->tick) > 0)
sprintf(temp, msg_txt(239), txt_time((timer_data->interval - DIFF_TICK(timer_data->tick, timer_data2->tick)) / 1000)); // Game time: After, the game will be in daylight for %s.
@@ -4491,12 +4481,12 @@ ACMD(jail)
return false;
}
- if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if (pc_get_group_level(sd) < pc_get_group_level(pl_sd))
+ if (iPc->get_group_level(sd) < iPc->get_group_level(pl_sd))
{ // you can jail only lower or same GM
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -4543,12 +4533,12 @@ ACMD(unjail)
return false;
}
- if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if (pc_get_group_level(sd) < pc_get_group_level(pl_sd)) { // you can jail only lower or same GM
+ if (iPc->get_group_level(sd) < iPc->get_group_level(pl_sd)) { // you can jail only lower or same GM
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -4623,12 +4613,12 @@ ACMD(jailfor)
return false;
}
- if ((pl_sd = map_nick2sd(atcmd_player_name)) == NULL) {
+ if ((pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if (pc_get_group_level(pl_sd) > pc_get_group_level(sd)) {
+ if (iPc->get_group_level(pl_sd) > iPc->get_group_level(sd)) {
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
}
@@ -4748,7 +4738,7 @@ ACMD(disguise)
return false;
}
- pc_disguise(sd, id);
+ iPc->disguise(sd, id);
clif->message(fd, msg_txt(122)); // Disguise applied.
return true;
@@ -4779,7 +4769,7 @@ ACMD(disguiseall)
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
- pc_disguise(pl_sd, mob_id);
+ iPc->disguise(pl_sd, mob_id);
mapit->free(iter);
clif->message(fd, msg_txt(122)); // Disguise applied.
@@ -4827,7 +4817,7 @@ ACMD(disguiseguild)
for( i = 0; i < g->max_member; i++ )
if( (pl_sd = g->member[i].sd) && !pc_isriding(pl_sd) )
- pc_disguise(pl_sd, id);
+ iPc->disguise(pl_sd, id);
clif->message(fd, msg_txt(122)); // Disguise applied.
return true;
@@ -4841,7 +4831,7 @@ ACMD(undisguise)
{
nullpo_retr(-1, sd);
if (sd->disguise != -1) {
- pc_disguise(sd, -1);
+ iPc->disguise(sd, -1);
clif->message(fd, msg_txt(124)); // Undisguise applied.
} else {
clif->message(fd, msg_txt(125)); // You're not disguised.
@@ -4862,7 +4852,7 @@ ACMD(undisguiseall) {
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
if( pl_sd->disguise != -1 )
- pc_disguise(pl_sd, -1);
+ iPc->disguise(pl_sd, -1);
mapit->free(iter);
clif->message(fd, msg_txt(124)); // Undisguise applied.
@@ -4895,7 +4885,7 @@ ACMD(undisguiseguild)
for(i = 0; i < g->max_member; i++)
if( (pl_sd = g->member[i].sd) && pl_sd->disguise != -1 )
- pc_disguise(pl_sd, -1);
+ iPc->disguise(pl_sd, -1);
clif->message(fd, msg_txt(124)); // Undisguise applied.
@@ -4912,11 +4902,11 @@ ACMD(exp)
nullpo_retr(-1, sd);
memset(output, '\0', sizeof(output));
- nextb = pc_nextbaseexp(sd);
+ nextb = iPc->nextbaseexp(sd);
if (nextb)
nextb = sd->status.base_exp*100.0/nextb;
- nextj = pc_nextjobexp(sd);
+ nextj = iPc->nextjobexp(sd);
if (nextj)
nextj = sd->status.job_exp*100.0/nextj;
@@ -5052,7 +5042,7 @@ ACMD(killable)
clif->message(fd, msg_txt(242));
else {
clif->message(fd, msg_txt(288));
- map_foreachinrange(atcommand_stopattack,&sd->bl, AREA_SIZE, BL_CHAR, sd->bl.id);
+ iMap->foreachinrange(atcommand_stopattack,&sd->bl, AREA_SIZE, BL_CHAR, sd->bl.id);
}
return true;
}
@@ -5111,9 +5101,9 @@ ACMD(npcmove)
x = cap_value(x, 0, map[m].xs-1);
y = cap_value(y, 0, map[m].ys-1);
- map_foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
- map_moveblock(&nd->bl, x, y, gettick());
- map_foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
+ iMap->foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
+ iMap->moveblock(&nd->bl, x, y, iTimer->gettick());
+ iMap->foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
clif->message(fd, msg_txt(1155)); // NPC moved.
return true;
@@ -5168,22 +5158,22 @@ ACMD(follow)
if (sd->followtarget == -1)
return false;
- pc_stop_following (sd);
+ iPc->stop_following (sd);
clif->message(fd, msg_txt(1159)); // Follow mode OFF.
return true;
}
- if ( (pl_sd = map_nick2sd((char *)message)) == NULL )
+ if ( (pl_sd = iMap->nick2sd((char *)message)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
if (sd->followtarget == pl_sd->bl.id) {
- pc_stop_following (sd);
+ iPc->stop_following (sd);
clif->message(fd, msg_txt(1159)); // Follow mode OFF.
} else {
- pc_follow(sd, pl_sd->bl.id);
+ iPc->follow(sd, pl_sd->bl.id);
clif->message(fd, msg_txt(1160)); // Follow mode ON.
}
@@ -5202,8 +5192,8 @@ ACMD(dropall)
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
if(sd->status.inventory[i].equip != 0)
- pc_unequipitem(sd, i, 3);
- pc_dropitem(sd, i, sd->status.inventory[i].amount);
+ iPc->unequipitem(sd, i, 3);
+ iPc->dropitem(sd, i, sd->status.inventory[i].amount);
}
}
return true;
@@ -5229,7 +5219,7 @@ ACMD(storeall)
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
if(sd->status.inventory[i].equip != 0)
- pc_unequipitem(sd, i, 3);
+ iPc->unequipitem(sd, i, 3);
storage_storageadd(sd, i, sd->status.inventory[i].amount);
}
}
@@ -5316,7 +5306,7 @@ ACMD(clearcart)
for( i = 0; i < MAX_CART; i++ )
if(sd->status.cart[i].nameid > 0)
- pc_cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_OTHER);
+ iPc->cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_OTHER);
clif->clearcart(fd);
clif->updatestatus(sd,SP_CARTINFO);
@@ -5350,12 +5340,12 @@ ACMD(skillid) {
iter = db_iterator(skilldb_name2id);
for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) {
- idx = skill->get_index(DB->data2i(data));
+ idx = skill->get_index(iDB->data2i(data));
if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill_db[idx].desc, message, skillen) == 0) {
- sprintf(atcmd_output, msg_txt(1164), DB->data2i(data), skill_db[idx].desc, key.str); // skill %d: %s (%s)
+ sprintf(atcmd_output, msg_txt(1164), iDB->data2i(data), skill_db[idx].desc, key.str); // skill %d: %s (%s)
clif->message(fd, atcmd_output);
} else if ( found < MAX_SKILLID_PARTIAL_RESULTS && ( stristr(key.str,message) || stristr(skill_db[idx].desc,message) ) ) {
- snprintf(partials[found++], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_txt(1164), DB->data2i(data), skill_db[idx].desc, key.str);
+ snprintf(partials[found++], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_txt(1164), iDB->data2i(data), skill_db[idx].desc, key.str);
}
}
@@ -5392,12 +5382,12 @@ ACMD(useskill)
}
if(!strcmp(target,"self")) pl_sd = sd; //quick keyword
- else if ( (pl_sd = map_nick2sd(target)) == NULL ){
+ else if ( (pl_sd = iMap->nick2sd(target)) == NULL ){
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
+ if ( iPc->get_group_level(sd) < iPc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -5436,7 +5426,7 @@ ACMD(displayskill)
return false;
}
status = status_get_status_data(&sd->bl);
- tick = gettick();
+ tick = iTimer->gettick();
clif->skill_damage(&sd->bl,&sd->bl, tick, status->amotion, status->dmotion, 1, 1, skill_id, skill_lv, 5);
clif->skill_nodamage(&sd->bl, &sd->bl, skill_id, skill_lv, 1);
clif->skill_poseffect(&sd->bl, skill_id, skill_lv, sd->bl.x, sd->bl.y, tick);
@@ -5461,16 +5451,16 @@ ACMD(skilltree)
return false;
}
- if ( (pl_sd = map_nick2sd(target)) == NULL )
+ if ( (pl_sd = iMap->nick2sd(target)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- c = pc_calc_skilltree_normalize_job(pl_sd);
- c = pc_mapid2jobid(c, pl_sd->status.sex);
+ c = iPc->calc_skilltree_normalize_job(pl_sd);
+ c = iPc->mapid2jobid(c, pl_sd->status.sex);
- sprintf(atcmd_output, msg_txt(1168), job_name(c), pc_checkskill(pl_sd, NV_BASIC)); // Player is using %s skill tree (%d basic points).
+ sprintf(atcmd_output, msg_txt(1168), iPc->job_name(c), iPc->checkskill(pl_sd, NV_BASIC)); // Player is using %s skill tree (%d basic points).
clif->message(fd, atcmd_output);
ARR_FIND( 0, MAX_SKILL_TREE, j, skill_tree[c][j].id == 0 || skill_tree[c][j].id == skill_id );
@@ -5485,7 +5475,7 @@ ACMD(skilltree)
meets = 1;
for(j=0;j<MAX_PC_SKILL_REQUIRE;j++)
{
- if( ent->need[j].id && pc_checkskill(sd,ent->need[j].id) < ent->need[j].lv)
+ if( ent->need[j].id && iPc->checkskill(sd,ent->need[j].id) < ent->need[j].lv)
{
sprintf(atcmd_output, msg_txt(1170), ent->need[j].lv, skill_db[ent->need[j].id].desc); // Player requires level %d of skill %s.
clif->message(fd, atcmd_output);
@@ -5513,9 +5503,9 @@ void getring (struct map_session_data* sd)
item_tmp.card[2] = sd->status.partner_id;
item_tmp.card[3] = sd->status.partner_id >> 16;
- if((flag = pc_additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) {
+ if((flag = iPc->additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) {
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
@@ -5535,12 +5525,12 @@ ACMD(marry)
return false;
}
- if ((pl_sd = map_nick2sd(player_name)) == NULL) {
+ if ((pl_sd = iMap->nick2sd(player_name)) == NULL) {
clif->message(fd, msg_txt(3));
return false;
}
- if (pc_marriage(sd, pl_sd) == 0) {
+ if (iPc->marriage(sd, pl_sd) == 0) {
clif->message(fd, msg_txt(1173)); // They are married... wish them well.
clif->wedding_effect(&pl_sd->bl); //wedding effect and music [Lupus]
getring(sd); // Auto-give named rings (Aru)
@@ -5560,7 +5550,7 @@ ACMD(divorce)
{
nullpo_retr(-1, sd);
- if (pc_divorce(sd) != 0) {
+ if (iPc->divorce(sd) != 0) {
sprintf(atcmd_output, msg_txt(1175), sd->status.name); // '%s' is not married.
clif->message(fd, atcmd_output);
return false;
@@ -5657,7 +5647,7 @@ ACMD(changegm)
return false;
}
- if((pl_sd=map_nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
+ if((pl_sd=iMap->nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
clif->message(fd, msg_txt(1184)); // Target character must be online and be a guild member.
return false;
}
@@ -5680,7 +5670,7 @@ ACMD(changeleader)
return false;
}
- if (party_changeleader(sd, map_nick2sd((char *) message)))
+ if (iParty->changeleader(sd, iMap->nick2sd((char *) message)))
return true;
return false;
}
@@ -5696,7 +5686,7 @@ ACMD(partyoption)
char w1[16], w2[16];
nullpo_retr(-1, sd);
- if (sd->status.party_id == 0 || (p = party_search(sd->status.party_id)) == NULL)
+ if (sd->status.party_id == 0 || (p = iParty->search(sd->status.party_id)) == NULL)
{
clif->message(fd, msg_txt(282));
return false;
@@ -5722,7 +5712,7 @@ ACMD(partyoption)
//Change item share type.
if (option != p->party.item)
- party_changeoption(sd, p->party.exp, option);
+ iParty->changeoption(sd, p->party.exp, option);
else
clif->message(fd, msg_txt(286));
@@ -6116,14 +6106,14 @@ ACMD(mobsearch)
static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap)
{
nullpo_ret(bl);
- map_clearflooritem(bl);
+ iMap->clearflooritem(bl);
return 0;
}
ACMD(cleanmap)
{
- map_foreachinmap(atcommand_cleanfloor_sub, sd->bl.m, BL_ITEM);
+ iMap->foreachinmap(atcommand_cleanfloor_sub, sd->bl.m, BL_ITEM);
clif->message(fd, msg_txt(1221)); // All dropped items have been cleaned up.
return true;
}
@@ -6133,13 +6123,13 @@ ACMD(cleanarea)
int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
if (!message || !*message || sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) < 1) {
- map_foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - (AREA_SIZE * 2), sd->bl.y - (AREA_SIZE * 2), sd->bl.x + (AREA_SIZE * 2), sd->bl.y + (AREA_SIZE * 2), BL_ITEM);
+ iMap->foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - (AREA_SIZE * 2), sd->bl.y - (AREA_SIZE * 2), sd->bl.x + (AREA_SIZE * 2), sd->bl.y + (AREA_SIZE * 2), BL_ITEM);
}
else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 1) {
- map_foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - x0, sd->bl.y - x0, sd->bl.x + x0, sd->bl.y + x0, BL_ITEM);
+ iMap->foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, sd->bl.x - x0, sd->bl.y - x0, sd->bl.x + x0, sd->bl.y + x0, BL_ITEM);
}
else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 4) {
- map_foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, x0, y0, x1, y1, BL_ITEM);
+ iMap->foreachinarea(atcommand_cleanfloor_sub, sd->bl.m, x0, y0, x1, y1, BL_ITEM);
}
clif->message(fd, msg_txt(1221)); // All dropped items have been cleaned up.
@@ -6197,9 +6187,9 @@ ACMD(pettalk)
nullpo_retr(-1, sd);
if ( battle_config.min_chat_delay ) {
- if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 )
+ if( DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0 )
return true;
- sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay;
}
if(!sd->status.pet_id || !(pd=sd->pd))
@@ -6304,8 +6294,8 @@ ACMD(users)
*------------------------------------------*/
ACMD(reset)
{
- pc_resetstate(sd);
- pc_resetskill(sd,1);
+ iPc->resetstate(sd);
+ iPc->resetskill(sd,1);
sprintf(atcmd_output, msg_txt(208), sd->status.name); // '%s' skill and stats points reseted!
clif->message(fd, atcmd_output);
return true;
@@ -6320,7 +6310,7 @@ ACMD(summon)
int mob_id = 0;
int duration = 0;
struct mob_data *md;
- unsigned int tick=gettick();
+ unsigned int tick=iTimer->gettick();
nullpo_retr(-1, sd);
@@ -6350,7 +6340,7 @@ ACMD(summon)
md->master_id=sd->bl.id;
md->special_state.ai=1;
- md->deletetimer=add_timer(tick+(duration*60000),mob_timer_delete,md->bl.id,0);
+ md->deletetimer=iTimer->add_timer(tick+(duration*60000),mob_timer_delete,md->bl.id,0);
clif->specialeffect(&md->bl,344,AREA);
mob_spawn(md);
sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000);
@@ -6401,7 +6391,7 @@ ACMD(trade)
return false;
}
- if ( (pl_sd = map_nick2sd((char *)message)) == NULL )
+ if ( (pl_sd = iMap->nick2sd((char *)message)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -6448,7 +6438,7 @@ ACMD(unmute)
return false;
}
- if ( (pl_sd = map_nick2sd((char *)message)) == NULL )
+ if ( (pl_sd = iMap->nick2sd((char *)message)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -6475,7 +6465,7 @@ ACMD(uptime)
minute = 60, days = 0, hours = 0, minutes = 0;
nullpo_retr(-1, sd);
- seconds = get_uptime();
+ seconds = iTimer->get_uptime();
days = seconds/day;
seconds -= (seconds/day>0)?(seconds/day)*day:0;
hours = seconds/hour;
@@ -6497,10 +6487,10 @@ ACMD(changesex)
{
int i;
nullpo_retr(-1, sd);
- pc_resetskill(sd,4);
+ iPc->resetskill(sd,4);
// to avoid any problem with equipment and invalid sex, equipment is unequiped.
for( i=0; i<EQI_MAX; i++ )
- if( sd->equip_index[i] >= 0 ) pc_unequipitem(sd, sd->equip_index[i], 3);
+ if( sd->equip_index[i] >= 0 ) iPc->unequipitem(sd, sd->equip_index[i], 3);
chrif_changesex(sd);
return true;
}
@@ -6519,13 +6509,13 @@ ACMD(mute)
return false;
}
- if ( (pl_sd = map_nick2sd(atcmd_player_name)) == NULL )
+ if ( (pl_sd = iMap->nick2sd(atcmd_player_name)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
- if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
+ if ( iPc->get_group_level(sd) < iPc->get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
return false;
@@ -6593,47 +6583,7 @@ ACMD(identify)
return true;
}
-/*==========================================
- * @gmotd (Global MOTD)
- * by davidsiaw :P
- *------------------------------------------*/
-ACMD(gmotd)
-{
- FILE* fp;
-
- if( ( fp = fopen(motd_txt, "r") ) != NULL )
- {
- char buf[CHAT_SIZE_MAX];
- size_t len;
-
- while( fgets(buf, sizeof(buf), fp) )
- {
- if( buf[0] == '/' && buf[1] == '/' )
- {
- continue;
- }
-
- len = strlen(buf);
-
- while( len && ( buf[len-1] == '\r' || buf[len-1] == '\n' ) )
- {// strip trailing EOL characters
- len--;
- }
-
- if( len )
- {
- buf[len] = 0;
-
- intif_broadcast(buf, len+1, 0);
- }
- }
- fclose(fp);
- }
- return true;
-}
-
-ACMD(misceffect)
-{
+ACMD(misceffect) {
int effect = 0;
nullpo_retr(-1, sd);
if (!message || !*message)
@@ -7003,9 +6953,9 @@ ACMD(homtalk)
nullpo_retr(-1, sd);
if ( battle_config.min_chat_delay ) {
- if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 )
+ if( DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0 )
return true;
- sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay;
}
if (sd->sc.count && //no "chatting" while muted.
@@ -7284,7 +7234,7 @@ ACMD(whereis)
for (i = 0; i < ARRAYLENGTH(mob->spawn) && mob->spawn[i].qty; i++)
{
- j = map_mapindex2mapid(mob->spawn[i].mapindex);
+ j = iMap->mapindex2mapid(mob->spawn[i].mapindex);
if (j < 0) continue;
snprintf(atcmd_output, sizeof atcmd_output, "%s (%d)", map[j].name, mob->spawn[i].qty);
clif->message(fd, atcmd_output);
@@ -7326,7 +7276,7 @@ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
id = va_arg(ap, int);
time = va_arg(ap, int);
- if (id != bl->id && !pc_get_group_level(pl_sd)) {
+ if (id != bl->id && !iPc->get_group_level(pl_sd)) {
pl_sd->status.manner -= time;
if (pl_sd->status.manner < 0)
sc_start(&pl_sd->bl,SC_NOCHAT,100,0,0);
@@ -7348,7 +7298,7 @@ ACMD(mutearea)
time = atoi(message);
- map_foreachinarea(atcommand_mutearea_sub,sd->bl.m,
+ iMap->foreachinarea(atcommand_mutearea_sub,sd->bl.m,
sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE,
sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd->bl.id, time);
@@ -7421,7 +7371,7 @@ ACMD(size)
if(sd->state.size) {
sd->state.size = SZ_SMALL;
- pc_setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT);
+ iPc->setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT);
}
sd->state.size = size;
@@ -7448,7 +7398,7 @@ ACMD(sizeall)
if( pl_sd->state.size != size ) {
if( pl_sd->state.size ) {
pl_sd->state.size = SZ_SMALL;
- pc_setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
+ iPc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
}
pl_sd->state.size = size;
@@ -7472,7 +7422,7 @@ ACMD(sizeguild)
struct guild *g;
nullpo_retr(-1, sd);
- memset(guild, '\0', sizeof(guild));
+ memset(guild_name, '\0', sizeof(guild_name));
if( !message || !*message || sscanf(message, "%d %23[^\n]", &size, guild_name) < 2 ) {
clif->message(fd, msg_txt(1304)); // Please enter guild name/ID (usage: @sizeguild <size> <guild name/ID>).
@@ -7490,7 +7440,7 @@ ACMD(sizeguild)
if( (pl_sd = g->member[i].sd) && pl_sd->state.size != size ) {
if( pl_sd->state.size ) {
pl_sd->state.size = SZ_SMALL;
- pc_setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
+ iPc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
}
pl_sd->state.size = size;
@@ -7599,19 +7549,19 @@ return true;\
if ( strcmp( flag_name , "gvg" ) == 0 ) {
if( flag && !map[sd->bl.m].flag.gvg )
- map_zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
+ iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_GVG_NAME));
else if ( !flag && map[sd->bl.m].flag.gvg )
- map_zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
+ iMap->zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
} else if ( strcmp( flag_name , "pvp" ) == 0 ) {
if( flag && !map[sd->bl.m].flag.pvp )
- map_zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
+ iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_PVP_NAME));
else if ( !flag && map[sd->bl.m].flag.pvp )
- map_zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
+ iMap->zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
} else if ( strcmp( flag_name , "battleground" ) == 0 ) {
if( flag && !map[sd->bl.m].flag.battleground )
- map_zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_BG_NAME));
+ iMap->zone_change2(sd->bl.m,strdb_get(zone_db, MAP_ZONE_BG_NAME));
else if ( !flag && map[sd->bl.m].flag.battleground )
- map_zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
+ iMap->zone_change2(sd->bl.m,map[sd->bl.m].prev_zone);
}
setflag(autotrade); setflag(allowks); setflag(nomemo); setflag(noteleport);
@@ -7699,7 +7649,7 @@ ACMD(showdelay)
ACMD(invite)
{
unsigned int did = sd->duel_group;
- struct map_session_data *target_sd = map_nick2sd((char *)message);
+ struct map_session_data *target_sd = iMap->nick2sd((char *)message);
if(did == 0) {
// "Duel: @invite without @duel."
@@ -7772,7 +7722,7 @@ ACMD(duel)
duel_create(sd, maxpl);
} else {
struct map_session_data *target_sd;
- target_sd = map_nick2sd((char *)message);
+ target_sd = iMap->nick2sd((char *)message);
if(target_sd != NULL) {
unsigned int newduel;
if((newduel = duel_create(sd, 2)) != -1) {
@@ -7870,13 +7820,13 @@ ACMD(cash)
if( !strcmpi(command+1,"cash") )
{
if( value > 0 ) {
- if( (ret=pc_getcash(sd, value, 0)) >= 0){
+ if( (ret=iPc->getcash(sd, value, 0)) >= 0){
sprintf(output, msg_txt(505), ret, sd->cashPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
} else {
- if( (ret=pc_paycash(sd, -value, 0)) >= 0){
+ if( (ret=iPc->paycash(sd, -value, 0)) >= 0){
sprintf(output, msg_txt(410), ret, sd->cashPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
@@ -7886,13 +7836,13 @@ ACMD(cash)
else
{ // @points
if( value > 0 ) {
- if( (ret=pc_getcash(sd, 0, value)) >= 0){
+ if( (ret=iPc->getcash(sd, 0, value)) >= 0){
sprintf(output, msg_txt(506), ret, sd->kafraPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
} else {
- if( (ret=pc_paycash(sd, -value, -value)) >= 0){
+ if( (ret=iPc->paycash(sd, -value, -value)) >= 0){
sprintf(output, msg_txt(411), ret, sd->kafraPoints);
clif->disp_onlyself(sd, output, strlen(output));
}
@@ -7914,12 +7864,12 @@ ACMD(clone)
return true;
}
- if((pl_sd=map_nick2sd((char *)message)) == NULL && (pl_sd=map_charid2sd(atoi(message))) == NULL) {
+ if((pl_sd=iMap->nick2sd((char *)message)) == NULL && (pl_sd=iMap->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return true;
}
- if(pc_get_group_level(pl_sd) > pc_get_group_level(sd)) {
+ if(iPc->get_group_level(pl_sd) > iPc->get_group_level(sd)) {
clif->message(fd, msg_txt(126)); // Cannot clone a player of higher GM level than yourself.
return true;
}
@@ -7943,7 +7893,7 @@ ACMD(clone)
do {
x = sd->bl.x + (rnd() % 10 - 5);
y = sd->bl.y + (rnd() % 10 - 5);
- } while (map_getcell(sd->bl.m,x,y,CELL_CHKNOPASS) && i++ < 10);
+ } while (iMap->getcell(sd->bl.m,x,y,CELL_CHKNOPASS) && i++ < 10);
if (i >= 10) {
x = sd->bl.x;
@@ -7998,7 +7948,7 @@ ACMD(request)
*------------------------------------------*/
ACMD(feelreset)
{
- pc_resetfeel(sd);
+ iPc->resetfeel(sd);
clif->message(fd, msg_txt(1324)); // Reset 'Feeling' maps.
return true;
@@ -8070,7 +8020,7 @@ ACMD(resetstat)
{
nullpo_retr(-1, sd);
- pc_resetstate(sd);
+ iPc->resetstate(sd);
sprintf(atcmd_output, msg_txt(207), sd->status.name);
clif->message(fd, atcmd_output);
return true;
@@ -8080,7 +8030,7 @@ ACMD(resetskill)
{
nullpo_retr(-1,sd);
- pc_resetskill(sd,1);
+ iPc->resetskill(sd,1);
sprintf(atcmd_output, msg_txt(206), sd->status.name);
clif->message(fd, atcmd_output);
return true;
@@ -8302,7 +8252,7 @@ ACMD(stats)
output_table[14].value = sd->change_level_2nd;
output_table[15].value = sd->change_level_3rd;
- sprintf(job_jobname, "Job - %s %s", job_name(sd->status.class_), "(level %d)");
+ sprintf(job_jobname, "Job - %s %s", iPc->job_name(sd->status.class_), "(level %d)");
sprintf(output, msg_txt(53), sd->status.name); // '%s' stats:
clif->message(fd, output);
@@ -8342,7 +8292,7 @@ ACMD(delitem)
total = amount;
// delete items
- while( amount && ( idx = pc_search_inventory(sd, nameid) ) != -1 )
+ while( amount && ( idx = iPc->search_inventory(sd, nameid) ) != -1 )
{
int delamount = ( amount < sd->status.inventory[idx].amount ) ? amount : sd->status.inventory[idx].amount;
@@ -8350,7 +8300,7 @@ ACMD(delitem)
{// delete pet
intif_delete_petdata(MakeDWord(sd->status.inventory[idx].card[1], sd->status.inventory[idx].card[2]));
}
- pc_delitem(sd, idx, delamount, 0, 0, LOG_TYPE_COMMAND);
+ iPc->delitem(sd, idx, delamount, 0, 0, LOG_TYPE_COMMAND);
amount-= delamount;
}
@@ -8516,7 +8466,7 @@ ACMD(accinfo) {
//remove const type
safestrncpy(query, message, NAME_LENGTH);
- intif_request_accinfo( sd->fd, sd->bl.id, pc_get_group_level(sd), query );
+ intif_request_accinfo( sd->fd, sd->bl.id, iPc->get_group_level(sd), query );
return true;
}
@@ -8569,7 +8519,7 @@ ACMD(set) {
switch( reg[0] ) {
case '@':
- data->u.str = pc_readregstr(sd, add_str(reg));
+ data->u.str = iPc->readregstr(sd, add_str(reg));
break;
case '$':
data->u.str = mapreg_readregstr(add_str(reg));
@@ -8598,7 +8548,7 @@ ACMD(set) {
data->type = C_INT;
switch( reg[0] ) {
case '@':
- data->u.num = pc_readreg(sd, add_str(reg));
+ data->u.num = iPc->readreg(sd, add_str(reg));
break;
case '$':
data->u.num = mapreg_readreg(add_str(reg));
@@ -8724,7 +8674,7 @@ sd->status.skill[idx].lv = x?1:0; \
sd->status.skill[idx].flag = x?1:0;
int val = atoi(message);
- bool need_skill = pc_checkskill(sd, MC_PUSHCART) ? false : true;
+ bool need_skill = iPc->checkskill(sd, MC_PUSHCART) ? false : true;
unsigned int index = skill->get_index(MC_PUSHCART);
if( !message || !*message || val < 0 || val > MAX_CARTS ) {
@@ -8742,7 +8692,7 @@ sd->status.skill[idx].flag = x?1:0;
MC_CART_MDFY(1,index);
}
- if( pc_setcart(sd, val) ) {
+ if( iPc->setcart(sd, val) ) {
if( need_skill ) {
MC_CART_MDFY(0,index);
}
@@ -9067,7 +9017,7 @@ ACMD(channel) {
return false;
}
- if( sub2[0] == '\0' || ( pl_sd = map_nick2sd(sub2) ) == NULL ) {
+ if( sub2[0] == '\0' || ( pl_sd = iMap->nick2sd(sub2) ) == NULL ) {
sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found
clif->message(fd, atcmd_output);
return false;
@@ -9123,7 +9073,7 @@ ACMD(channel) {
return false;
}
- if( sub2[0] == '\0' || ( pl_sd = map_nick2sd(sub2) ) == NULL ) {
+ if( sub2[0] == '\0' || ( pl_sd = iMap->nick2sd(sub2) ) == NULL ) {
sprintf(atcmd_output, msg_txt(1434), sub2);// Player '%s' was not found
clif->message(fd, atcmd_output);
return false;
@@ -9206,7 +9156,7 @@ ACMD(channel) {
iter = db_iterator(channel->banned);
for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) {
- struct hChSysBanEntry * entry = DB->data2ptr(data);
+ struct hChSysBanEntry * entry = iDB->data2ptr(data);
if( !isA )
sprintf(atcmd_output, msg_txt(1444), entry->name);// - %s %s
@@ -9553,7 +9503,6 @@ void atcommand_basecommands(void) {
ACMD_DEF(reloadbattleconf),
ACMD_DEF(reloadstatusdb),
ACMD_DEF(reloadpcdb),
- ACMD_DEF(reloadmotd),
ACMD_DEF(mapinfo),
ACMD_DEF(dye),
ACMD_DEF2("hairstyle", hair_style),
@@ -9615,7 +9564,6 @@ void atcommand_basecommands(void) {
ACMD_DEF(refresh),
ACMD_DEF(refreshall),
ACMD_DEF(identify),
- ACMD_DEF(gmotd),
ACMD_DEF(misceffect),
ACMD_DEF(mobsearch),
ACMD_DEF(cleanmap),
@@ -9724,6 +9672,7 @@ void atcommand_basecommands(void) {
safestrncpy(cmd->command, atcommand_base[i].command, sizeof(cmd->command));
cmd->func = atcommand_base[i].func;
cmd->help = NULL;/* start as null dear */
+ cmd->log = true;
strdb_put(atcommand->db, cmd->command, cmd);
}
return;
@@ -9859,7 +9808,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
// 1 = player invoked
if ( type == 1) {
//Commands are disabled on maps flagged as 'nocommand'
- if ( map[sd->bl.m].nocommand && pc_get_group_level(sd) < map[sd->bl.m].nocommand ) {
+ if ( map[sd->bl.m].nocommand && iPc->get_group_level(sd) < map[sd->bl.m].nocommand ) {
clif->message(fd, msg_txt(143));
return false;
}
@@ -9894,7 +9843,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
break;
}
- if( !pc_get_group_level(sd) ) {
+ if( !iPc->get_group_level(sd) ) {
if( x >= 1 || y >= 1 ) { /* we have command */
info = get_atcommandinfo_byname(atcommand_checkalias(command + 1));
if( !info || info->char_groups[sd->group_pos] == 0 ) /* if we can't use or doesn't exist: don't even display the command failed message */
@@ -9932,15 +9881,15 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
// Check if the binding isn't NULL and there is a NPC event, level of usage met, et cetera
if( binding != NULL && binding->npc_event[0] &&
- ((*atcmd_msg == atcommand->at_symbol && pc_get_group_level(sd) >= binding->group_lv) ||
- (*atcmd_msg == atcommand->char_symbol && pc_get_group_level(sd) >= binding->group_lv_char)))
+ ((*atcmd_msg == atcommand->at_symbol && iPc->get_group_level(sd) >= binding->group_lv) ||
+ (*atcmd_msg == atcommand->char_symbol && iPc->get_group_level(sd) >= binding->group_lv_char)))
{
// Check if self or character invoking; if self == character invoked, then self invoke.
bool invokeFlag = ((*atcmd_msg == atcommand->at_symbol) ? 1 : 0);
// Check if the command initiated is a character command
if (*message == atcommand->char_symbol &&
- (ssd = map_nick2sd(charname)) == NULL && (ssd = map_nick2sd(charname2)) == NULL ) {
+ (ssd = iMap->nick2sd(charname)) == NULL && (ssd = iMap->nick2sd(charname2)) == NULL ) {
sprintf(output, msg_txt(1389), command); // %s failed. Player not found.
clif->message(fd, output);
return true;
@@ -9957,7 +9906,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
//Grab the command information and check for the proper GM level required to use it or if the command exists
info = get_atcommandinfo_byname(atcommand_checkalias(command + 1));
if (info == NULL) {
- if( pc_get_group_level(sd) ) { // TODO: remove or replace with proper permission
+ if( iPc->get_group_level(sd) ) { // TODO: remove or replace with proper permission
sprintf(output, msg_txt(153), command); // "%s is Unknown Command."
clif->message(fd, output);
atcommand_get_suggestions(sd, command + 1, *message == atcommand->at_symbol);
@@ -9990,7 +9939,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
// Check if target is valid only if confirmed that player can use command.
if (*message == atcommand->char_symbol &&
- (ssd = map_nick2sd(charname)) == NULL && (ssd = map_nick2sd(charname2)) == NULL ) {
+ (ssd = iMap->nick2sd(charname)) == NULL && (ssd = iMap->nick2sd(charname2)) == NULL ) {
sprintf(output, msg_txt(1389), command); // %s failed. Player not found.
clif->message(fd, output);
return true;
@@ -10202,6 +10151,7 @@ bool atcommand_hp_add(char *name, AtCommandFunc func) {
safestrncpy(cmd->command, name, sizeof(cmd->command));
cmd->func = func;
cmd->help = NULL;/* start as null dear */
+ cmd->log = true;
strdb_put(atcommand->db, cmd->command, cmd);
return true;
@@ -10234,7 +10184,7 @@ void atcommand_doload(void) {
atcommand->db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH);
atcommand->alias_db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH);
atcommand_basecommands(); //fills initial atcommand_db with known commands
- atcommand_config_read(ATCOMMAND_CONF_FILENAME);
+ atcommand_config_read(iMap->ATCOMMAND_CONF_FILENAME);
}
void do_init_atcommand(void) {
diff --git a/src/map/battle.c b/src/map/battle.c
index f6fba5ca5..9348c62cd 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -90,7 +90,7 @@ struct block_list* battle_gettargeted(struct block_list *target) {
nullpo_retr(NULL, target);
memset(bl_list, 0, sizeof(bl_list));
- map_foreachinrange(battle->get_targeted_sub, target, AREA_SIZE, BL_CHAR, bl_list, &c, target->id);
+ iMap->foreachinrange(battle->get_targeted_sub, target, AREA_SIZE, BL_CHAR, bl_list, &c, target->id);
if ( c == 0 )
return NULL;
if( c > 24 )
@@ -146,7 +146,7 @@ struct block_list* battle_getenemy(struct block_list *target, int type, int rang
int c = 0;
memset(bl_list, 0, sizeof(bl_list));
- map_foreachinrange(battle->get_enemy_sub, target, range, type, bl_list, &c, target);
+ iMap->foreachinrange(battle->get_enemy_sub, target, range, type, bl_list, &c, target);
if ( c == 0 )
return NULL;
@@ -188,7 +188,7 @@ struct block_list* battle_getenemyarea(struct block_list *src, int x, int y, int
int c = 0;
memset(bl_list, 0, sizeof(bl_list));
- map_foreachinarea(battle->get_enemy_area_sub, src->m, x - range, y - range, x + range, y + range, type, bl_list, &c, src, ignore_id);
+ iMap->foreachinarea(battle->get_enemy_area_sub, src->m, x - range, y - range, x + range, y + range, type, bl_list, &c, src, ignore_id);
if( c == 0 )
return NULL;
@@ -217,33 +217,33 @@ int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) {
if ( dat ) {
struct block_list* src;
- struct block_list* target = map_id2bl(dat->target_id);
+ struct block_list* target = iMap->id2bl(dat->target_id);
if( !target || status_isdead(target) ) {/* nothing we can do */
ers_free(delay_damage_ers, dat);
return 0;
}
- src = map_id2bl(dat->src_id);
+ src = iMap->id2bl(dat->src_id);
if( src && target->m == src->m &&
(target->type != BL_PC || ((TBL_PC*)target)->invincible_timer == INVALID_TIMER) &&
check_distance_bl(src, target, dat->distance) ) //Check to see if you haven't teleported. [Skotlex]
{
- map_freeblock_lock();
+ iMap->freeblock_lock();
status_fix_damage(src, target, dat->damage, dat->delay);
if( dat->attack_type && !status_isdead(target) && dat->additional_effects )
skill->additional_effect(src,target,dat->skill_id,dat->skill_lv,dat->attack_type,dat->dmg_lv,tick);
if( dat->dmg_lv > ATK_BLOCK && dat->attack_type )
skill->counter_additional_effect(src,target,dat->skill_id,dat->skill_lv,dat->attack_type,tick);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
} else if( !src && dat->skill_id == CR_REFLECTSHIELD ) {
/**
* it was monster reflected damage, and the monster died, we pass the damage to the character as expected
**/
- map_freeblock_lock();
+ iMap->freeblock_lock();
status_fix_damage(target, target, dat->damage, dat->delay);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
}
}
ers_free(delay_damage_ers, dat);
@@ -263,13 +263,13 @@ int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src,
damage = 0;
if ( !battle_config.delay_battle_damage || amotion <= 1 ) {
- map_freeblock_lock();
+ iMap->freeblock_lock();
status_fix_damage(src, target, damage, ddelay); // We have to seperate here between reflect damage and others [icescope]
if( attack_type && !status_isdead(target) && additional_effects )
- skill->additional_effect(src, target, skill_id, skill_lv, attack_type, dmg_lv, gettick());
+ skill->additional_effect(src, target, skill_id, skill_lv, attack_type, dmg_lv, iTimer->gettick());
if( dmg_lv > ATK_BLOCK && attack_type )
- skill->counter_additional_effect(src, target, skill_id, skill_lv, attack_type, gettick());
- map_freeblock_unlock();
+ skill->counter_additional_effect(src, target, skill_id, skill_lv, attack_type, iTimer->gettick());
+ iMap->freeblock_unlock();
return 0;
}
dat = ers_alloc(delay_damage_ers, struct delay_damage);
@@ -286,7 +286,7 @@ int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src,
if (src->type != BL_PC && amotion > 1000)
amotion = 1000; //Aegis places a damage-delay cap of 1 sec to non player attacks. [Skotlex]
- add_timer(tick+amotion, battle->delay_damage_sub, 0, (intptr_t)dat);
+ iTimer->add_timer(tick+amotion, battle->delay_damage_sub, 0, (intptr_t)dat);
return 0;
}
@@ -340,7 +340,7 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag
struct block_list *src;
if( !su || !su->alive || (sg = su->group) == NULL || !sg || sg->val3 == -1 ||
- (src = map_id2bl(sg->src_id)) == NULL || status_isdead(src) )
+ (src = iMap->id2bl(sg->src_id)) == NULL || status_isdead(src) )
return 0;
if( sg->unit_id != UNT_FIREWALL ) {
@@ -349,7 +349,7 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag
y = sg->val3 & 0xffff;
skill->unitsetting(src,su->group->skill_id,su->group->skill_lv,x,y,1);
sg->val3 = -1;
- sg->limit = DIFF_TICK(gettick(),sg->tick)+300;
+ sg->limit = DIFF_TICK(iTimer->gettick(),sg->tick)+300;
}
}
}
@@ -848,7 +848,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
delay = 200;
else
delay = 100;
- unit_set_walkdelay(bl, gettick(), delay, 1);
+ unit_set_walkdelay(bl, iTimer->gettick(), delay, 1);
if(sc->data[SC_SHRINK] && rnd()%100<5*sce->val1)
skill->blown(bl,src,skill->get_blewcount(CR_SHRINK,1),-1,0);
@@ -882,7 +882,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
if(sc->data[SC_DODGE] && ( !sc->opt1 || sc->opt1 == OPT1_BURNING ) &&
(flag&BF_LONG || sc->data[SC_SPURT])
&& rnd()%100 < 20) {
- if (sd && pc_issit(sd)) pc_setstand(sd); //Stand it to dodge.
+ if (sd && pc_issit(sd)) iPc->setstand(sd); //Stand it to dodge.
clif->skill_nodamage(bl,bl,TK_DODGE,1,1);
if (!sc->data[SC_COMBO])
sc_start4(bl, SC_COMBO, 100, TK_JUMPKICK, src->id, 1, 0, 2000);
@@ -918,9 +918,9 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
if (((sce=sc->data[SC_UTSUSEMI]) || sc->data[SC_BUNSINJYUTSU])
&& flag&BF_WEAPON && !(skill->get_nk(skill_id)&NK_NO_CARDFIX_ATK)) {
- skill->additional_effect (src, bl, skill_id, skill_lv, flag, ATK_BLOCK, gettick() );
+ skill->additional_effect (src, bl, skill_id, skill_lv, flag, ATK_BLOCK, iTimer->gettick() );
if( !status_isdead(src) )
- skill->counter_additional_effect( src, bl, skill_id, skill_lv, flag, gettick() );
+ skill->counter_additional_effect( src, bl, skill_id, skill_lv, flag, iTimer->gettick() );
if (sce) {
clif->specialeffect(bl, 462, AREA);
skill->blown(src,bl,sce->val3,-1,0);
@@ -1057,7 +1057,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
damage -= damage * sc->data[SC_PAIN_KILLER]->val3 / 100;
}
if((sce=sc->data[SC_MAGMA_FLOW]) && (rnd()%100 <= sce->val2) ){
- skill->castend_damage_id(bl,src,MH_MAGMA_FLOW,sce->val1,gettick(),0);
+ skill->castend_damage_id(bl,src,MH_MAGMA_FLOW,sce->val1,iTimer->gettick(),0);
}
if( (sce = sc->data[SC_STONEHARDSKIN]) && flag&BF_WEAPON && damage > 0 ) {
@@ -1114,7 +1114,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
if( (sce = sc->data[SC_LIGHTNINGWALK]) && flag&BF_LONG && rnd()%100 < sce->val1 ) {
int dx[8]={0,-1,-1,-1,0,1,1,1};
int dy[8]={1,1,0,-1,-1,-1,0,1};
- uint8 dir = map_calc_dir(bl, src->x, src->y);
+ uint8 dir = iMap->calc_dir(bl, src->x, src->y);
if( unit_movepos(bl, src->x-dx[dir], src->y-dy[dir], 1, 1) ) {
clif->slide(bl,src->x-dx[dir],src->y-dy[dir]);
unit_setdir(bl, dir);
@@ -1131,7 +1131,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
status_heal(src, damage*sce->val4/100, 0, 3);
if( sd && (sce = sc->data[SC_FORCEOFVANGUARD]) && flag&BF_WEAPON && rnd()%100 < sce->val2 )
- pc_addspiritball(sd,skill->get_time(LG_FORCEOFVANGUARD,sce->val1),sce->val3);
+ iPc->addspiritball(sd,skill->get_time(LG_FORCEOFVANGUARD,sce->val1),sce->val3);
if (sc->data[SC_STYLE_CHANGE] && rnd()%2) {
TBL_HOM *hd = BL_CAST(BL_HOM,bl);
if (hd) homun->addspiritball(hd, 10); //add a sphere
@@ -1141,7 +1141,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
status_change_spread(bl, src); // Deadly infect attacked side
if( sc && sc->data[SC__SHADOWFORM] ) {
- struct block_list *s_bl = map_id2bl(sc->data[SC__SHADOWFORM]->val2);
+ struct block_list *s_bl = iMap->id2bl(sc->data[SC__SHADOWFORM]->val2);
if( !s_bl || s_bl->m != bl->m ) { // If the shadow form target is not present remove the sc.
status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER);
} else if( status_isdead(s_bl) || !battle->check_target(src,s_bl,BCT_ENEMY)) { // If the shadow form target is dead or not your enemy remove the sc in both.
@@ -1154,7 +1154,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
if( s_bl->type == BL_PC )
((TBL_PC*)s_bl)->shadowform_id = 0;
} else {
- status_damage(bl, s_bl, damage, 0, clif->damage(s_bl, s_bl, gettick(), 500, 500, damage, -1, 0, 0), 0);
+ status_damage(bl, s_bl, damage, 0, clif->damage(s_bl, s_bl, iTimer->gettick(), 500, 500, damage, -1, 0, 0), 0);
return ATK_NONE;
}
}
@@ -1236,9 +1236,9 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
if( bl->type == BL_MOB && !status_isdead(bl) && src != bl) {
if (damage > 0 )
- mobskill_event((TBL_MOB*)bl,src,gettick(),flag);
+ mobskill_event((TBL_MOB*)bl,src,iTimer->gettick(),flag);
if (skill_id)
- mobskill_event((TBL_MOB*)bl,src,gettick(),MSC_SKILLUSED|(skill_id<<16));
+ mobskill_event((TBL_MOB*)bl,src,iTimer->gettick(),MSC_SKILLUSED|(skill_id<<16));
}
if( sd ) {
if( pc_ismadogear(sd) && rnd()%100 < 50 ) {
@@ -1256,7 +1256,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
else if( element == -3 ) //Use random element
element = rnd()%ELE_MAX;
if( element == ELE_FIRE || element == ELE_WATER )
- pc_overheat(sd,element == ELE_FIRE ? 1 : -1);
+ iPc->overheat(sd,element == ELE_FIRE ? 1 : -1);
}
}
@@ -1363,19 +1363,19 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int
nullpo_ret(sd);
- if((skill = pc_checkskill(sd,AL_DEMONBANE)) > 0 &&
+ if((skill = iPc->checkskill(sd,AL_DEMONBANE)) > 0 &&
target->type == BL_MOB && //This bonus doesnt work against players.
(battle->check_undead(status->race,status->def_ele) || status->race==RC_DEMON) )
damage += (skill*(int)(3+(sd->status.base_level+1)*0.05)); // submitted by orn
//damage += (skill * 3);
- if( (skill = pc_checkskill(sd, RA_RANGERMAIN)) > 0 && (status->race == RC_BRUTE || status->race == RC_PLANT || status->race == RC_FISH) )
+ if( (skill = iPc->checkskill(sd, RA_RANGERMAIN)) > 0 && (status->race == RC_BRUTE || status->race == RC_PLANT || status->race == RC_FISH) )
damage += (skill * 5);
- if( (skill = pc_checkskill(sd,NC_RESEARCHFE)) > 0 && (status->def_ele == ELE_FIRE || status->def_ele == ELE_EARTH) )
+ if( (skill = iPc->checkskill(sd,NC_RESEARCHFE)) > 0 && (status->def_ele == ELE_FIRE || status->def_ele == ELE_EARTH) )
damage += (skill * 10);
if( pc_ismadogear(sd) )
- damage += 20 + 20 * pc_checkskill(sd, NC_MADOLICENCE);
+ damage += 20 + 20 * iPc->checkskill(sd, NC_MADOLICENCE);
- if((skill = pc_checkskill(sd,HT_BEASTBANE)) > 0 && (status->race==RC_BRUTE || status->race==RC_INSECT) ) {
+ if((skill = iPc->checkskill(sd,HT_BEASTBANE)) > 0 && (status->race==RC_BRUTE || status->race==RC_INSECT) ) {
damage += (skill * 4);
if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_HUNTER)
damage += sd->status.str;
@@ -1389,26 +1389,26 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int
{
case W_1HSWORD:
#ifdef RENEWAL
- if((skill = pc_checkskill(sd,AM_AXEMASTERY)) > 0)
+ if((skill = iPc->checkskill(sd,AM_AXEMASTERY)) > 0)
damage += (skill * 3);
#endif
case W_DAGGER:
- if((skill = pc_checkskill(sd,SM_SWORD)) > 0)
+ if((skill = iPc->checkskill(sd,SM_SWORD)) > 0)
damage += (skill * 4);
- if((skill = pc_checkskill(sd,GN_TRAINING_SWORD)) > 0)
+ if((skill = iPc->checkskill(sd,GN_TRAINING_SWORD)) > 0)
damage += skill * 10;
break;
case W_2HSWORD:
#ifdef RENEWAL
- if((skill = pc_checkskill(sd,AM_AXEMASTERY)) > 0)
+ if((skill = iPc->checkskill(sd,AM_AXEMASTERY)) > 0)
damage += (skill * 3);
#endif
- if((skill = pc_checkskill(sd,SM_TWOHAND)) > 0)
+ if((skill = iPc->checkskill(sd,SM_TWOHAND)) > 0)
damage += (skill * 4);
break;
case W_1HSPEAR:
case W_2HSPEAR:
- if((skill = pc_checkskill(sd,KN_SPEARMASTERY)) > 0) {
+ if((skill = iPc->checkskill(sd,KN_SPEARMASTERY)) > 0) {
if(!pc_isriding(sd))
damage += (skill * 4);
else
@@ -1417,40 +1417,40 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int
break;
case W_1HAXE:
case W_2HAXE:
- if((skill = pc_checkskill(sd,AM_AXEMASTERY)) > 0)
+ if((skill = iPc->checkskill(sd,AM_AXEMASTERY)) > 0)
damage += (skill * 3);
- if((skill = pc_checkskill(sd,NC_TRAININGAXE)) > 0)
+ if((skill = iPc->checkskill(sd,NC_TRAININGAXE)) > 0)
damage += (skill * 5);
break;
case W_MACE:
case W_2HMACE:
- if((skill = pc_checkskill(sd,PR_MACEMASTERY)) > 0)
+ if((skill = iPc->checkskill(sd,PR_MACEMASTERY)) > 0)
damage += (skill * 3);
- if((skill = pc_checkskill(sd,NC_TRAININGAXE)) > 0)
+ if((skill = iPc->checkskill(sd,NC_TRAININGAXE)) > 0)
damage += (skill * 5);
break;
case W_FIST:
- if((skill = pc_checkskill(sd,TK_RUN)) > 0)
+ if((skill = iPc->checkskill(sd,TK_RUN)) > 0)
damage += (skill * 10);
// No break, fallthrough to Knuckles
case W_KNUCKLE:
- if((skill = pc_checkskill(sd,MO_IRONHAND)) > 0)
+ if((skill = iPc->checkskill(sd,MO_IRONHAND)) > 0)
damage += (skill * 3);
break;
case W_MUSICAL:
- if((skill = pc_checkskill(sd,BA_MUSICALLESSON)) > 0)
+ if((skill = iPc->checkskill(sd,BA_MUSICALLESSON)) > 0)
damage += (skill * 3);
break;
case W_WHIP:
- if((skill = pc_checkskill(sd,DC_DANCINGLESSON)) > 0)
+ if((skill = iPc->checkskill(sd,DC_DANCINGLESSON)) > 0)
damage += (skill * 3);
break;
case W_BOOK:
- if((skill = pc_checkskill(sd,SA_ADVANCEDBOOK)) > 0)
+ if((skill = iPc->checkskill(sd,SA_ADVANCEDBOOK)) > 0)
damage += (skill * 3);
break;
case W_KATAR:
- if((skill = pc_checkskill(sd,AS_KATAR)) > 0)
+ if((skill = iPc->checkskill(sd,AS_KATAR)) > 0)
damage += (skill * 3);
break;
}
@@ -1567,7 +1567,7 @@ void battle_consume_ammo(TBL_PC*sd, int skill_id, int lv) {
}
if(sd->equip_index[EQI_AMMO]>=0) //Qty check should have been done in skill_check_condition
- pc_delitem(sd,sd->equip_index[EQI_AMMO],qty,0,1,LOG_TYPE_CONSUME);
+ iPc->delitem(sd,sd->equip_index[EQI_AMMO],qty,0,1,LOG_TYPE_CONSUME);
sd->state.arrow_atk = 0;
}
@@ -1817,7 +1817,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
}
if( sd && !skill_id ) { //Check for double attack.
- if( ( ( skill_lv = pc_checkskill(sd,TF_DOUBLE) ) > 0 && sd->weapontype1 == W_DAGGER )
+ if( ( ( skill_lv = iPc->checkskill(sd,TF_DOUBLE) ) > 0 && sd->weapontype1 == W_DAGGER )
|| ( sd->bonus.double_rate > 0 && sd->weapontype1 != W_FIST ) //Will fail bare-handed
|| ( sc && sc->data[SC_KAGEMUSYA] && sd->weapontype1 != W_FIST )) // Need confirmation
{ //Success chance is not added, the higher one is used [Skotlex]
@@ -1827,7 +1827,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
wd.type = 0x08;
}
}
- else if( sd->weapontype1 == W_REVOLVER && (skill_lv = pc_checkskill(sd,GS_CHAINACTION)) > 0 && rnd()%100 < 5*skill_lv )
+ else if( sd->weapontype1 == W_REVOLVER && (skill_lv = iPc->checkskill(sd,GS_CHAINACTION)) > 0 && rnd()%100 < 5*skill_lv )
{
wd.div_ = skill->get_num(GS_CHAINACTION,skill_lv);
wd.type = 0x08;
@@ -1970,7 +1970,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
hitrate += sd->bonus.arrow_hit;
#ifdef RENEWAL
if( sd ) //in Renewal hit bonus from Vultures Eye is not anymore shown in status window
- hitrate += pc_checkskill(sd,AC_VULTURE);
+ hitrate += iPc->checkskill(sd,AC_VULTURE);
#endif
if(skill_id)
switch(skill_id)
@@ -2003,14 +2003,14 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
hitrate += hitrate * 5 * skill_lv / 100;
break;
case AS_SONICBLOW:
- if(sd && pc_checkskill(sd,AS_SONICACCEL)>0)
+ if(sd && iPc->checkskill(sd,AS_SONICACCEL)>0)
hitrate += hitrate * 50 / 100;
break;
case MC_CARTREVOLUTION:
case GN_CART_TORNADO:
case GN_CARTCANNON:
- if( sd && pc_checkskill(sd, GN_REMODELING_CART) )
- hitrate += pc_checkskill(sd, GN_REMODELING_CART) * 4;
+ if( sd && iPc->checkskill(sd, GN_REMODELING_CART) )
+ hitrate += iPc->checkskill(sd, GN_REMODELING_CART) * 4;
break;
case GC_VENOMPRESSURE:
hitrate += 10 + 4 * skill_lv;
@@ -2019,11 +2019,11 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if( sd ) {
// Weaponry Research hidden bonus
- if ((temp = pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0)
+ if ((temp = iPc->checkskill(sd,BS_WEAPONRESEARCH)) > 0)
hitrate += hitrate * ( 2 * temp ) / 100;
if( (sd->status.weapon == W_1HSWORD || sd->status.weapon == W_DAGGER) &&
- (temp = pc_checkskill(sd, GN_TRAINING_SWORD))>0 )
+ (temp = iPc->checkskill(sd, GN_TRAINING_SWORD))>0 )
hitrate += 3 * temp;
}
@@ -2147,8 +2147,8 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if(flag.cri && sd->bonus.crit_atk_rate)
ATK_ADDRATE(sd->bonus.crit_atk_rate);
- if(sd->status.party_id && (temp=pc_checkskill(sd,TK_POWER)) > 0){
- if( (i = party_foreachsamemap(party_sub_count, sd, 0)) > 1 ) // exclude the player himself [Inkfish]
+ if(sd->status.party_id && (temp=iPc->checkskill(sd,TK_POWER)) > 0){
+ if( (i = party_foreachsamemap(iParty->sub_count, sd, 0)) > 1 ) // exclude the player himself [Inkfish]
ATK_ADDRATE(2*temp*i);
}
}
@@ -2393,7 +2393,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
case AS_SPLASHER:
skillratio += 400+50*skill_lv;
if(sd)
- skillratio += 20 * pc_checkskill(sd,AS_POISONREACT);
+ skillratio += 20 * iPc->checkskill(sd,AS_POISONREACT);
break;
case ASC_BREAKER:
skillratio += 100*skill_lv-100;
@@ -2524,7 +2524,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if( index >= 0 && sd->inventory_data[index]
&& sd->inventory_data[index]->type == IT_WEAPON )
skillratio += max(10000 - sd->inventory_data[index]->weight, 0) / 10;
- skillratio += 50 * pc_checkskill(sd,LK_SPIRALPIERCE);
+ skillratio += 50 * iPc->checkskill(sd,LK_SPIRALPIERCE);
} // (1 + [(Casters Base Level - 100) / 200])
skillratio = skillratio * (100 + (status_get_lv(src)-100) / 2) / 100;
break;
@@ -2554,10 +2554,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
}
break;
case RK_STORMBLAST:
- skillratio = 100 * (sd ? pc_checkskill(sd,RK_RUNEMASTERY) : 1) + 100 * (sstatus->int_ / 4);
+ skillratio = 100 * (sd ? iPc->checkskill(sd,RK_RUNEMASTERY) : 1) + 100 * (sstatus->int_ / 4);
break;
case RK_PHANTOMTHRUST:
- skillratio = 50 * skill_lv + 10 * ( sd ? pc_checkskill(sd,KN_SPEARMASTERY) : 10);
+ skillratio = 50 * skill_lv + 10 * ( sd ? iPc->checkskill(sd,KN_SPEARMASTERY) : 10);
//if( s_level > 100 ) skillratio += skillratio * s_level / 150; // Base level bonus. This is official, but is disabled until I can confirm something with was changed or not. [Rytech]
//if( s_level > 100 ) skillratio += skillratio * (s_level - 100) / 200; // Base level bonus.
break;
@@ -2682,7 +2682,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
RE_LVL_DMOD(100);
break;
case LG_BANISHINGPOINT:
- skillratio += -100 + ((50 * skill_lv) + (30 * ((sd)?pc_checkskill(sd,SM_BASH):1)));
+ skillratio += -100 + ((50 * skill_lv) + (30 * ((sd)?iPc->checkskill(sd,SM_BASH):1)));
RE_LVL_DMOD(100);
break;
case LG_SHIELDPRESS:
@@ -2710,11 +2710,11 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
skillratio += 2400; //2500%
break;
case LG_MOONSLASHER:
- skillratio += -100 + (120 * skill_lv + ((sd) ? pc_checkskill(sd,LG_OVERBRAND) : 5) * 80);
+ skillratio += -100 + (120 * skill_lv + ((sd) ? iPc->checkskill(sd,LG_OVERBRAND) : 5) * 80);
RE_LVL_DMOD(100);
break;
case LG_OVERBRAND:
- skillratio = 400 * skill_lv + (pc_checkskill(sd,CR_SPEARQUICKEN) * 30);
+ skillratio = 400 * skill_lv + (iPc->checkskill(sd,CR_SPEARQUICKEN) * 30);
RE_LVL_DMOD(100);
break;
case LG_OVERBRAND_BRANDISH:
@@ -2818,7 +2818,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
break;
case WM_REVERBERATION_MELEE:
// ATK [{(Skill Level x 100) + 300} x Caster Base Level / 100]
- skillratio += 200 + 100 * pc_checkskill(sd, WM_REVERBERATION);
+ skillratio += 200 + 100 * iPc->checkskill(sd, WM_REVERBERATION);
RE_LVL_DMOD(100);
break;
case WM_SEVERE_RAINSTORM_MELEE:
@@ -2841,12 +2841,12 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
// ATK [( Skill Level x 50 ) + ( Cart Weight / ( 150 - Caster Base STR ))] + ( Cart Remodeling Skill Level x 50 )] %
skillratio = 50 * skill_lv;
if( sd && sd->cart_weight)
- skillratio += sd->cart_weight/10 / max(150-sstatus->str,1) + pc_checkskill(sd, GN_REMODELING_CART) * 50;
+ skillratio += sd->cart_weight/10 / max(150-sstatus->str,1) + iPc->checkskill(sd, GN_REMODELING_CART) * 50;
break;
case GN_CARTCANNON:
// ATK [{( Cart Remodeling Skill Level x 50 ) x ( INT / 40 )} + ( Cart Cannon Skill Level x 60 )] %
skillratio = 60 * skill_lv;
- if( sd ) skillratio += pc_checkskill(sd, GN_REMODELING_CART) * 50 * (sstatus->int_ / 40);
+ if( sd ) skillratio += iPc->checkskill(sd, GN_REMODELING_CART) * 50 * (sstatus->int_ / 40);
break;
case GN_SPORE_EXPLOSION:
skillratio += 200 + 100 * skill_lv;
@@ -2874,7 +2874,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
skillratio += 300; // Bombs
break;
case SO_VARETYR_SPEAR://ATK [{( Striking Level x 50 ) + ( Varetyr Spear Skill Level x 50 )} x Caster Base Level / 100 ] %
- skillratio = 50 * skill_lv + ( sd ? pc_checkskill(sd, SO_STRIKING) * 50 : 0 );
+ skillratio = 50 * skill_lv + ( sd ? iPc->checkskill(sd, SO_STRIKING) * 50 : 0 );
if( sc && sc->data[SC_BLAST_OPTION] )
skillratio += sd ? sd->status.job_level * 5 : 0;
break;
@@ -2917,7 +2917,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
skillratio += 100 * (skill_lv-1);
break;
case KO_BAKURETSU:
- skillratio = 50 * skill_lv * (sd?pc_checkskill(sd,NJ_TOBIDOUGU):10);
+ skillratio = 50 * skill_lv * (sd?iPc->checkskill(sd,NJ_TOBIDOUGU):10);
break;
case MH_NEEDLE_OF_PARALYZE:
skillratio += 600 + 100 * skill_lv;
@@ -2951,7 +2951,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
case TK_JUMPKICK:
//TK_RUN kick damage bonus.
if(sd && sd->weapontype1 == W_FIST && sd->weapontype2 == W_FIST)
- ATK_ADD(10*pc_checkskill(sd, TK_RUN));
+ ATK_ADD(10*iPc->checkskill(sd, TK_RUN));
break;
case GS_MAGICALBULLET:
if(sstatus->matk_max>sstatus->matk_min) {
@@ -2976,7 +2976,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
#endif
case HT_FREEZINGTRAP:
if(sd)
- ATK_ADD( 40 * pc_checkskill(sd, RA_RESEARCHTRAP) );
+ ATK_ADD( 40 * iPc->checkskill(sd, RA_RESEARCHTRAP) );
break;
case RA_WUGDASH ://(Caster Current Weight x 10 / 8)
if( sd && sd->weight )
@@ -2984,7 +2984,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
case RA_WUGSTRIKE:
case RA_WUGBITE:
if(sd)
- ATK_ADD(30*pc_checkskill(sd, RA_TOOTHOFWUG));
+ ATK_ADD(30*iPc->checkskill(sd, RA_TOOTHOFWUG));
break;
case SR_GATEOFHELL:
ATK_ADD (sstatus->max_hp - status_get_hp(src));
@@ -3020,7 +3020,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if( i < 5 ){
s_ele = i;
ATK_ADDRATE(100 * sd->talisman[i]);// +100% custom value.
- pc_del_talisman(sd, sd->talisman[i], i);
+ iPc->del_talisman(sd, sd->talisman[i], i);
}
}
break;
@@ -3072,7 +3072,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
sc->data[SC_SPIRIT]->val2 == SL_ASSASIN)
ATK_ADDRATE(map_flag_gvg(src->m)?25:100); //+25% dmg on woe/+100% dmg on nonwoe
- if(sd && pc_checkskill(sd,AS_SONICACCEL)>0)
+ if(sd && iPc->checkskill(sd,AS_SONICACCEL)>0)
ATK_ADDRATE(10);
break;
case CR_SHIELDBOOMERANG:
@@ -3090,7 +3090,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
ATK_RATE(i);
if( sd ) {
- if (skill_id && (i = pc_skillatk_bonus(sd, skill_id)))
+ if (skill_id && (i = iPc->skillatk_bonus(sd, skill_id)))
ATK_ADDRATE(i);
if( skill_id != PA_SACRIFICE && skill_id != MO_INVESTIGATE && skill_id != CR_GRANDCROSS && skill_id != NPC_GRANDDARKNESS && skill_id != PA_SHIELDCHAIN && !flag.cri )
@@ -3199,9 +3199,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
vit_def = def2;
#endif
if((battle->check_undead(sstatus->race,sstatus->def_ele) || sstatus->race==RC_DEMON) && //This bonus already doesnt work vs players
- src->type == BL_MOB && (temp=pc_checkskill(tsd,AL_DP)) > 0)
+ src->type == BL_MOB && (temp=iPc->checkskill(tsd,AL_DP)) > 0)
vit_def += temp*(int)(3 +(tsd->status.base_level+1)*0.04); // submitted by orn
- if( src->type == BL_MOB && (temp=pc_checkskill(tsd,RA_RANGERMAIN))>0 &&
+ if( src->type == BL_MOB && (temp=iPc->checkskill(tsd,RA_RANGERMAIN))>0 &&
(sstatus->race == RC_BRUTE || sstatus->race == RC_FISH || sstatus->race == RC_PLANT) )
vit_def += temp*5;
#ifdef RENEWAL
@@ -3278,7 +3278,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if(sc->data[SC_GT_CHANGE] && sc->data[SC_GT_CHANGE]->val2){
struct block_list *bl; // ATK increase: ATK [{(Caster DEX / 4) + (Caster STR / 2)} x Skill Level / 5]
- if( (bl = map_id2bl(sc->data[SC_GT_CHANGE]->val2)) )
+ if( (bl = iMap->id2bl(sc->data[SC_GT_CHANGE]->val2)) )
ATK_ADD( ( status_get_dex(bl)/4 + status_get_str(bl)/2 ) * sc->data[SC_GT_CHANGE]->val1 / 5 );
}
@@ -3307,7 +3307,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
skill_id != CR_GRANDCROSS)
{ //Add mastery damage
if(skill_id != ASC_BREAKER && sd->status.weapon == W_KATAR &&
- (temp=pc_checkskill(sd,ASC_KATAR)) > 0)
+ (temp=iPc->checkskill(sd,ASC_KATAR)) > 0)
{ //Adv Katar Mastery is does not applies to ASC_BREAKER,
// but other masteries DO apply >_>
ATK_ADDRATE(10+ 2*temp);
@@ -3320,14 +3320,14 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if (sc && sc->data[SC_MIRACLE]) i = 2; //Star anger
else
ARR_FIND(0, MAX_PC_FEELHATE, i, t_class == sd->hate_mob[i]);
- if (i < MAX_PC_FEELHATE && (temp=pc_checkskill(sd,sg_info[i].anger_id))) {
+ if (i < MAX_PC_FEELHATE && (temp=iPc->checkskill(sd,sg_info[i].anger_id))) {
skillratio = sd->status.base_level + sstatus->dex + sstatus->luk;
if (i == 2) skillratio += sstatus->str; //Star Anger
if (temp<4)
skillratio /= 12-3*temp;
ATK_ADDRATE(skillratio);
}
- if (skill_id == NJ_SYURIKEN && (temp = pc_checkskill(sd,NJ_TOBIDOUGU)) > 0) {
+ if (skill_id == NJ_SYURIKEN && (temp = iPc->checkskill(sd,NJ_TOBIDOUGU)) > 0) {
ATK_ADD(3*temp);
} else if (skill_id == NJ_KUNAI)
ATK_ADD(60);
@@ -3336,7 +3336,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
else if(wd.div_ < 0) //Since the attack missed...
wd.div_ *= -1;
- if(sd && (temp=pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0)
+ if(sd && (temp=iPc->checkskill(sd,BS_WEAPONRESEARCH)) > 0)
ATK_ADD(temp*2);
if(skill_id==TF_POISON)
@@ -3454,21 +3454,21 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
flag.lh=0;
} else if(flag.rh && flag.lh) { //Dual-wield
if (wd.damage) {
- if( (temp = pc_checkskill(sd,AS_RIGHT)) )
+ if( (temp = iPc->checkskill(sd,AS_RIGHT)) )
ATK_RATER(50 + (temp * 10))
- else if( (temp = pc_checkskill(sd,KO_RIGHT)) )
+ else if( (temp = iPc->checkskill(sd,KO_RIGHT)) )
ATK_RATER(70 + (temp * 10))
if(wd.damage < 1) wd.damage = 1;
}
if (wd.damage2) {
- if( (temp = pc_checkskill(sd,AS_LEFT)) )
+ if( (temp = iPc->checkskill(sd,AS_LEFT)) )
ATK_RATEL(30 + (temp * 10))
- else if( (temp = pc_checkskill(sd,KO_LEFT)) )
+ else if( (temp = iPc->checkskill(sd,KO_LEFT)) )
ATK_RATEL(50 + (temp * 10))
if(wd.damage2 < 1) wd.damage2 = 1;
}
} else if(sd->status.weapon == W_KATAR && !skill_id) { //Katars (offhand damage only applies to normal attacks, tested on Aegis 10.2)
- temp = pc_checkskill(sd,TF_DOUBLE);
+ temp = iPc->checkskill(sd,TF_DOUBLE);
wd.damage2 = wd.damage * (1 + (temp * 2))/100;
if(wd.damage && !wd.damage2) wd.damage2 = 1;
@@ -3523,7 +3523,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
rnd()%100 < tsc->data[SC_REJECTSWORD]->val2
) {
ATK_RATER(50)
- status_fix_damage(target,src,wd.damage,clif->damage(target,src,gettick(),0,0,wd.damage,0,0,0));
+ status_fix_damage(target,src,wd.damage,clif->damage(target,src,iTimer->gettick(),0,0,wd.damage,0,0,0));
clif->skill_nodamage(target,target,ST_REJECTSWORD,tsc->data[SC_REJECTSWORD]->val1,1);
if( --(tsc->data[SC_REJECTSWORD]->val3) <= 0 )
status_change_end(target, SC_REJECTSWORD, INVALID_TIMER);
@@ -3647,8 +3647,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
flag.infdef = 1;
}
- switch(skill_id)
- {
+ switch(skill_id) {
case MG_FIREWALL:
case NJ_KAENSIN:
ad.dmotion = 0; //No flinch animation.
@@ -3963,7 +3962,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
skillratio += 1900; //2000%
break;
case WM_METALICSOUND:
- skillratio += 120 * skill_lv + 60 * ( sd? pc_checkskill(sd, WM_LESSON) : 10 ) - 100;
+ skillratio += 120 * skill_lv + 60 * ( sd? iPc->checkskill(sd, WM_LESSON) : 10 ) - 100;
break;
/*case WM_SEVERE_RAINSTORM:
skillratio += 50 * skill_lv;
@@ -3974,7 +3973,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
*/
case WM_REVERBERATION_MAGIC:
// MATK [{(Skill Level x 100) + 100} x Casters Base Level / 100] %
- skillratio += 100 * (sd ? pc_checkskill(sd, WM_REVERBERATION) : 1);
+ skillratio += 100 * (sd ? iPc->checkskill(sd, WM_REVERBERATION) : 1);
RE_LVL_DMOD(100);
break;
case SO_FIREWALK:
@@ -3990,13 +3989,13 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
skillratio += sd ? sd->status.job_level / 2 : 0;
break;
case SO_EARTHGRAVE:
- skillratio = ( 200 * ( sd ? pc_checkskill(sd, SA_SEISMICWEAPON) : 10 ) + sstatus->int_ * skill_lv );
+ skillratio = ( 200 * ( sd ? iPc->checkskill(sd, SA_SEISMICWEAPON) : 10 ) + sstatus->int_ * skill_lv );
RE_LVL_DMOD(100);
if( sc && sc->data[SC_CURSED_SOIL_OPTION] )
skillratio += sc->data[SC_CURSED_SOIL_OPTION]->val2;
break;
case SO_DIAMONDDUST:
- skillratio = ( 200 * ( sd ? pc_checkskill(sd, SA_FROSTWEAPON) : 10 ) + sstatus->int_ * skill_lv );
+ skillratio = ( 200 * ( sd ? iPc->checkskill(sd, SA_FROSTWEAPON) : 10 ) + sstatus->int_ * skill_lv );
RE_LVL_DMOD(100);
if( sc && sc->data[SC_COOLER_OPTION] )
skillratio += sc->data[SC_COOLER_OPTION]->val3;
@@ -4021,7 +4020,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
}
break;
case SO_VARETYR_SPEAR: //MATK [{( Endow Tornado skill level x 50 ) + ( Caster INT x Varetyr Spear Skill level )} x Caster Base Level / 100 ] %
- skillratio = status_get_int(src) * skill_lv + ( sd ? pc_checkskill(sd, SA_LIGHTNINGLOADER) * 50 : 0 );
+ skillratio = status_get_int(src) * skill_lv + ( sd ? iPc->checkskill(sd, SA_LIGHTNINGLOADER) * 50 : 0 );
RE_LVL_DMOD(100);
if( sc && sc->data[SC_BLAST_OPTION] )
skillratio += sd ? sd->status.job_level * 5 : 0;
@@ -4110,7 +4109,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
#endif
if(sd) {
//Damage bonuses
- if ((i = pc_skillatk_bonus(sd, skill_id)))
+ if ((i = iPc->skillatk_bonus(sd, skill_id)))
ad.damage += ad.damage*i/100;
if( (i = battle->adjust_skill_damage(src->m,skill_id)) )
@@ -4286,7 +4285,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
case HT_CLAYMORETRAP:
md.damage = skill_lv * sstatus->dex * (3+status_get_lv(src)/100) * (1+sstatus->int_/35);
md.damage += md.damage * (rnd()%20-10) / 100;
- md.damage += 40 * (sd?pc_checkskill(sd,RA_RESEARCHTRAP):0);
+ md.damage += 40 * (sd?iPc->checkskill(sd,RA_RESEARCHTRAP):0);
break;
#else
case HT_LANDMINE:
@@ -4303,7 +4302,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
case HT_BLITZBEAT:
case SN_FALCONASSAULT:
//Blitz-beat Damage.
- if(!sd || (temp = pc_checkskill(sd,HT_STEELCROW)) <= 0)
+ if(!sd || (temp = iPc->checkskill(sd,HT_STEELCROW)) <= 0)
temp=0;
md.damage=(sstatus->dex/10+sstatus->int_/2+temp*3+40)*2;
if(mflag > 1) //Autocasted Blitz.
@@ -4324,7 +4323,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
case BA_DISSONANCE:
md.damage=30+skill_lv*10;
if (sd)
- md.damage+= 3*pc_checkskill(sd,BA_MUSICALLESSON);
+ md.damage+= 3*iPc->checkskill(sd,BA_MUSICALLESSON);
break;
case NPC_SELFDESTRUCTION:
md.damage = sstatus->hp;
@@ -4383,7 +4382,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
case RK_DRAGONBREATH:
md.damage = ((status_get_hp(src) / 50) + (status_get_max_sp(src) / 4)) * skill_lv;
RE_LVL_MDMOD(150);
- if (sd) md.damage = md.damage * (100 + 5 * (pc_checkskill(sd,RK_DRAGONTRAINING) - 1)) / 100;
+ if (sd) md.damage = md.damage * (100 + 5 * (iPc->checkskill(sd,RK_DRAGONTRAINING) - 1)) / 100;
md.flag |= BF_LONG|BF_WEAPON;
break;
/**
@@ -4396,7 +4395,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
RE_LVL_TMDMOD();
if(sd)
{
- int researchskill_lv = pc_checkskill(sd,RA_RESEARCHTRAP);
+ int researchskill_lv = iPc->checkskill(sd,RA_RESEARCHTRAP);
if(researchskill_lv)
md.damage = md.damage * 20 * researchskill_lv / (skill_id == RA_CLUSTERBOMB?50:100);
else
@@ -4411,7 +4410,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
case NC_SELFDESTRUCTION:
{
short totaldef = tstatus->def2 + (short)status_get_def(target);
- md.damage = ( (sd?pc_checkskill(sd,NC_MAINFRAME):10) + 8 ) * ( skill_lv + 1 ) * ( status_get_sp(src) + sstatus->vit );
+ md.damage = ( (sd?iPc->checkskill(sd,NC_MAINFRAME):10) + 8 ) * ( skill_lv + 1 ) * ( status_get_sp(src) + sstatus->vit );
RE_LVL_MDMOD(100);
md.damage += status_get_hp(src) - totaldef;
}
@@ -4421,7 +4420,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
break;
case GN_HELLS_PLANT_ATK:
//[{( Hell Plant Skill Level x Casters Base Level ) x 10 } + {( Casters INT x 7 ) / 2 } x { 18 + ( Casters Job Level / 4 )] x ( 5 / ( 10 - Summon Flora Skill Level ))
- md.damage = ( skill_lv * status_get_lv(src) * 10 ) + ( sstatus->int_ * 7 / 2 ) * ( 18 + (sd?sd->status.job_level:0) / 4 ) * ( 5 / (10 - (sd?pc_checkskill(sd,AM_CANNIBALIZE):0)) );
+ md.damage = ( skill_lv * status_get_lv(src) * 10 ) + ( sstatus->int_ * 7 / 2 ) * ( 18 + (sd?sd->status.job_level:0) / 4 ) * ( 5 / (10 - (sd?iPc->checkskill(sd,AM_CANNIBALIZE):0)) );
break;
case KO_HAPPOKUNAI:
{
@@ -4476,7 +4475,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
hitrate+= sstatus->hit - flee;
#ifdef RENEWAL
if( sd ) //in Renewal hit bonus from Vultures Eye is not anymore shown in status window
- hitrate += pc_checkskill(sd,AC_VULTURE);
+ hitrate += iPc->checkskill(sd,AC_VULTURE);
#endif
hitrate = cap_value(hitrate, battle_config.min_hitrate, battle_config.max_hitrate);
@@ -4509,7 +4508,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
#endif
md.damage = battle->calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag);
- if (sd && (i = pc_skillatk_bonus(sd, skill_id)))
+ if (sd && (i = iPc->skillatk_bonus(sd, skill_id)))
md.damage += md.damage*i/100;
if( (i = battle->adjust_skill_damage(src->m,skill_id)) )
@@ -4560,7 +4559,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
if( sd ) {
if ( md.damage > sd->status.zeny )
md.damage = sd->status.zeny;
- pc_payzeny(sd, md.damage,LOG_TYPE_STEAL,NULL);
+ iPc->payzeny(sd, md.damage,LOG_TYPE_STEAL,NULL);
}
break;
}
@@ -4633,9 +4632,9 @@ int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int
if (ratio > 5000) ratio = 5000; // Maximum of 5000% ATK
rdamage = rdamage * ratio / 100 + (*dmg) * (10 + sc->data[SC_CRESCENTELBOW]->val1 * 20 / 10) / 10;
skill->blown(bl, src, skill->get_blewcount(SR_CRESCENTELBOW_AUTOSPELL, sc->data[SC_CRESCENTELBOW]->val1), unit_getdir(src), 0);
- clif->skill_damage(bl, src, gettick(), status_get_amotion(src), 0, rdamage,
+ clif->skill_damage(bl, src, iTimer->gettick(), status_get_amotion(src), 0, rdamage,
1, SR_CRESCENTELBOW_AUTOSPELL, sc->data[SC_CRESCENTELBOW]->val1, 6); // This is how official does
- clif->damage(src, bl, gettick(), status_get_amotion(src)+1000, 0, rdamage/10, 1, 0, 0);
+ clif->damage(src, bl, iTimer->gettick(), status_get_amotion(src)+1000, 0, rdamage/10, 1, 0, 0);
status_damage(src, bl, status_damage(bl, src, rdamage, 0, 0, 1)/10, 0, 0, 1);
status_change_end(bl, SC_CRESCENTELBOW, INVALID_TIMER);
return 0; // Just put here to minimize redundancy
@@ -4650,14 +4649,14 @@ int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int
if (rdamage < 1) rdamage = 1;
}
if(sc->data[SC_DEATHBOUND] && skill_id != WS_CARTTERMINATION && !(src->type == BL_MOB && is_boss(src)) ) {
- uint8 dir = map_calc_dir(bl,src->x,src->y),
+ uint8 dir = iMap->calc_dir(bl,src->x,src->y),
t_dir = unit_getdir(bl);
- if( distance_bl(src,bl) <= 0 || !map_check_dir(dir,t_dir) ) {
+ if( distance_bl(src,bl) <= 0 || !iMap->check_dir(dir,t_dir) ) {
int rd1 = 0;
rd1 = min(damage,status_get_max_hp(bl)) * sc->data[SC_DEATHBOUND]->val2 / 100; // Amplify damage.
*dmg = rd1 * 30 / 100; // Received damage = 30% of amplifly damage.
- clif->skill_damage(src,bl,gettick(), status_get_amotion(src), 0, -30000, 1, RK_DEATHBOUND, sc->data[SC_DEATHBOUND]->val1,6);
+ clif->skill_damage(src,bl,iTimer->gettick(), status_get_amotion(src), 0, -30000, 1, RK_DEATHBOUND, sc->data[SC_DEATHBOUND]->val1,6);
status_change_end(bl,SC_DEATHBOUND,INVALID_TIMER);
rdamage += rd1;
if (rdamage < 1) rdamage = 1;
@@ -4743,7 +4742,7 @@ int battle_damage_area( struct block_list *bl, va_list ap) {
if( bl->type == BL_MOB && ((TBL_MOB*)bl)->class_ == MOBID_EMPERIUM )
return 0;
if( bl != src && battle->check_target(src,bl,BCT_ENEMY) > 0 ) {
- map_freeblock_lock();
+ iMap->freeblock_lock();
if( src->type == BL_PC )
battle->drain((TBL_PC*)src, bl, damage, damage, status_get_race(bl), is_boss(bl));
if( amotion )
@@ -4753,7 +4752,7 @@ int battle_damage_area( struct block_list *bl, va_list ap) {
clif->damage(bl,bl,tick,amotion,dmotion,damage,1,ATK_BLOCK,0);
if( !(src && src->type == BL_PC && ((TBL_PC*)src)->state.autocast) )
skill->additional_effect(src, bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
}
return 0;
@@ -4834,10 +4833,10 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
if( tsc && tsc->data[SC_AUTOCOUNTER] && status_check_skilluse(target, src, KN_AUTOCOUNTER, 1) )
{
- uint8 dir = map_calc_dir(target,src->x,src->y);
+ uint8 dir = iMap->calc_dir(target,src->x,src->y);
int t_dir = unit_getdir(target);
int dist = distance_bl(src, target);
- if(dist <= 0 || (!map_check_dir(dir,t_dir) && dist <= tstatus->rhw.range+1))
+ if(dist <= 0 || (!iMap->check_dir(dir,t_dir) && dist <= tstatus->rhw.range+1))
{
uint16 skill_lv = tsc->data[SC_AUTOCOUNTER]->val1;
clif->skillcastcancel(target); //Remove the casting bar. [Skotlex]
@@ -4853,7 +4852,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
uint16 skill_lv = tsc->data[SC_BLADESTOP_WAIT]->val1;
int duration = skill->get_time2(MO_BLADESTOP,skill_lv);
status_change_end(target, SC_BLADESTOP_WAIT, INVALID_TIMER);
- if(sc_start4(src, SC_BLADESTOP, 100, sd?pc_checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration))
+ if(sc_start4(src, SC_BLADESTOP, 100, sd?iPc->checkskill(sd, MO_BLADESTOP):5, 0, 0, target->id, duration))
{ //Target locked.
clif->damage(src, target, tick, sstatus->amotion, 1, 0, 1, 0, 0); //Display MISS.
clif->bladestop(target, src->id, 1);
@@ -4862,7 +4861,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
}
- if(sd && (skillv = pc_checkskill(sd,MO_TRIPLEATTACK)) > 0) {
+ if(sd && (skillv = iPc->checkskill(sd,MO_TRIPLEATTACK)) > 0) {
int triple_rate= 30 - skillv; //Base Rate
if (sc && sc->data[SC_SKILLRATE_UP] && sc->data[SC_SKILLRATE_UP]->val1 == MO_TRIPLEATTACK) {
triple_rate+= triple_rate*(sc->data[SC_SKILLRATE_UP]->val2)/100;
@@ -4901,13 +4900,13 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
if( sc->data[SC_GT_ENERGYGAIN] ) {
if( sd && rnd()%100 < 10 + 5 * sc->data[SC_GT_ENERGYGAIN]->val1)
- pc_addspiritball(sd,
+ iPc->addspiritball(sd,
skill->get_time(MO_CALLSPIRITS, sc->data[SC_GT_ENERGYGAIN]->val1),
sc->data[SC_GT_ENERGYGAIN]->val1);
}
if( tsc && tsc->data[SC_GT_ENERGYGAIN] ) {
if( tsd && rnd()%100 < 10 + 5 * tsc->data[SC_GT_ENERGYGAIN]->val1)
- pc_addspiritball(tsd,
+ iPc->addspiritball(tsd,
skill->get_time(MO_CALLSPIRITS, tsc->data[SC_GT_ENERGYGAIN]->val1),
tsc->data[SC_GT_ENERGYGAIN]->val1);
}
@@ -4921,7 +4920,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
if(tsc && tsc->data[SC_KAAHI] && tsc->data[SC_KAAHI]->val4 == INVALID_TIMER && tstatus->hp < tstatus->max_hp)
- tsc->data[SC_KAAHI]->val4 = add_timer(tick + skill->get_time2(SL_KAAHI,tsc->data[SC_KAAHI]->val1), kaahi_heal_timer, target->id, SC_KAAHI); //Activate heal.
+ tsc->data[SC_KAAHI]->val4 = iTimer->add_timer(tick + skill->get_time2(SL_KAAHI,tsc->data[SC_KAAHI]->val1), kaahi_heal_timer, target->id, SC_KAAHI); //Activate heal.
wd = battle->calc_attack(BF_WEAPON, src, target, 0, 0, flag);
@@ -4941,7 +4940,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
wd.damage *= 3; // Triple Damage
if( sd && sc->data[SC_FEARBREEZE] && sc->data[SC_FEARBREEZE]->val4 > 0 && sd->status.inventory[sd->equip_index[EQI_AMMO]].amount >= sc->data[SC_FEARBREEZE]->val4 && battle_config.arrow_decrement){
- pc_delitem(sd,sd->equip_index[EQI_AMMO],sc->data[SC_FEARBREEZE]->val4,0,1,LOG_TYPE_CONSUME);
+ iPc->delitem(sd,sd->equip_index[EQI_AMMO],sc->data[SC_FEARBREEZE]->val4,0,1,LOG_TYPE_CONSUME);
sc->data[SC_FEARBREEZE]->val4 = 0;
}
}
@@ -4964,7 +4963,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
if( rdamage > 0 ) {
if( tsc && tsc->data[SC_REFLECTDAMAGE] ) {
if( src != target ) {// Don't reflect your own damage (Grand Cross)
- map_foreachinshootrange(battle->damage_area,target,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,wd.amotion,wd.dmotion,rdamage,tstatus->race);
+ iMap->foreachinshootrange(battle->damage_area,target,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,wd.amotion,wd.dmotion,rdamage,tstatus->race);
}
} else {
rdelay = clif->damage(src, src, tick, wd.amotion, sstatus->dmotion, rdamage, 1, 4, 0);
@@ -4983,20 +4982,20 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
if( su->group && su->group->skill_id == HT_BLASTMINE)
skill->blown(src, target, 3, -1, 0);
}
- map_freeblock_lock();
+ iMap->freeblock_lock();
battle->delay_damage(tick, wd.amotion, src, target, wd.flag, 0, 0, damage, wd.dmg_lv, wd.dmotion, true);
if( tsc ) {
if( tsc->data[SC_DEVOTION] ) {
struct status_change_entry *sce = tsc->data[SC_DEVOTION];
- struct block_list *d_bl = map_id2bl(sce->val1);
+ struct block_list *d_bl = iMap->id2bl(sce->val1);
if( d_bl && (
(d_bl->type == BL_MER && ((TBL_MER*)d_bl)->master && ((TBL_MER*)d_bl)->master->bl.id == target->id) ||
(d_bl->type == BL_PC && ((TBL_PC*)d_bl)->devotion[sce->val2] == target->id)
) && check_distance_bl(target, d_bl, sce->val3) )
{
- clif->damage(d_bl, d_bl, gettick(), 0, 0, damage, 0, 0, 0);
+ clif->damage(d_bl, d_bl, iTimer->gettick(), 0, 0, damage, 0, 0, 0);
status_fix_damage(NULL, d_bl, damage, 0);
}
else
@@ -5008,13 +5007,13 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
skill->attack(BF_MAGIC,&ed->bl,&ed->bl,src,EL_CIRCLE_OF_FIRE,tsc->data[SC_CIRCLE_OF_FIRE_OPTION]->val1,tick,wd.flag);
}
} else if( tsc->data[SC_WATER_SCREEN_OPTION] && tsc->data[SC_WATER_SCREEN_OPTION]->val1 ) {
- struct block_list *e_bl = map_id2bl(tsc->data[SC_WATER_SCREEN_OPTION]->val1);
+ struct block_list *e_bl = iMap->id2bl(tsc->data[SC_WATER_SCREEN_OPTION]->val1);
if( e_bl && !status_isdead(e_bl) ) {
clif->damage(e_bl,e_bl,tick,wd.amotion,wd.dmotion,damage,wd.div_,wd.type,wd.damage2);
status_damage(target,e_bl,damage,0,0,0);
// Just show damage in target.
clif->damage(src, target, tick, wd.amotion, wd.dmotion, damage, wd.div_, wd.type, wd.damage2 );
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return ATK_NONE;
}
}
@@ -5079,7 +5078,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
if( type != CAST_GROUND ){
clif->skill_fail(sd,r_skill,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return wd.dmg_lv;
}
}
@@ -5136,7 +5135,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
status_change_end(target, SC_POISONREACT, INVALID_TIMER);
}
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return wd.dmg_lv;
}
@@ -5170,7 +5169,7 @@ struct block_list* battle_get_master(struct block_list *src)
break;
case BL_MOB:
if (((TBL_MOB*)src)->master_id)
- src = map_id2bl(((TBL_MOB*)src)->master_id);
+ src = iMap->id2bl(((TBL_MOB*)src)->master_id);
break;
case BL_HOM:
if (((TBL_HOM*)src)->master)
@@ -5186,7 +5185,7 @@ struct block_list* battle_get_master(struct block_list *src)
break;
case BL_SKILL:
if (((TBL_SKILL*)src)->group && ((TBL_SKILL*)src)->group->src_id)
- src = map_id2bl(((TBL_SKILL*)src)->group->src_id);
+ src = iMap->id2bl(((TBL_SKILL*)src)->group->src_id);
break;
}
} while (src && src != prev);
@@ -5349,7 +5348,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
{
struct mob_data *md = BL_CAST(BL_MOB, t_bl);
- if( !((agit_flag || agit2_flag) && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
+ if( !((iMap->agit_flag || iMap->agit2_flag) && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
return 0; // Disable guardians/emperiums owned by Guilds on non-woe times.
break;
}
@@ -5412,7 +5411,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
case BL_MOB:
{
struct mob_data *md = BL_CAST(BL_MOB, s_bl);
- if( !((agit_flag || agit2_flag) && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
+ if( !((iMap->agit_flag || iMap->agit2_flag) && map[m].flag.gvg_castle) && md->guardian_data && md->guardian_data->guild_id )
return 0; // Disable guardians/emperium owned by Guilds on non-woe times.
if( !md->special_state.ai )
@@ -5820,7 +5819,6 @@ static const struct _battle_data {
{ "mobs_level_up_exp_rate", &battle_config.mobs_level_up_exp_rate, 1, 1, INT_MAX, },
{ "pk_min_level", &battle_config.pk_min_level, 55, 1, INT_MAX, },
{ "skill_steal_max_tries", &battle_config.skill_steal_max_tries, 0, 0, UCHAR_MAX, },
- { "motd_type", &battle_config.motd_type, 0, 0, 1, },
{ "finding_ore_rate", &battle_config.finding_ore_rate, 100, 0, INT_MAX, },
{ "exp_calc_type", &battle_config.exp_calc_type, 0, 0, 1, },
{ "exp_bonus_attacker", &battle_config.exp_bonus_attacker, 25, 0, INT_MAX, },
@@ -6028,7 +6026,7 @@ void Hercules_report(char* date, char *time_c) {
#endif
/* non-define part */
- if( db_use_sqldbs )
+ if( iMap->db_use_sqldbs )
config |= C_SQL_DBS;
if( logs->config.sql_logs )
@@ -6063,7 +6061,7 @@ void Hercules_report(char* date, char *time_c) {
safestrncpy((char*)WBUFP(buf,6 + 12 + 9), timestring, 24);
safestrncpy((char*)WBUFP(buf,6 + 12 + 9 + 24), git[0] != HERC_UNKNOWN_VER ? git : svn[0] != HERC_UNKNOWN_VER ? svn : "Unknown", 41);
- WBUFL(buf,6 + 12 + 9 + 24 + 41) = map_getusers();
+ WBUFL(buf,6 + 12 + 9 + 24 + 41) = iMap->getusers();
WBUFL(buf,6 + 12 + 9 + 24 + 41 + 4) = config;
WBUFL(buf,6 + 12 + 9 + 24 + 41 + 4 + 4) = bd_size;
@@ -6207,11 +6205,11 @@ int battle_config_read(const char* cfgName)
void do_init_battle(void) {
delay_damage_ers = ers_new(sizeof(struct delay_damage),"battle.c::delay_damage_ers",ERS_OPT_CLEAR);
- add_timer_func_list(battle_delay_damage_sub, "battle_delay_damage_sub");
+ iTimer->add_timer_func_list(battle_delay_damage_sub, "battle_delay_damage_sub");
#ifndef STATS_OPT_OUT
- add_timer_func_list(Hercules_report_timer, "Hercules_report_timer");
- add_timer_interval(gettick()+30000, Hercules_report_timer, 0, 0, 60000 * 30);
+ iTimer->add_timer_func_list(Hercules_report_timer, "Hercules_report_timer");
+ iTimer->add_timer_interval(iTimer->gettick()+30000, Hercules_report_timer, 0, 0, 60000 * 30);
#endif
}
@@ -6223,8 +6221,12 @@ void do_final_battle(void) {
/* initialize the interface */
void battle_defaults(void) {
battle = &battle_s;
+
+ battle->bc = &battle_config;
+
battle->init = do_init_battle;
battle->final = do_final_battle;
+
battle->calc_attack = battle_calc_attack;
battle->calc_damage = battle_calc_damage;
battle->calc_gvg_damage = battle_calc_gvg_damage;
diff --git a/src/map/battle.h b/src/map/battle.h
index 0975d978d..36796c516 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -322,7 +322,6 @@ struct Battle_Config {
int mobs_level_up_exp_rate; // [Valaris]
int pk_min_level; // [celest]
int skill_steal_max_tries; //max steal skill tries on a mob. if 0, then w/o limit [Lupus]
- int motd_type; // [celest]
int finding_ore_rate; // orn
int exp_calc_type;
int exp_bonus_attacker;
@@ -464,6 +463,8 @@ extern int attr_fix_table[4][10][10];
* Battle.c Interface
**/
struct battle_interface {
+ /* */
+ struct Battle_Config *bc;
/* init */
void (*init) (void);
/* final */
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 618679406..47fef4376 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -9,6 +9,7 @@
#include "../common/showmsg.h"
#include "../common/socket.h"
#include "../common/strlib.h"
+#include "../common/conf.h"
#include "battleground.h"
#include "battle.h"
@@ -16,6 +17,7 @@
#include "map.h"
#include "npc.h"
#include "pc.h"
+#include "party.h"
#include "pet.h"
#include "homunculus.h"
#include "mercenary.h"
@@ -26,14 +28,12 @@
static DBMap* bg_team_db; // int bg_id -> struct battleground_data*
static unsigned int bg_team_counter = 0; // Next bg_id
-struct battleground_data* bg_team_search(int bg_id)
-{ // Search a BG Team using bg_id
+struct battleground_data* bg_team_search(int bg_id) { // Search a BG Team using bg_id
if( !bg_id ) return NULL;
return (struct battleground_data *)idb_get(bg_team_db, bg_id);
}
-struct map_session_data* bg_getavailablesd(struct battleground_data *bg)
-{
+struct map_session_data* bg_getavailablesd(struct battleground_data *bg) {
int i;
nullpo_retr(NULL, bg);
ARR_FIND(0, MAX_BG_MEMBERS, i, bg->members[i].sd != NULL);
@@ -65,7 +65,7 @@ int bg_team_warp(int bg_id, unsigned short mapindex, short x, short y)
struct battleground_data *bg = bg_team_search(bg_id);
if( bg == NULL ) return 0;
for( i = 0; i < MAX_BG_MEMBERS; i++ )
- if( bg->members[i].sd != NULL ) pc_setpos(bg->members[i].sd, mapindex, x, y, CLR_TELEPORT);
+ if( bg->members[i].sd != NULL ) iPc->setpos(bg->members[i].sd, mapindex, x, y, CLR_TELEPORT);
return 1;
}
@@ -95,8 +95,7 @@ int bg_team_join(int bg_id, struct map_session_data *sd)
guild->send_dot_remove(sd);
- for( i = 0; i < MAX_BG_MEMBERS; i++ )
- {
+ for( i = 0; i < MAX_BG_MEMBERS; i++ ) {
if( (pl_sd = bg->members[i].sd) != NULL && pl_sd != sd )
clif->hpmeter_single(sd->fd, pl_sd->bl.id, pl_sd->battle_status.hp, pl_sd->battle_status.max_hp);
}
@@ -146,14 +145,13 @@ int bg_member_respawn(struct map_session_data *sd)
return 0;
if( bg->mapindex == 0 )
return 0; // Respawn not handled by Core
- pc_setpos(sd, bg->mapindex, bg->x, bg->y, CLR_OUTSIGHT);
+ iPc->setpos(sd, bg->mapindex, bg->x, bg->y, CLR_OUTSIGHT);
status_revive(&sd->bl, 1, 100);
return 1; // Warped
}
-int bg_create(unsigned short mapindex, short rx, short ry, const char *ev, const char *dev)
-{
+int bg_create(unsigned short mapindex, short rx, short ry, const char *ev, const char *dev) {
struct battleground_data *bg;
bg_team_counter++;
@@ -187,7 +185,7 @@ int bg_team_get_id(struct block_list *bl)
{
struct map_session_data *msd;
struct mob_data *md = (TBL_MOB*)bl;
- if( md->special_state.ai && (msd = map_id2sd(md->master_id)) != NULL )
+ if( md->special_state.ai && (msd = iMap->id2sd(md->master_id)) != NULL )
return msd->bg_id;
return md->bg_id;
}
@@ -222,16 +220,14 @@ int bg_send_message(struct map_session_data *sd, const char *mes, int len)
*/
int bg_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
{
- struct battleground_data *bg = DB->data2ptr(data);
+ struct battleground_data *bg = iDB->data2ptr(data);
struct map_session_data *sd;
int i;
nullpo_ret(bg);
- for( i = 0; i < MAX_BG_MEMBERS; i++ )
- {
+ for( i = 0; i < MAX_BG_MEMBERS; i++ ) {
if( (sd = bg->members[i].sd) == NULL )
continue;
- if( sd->bl.x != bg->members[i].x || sd->bl.y != bg->members[i].y )
- { // xy update
+ if( sd->bl.x != bg->members[i].x || sd->bl.y != bg->members[i].y ) { // xy update
bg->members[i].x = sd->bl.x;
bg->members[i].y = sd->bl.y;
clif->bg_xy(sd);
@@ -240,20 +236,496 @@ int bg_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
return 0;
}
-int bg_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
+int bg_send_xy_timer(int tid, unsigned int tick, int id, intptr_t data) {
bg_team_db->foreach(bg_team_db, bg_send_xy_timer_sub, tick);
return 0;
}
+void bg_config_read(void) {
+ config_t bg_conf;
+ config_setting_t *data = NULL;
+ const char *config_filename = "conf/battlegrounds.conf"; // FIXME hardcoded name
+
+ if (conf_read_file(&bg_conf, config_filename))
+ return;
+
+ data = config_lookup(&bg_conf, "battlegrounds");
+
+ if (data != NULL) {
+ config_setting_t *settings = config_setting_get_elem(data, 0);
+ config_setting_t *arenas;
+ const char *delay_var;
+ int i, arena_count = 0, total = 0, offline = 0;
+
+ if( !config_setting_lookup_string(settings, "global_delay_var", &delay_var) )
+ delay_var = "BG_Delay_Tick";
+
+ safestrncpy(bg->gdelay_var, delay_var, BG_DELAY_VAR_LENGTH);
+
+ config_setting_lookup_int(settings, "maximum_afk_seconds", &bg->mafksec);
+
+ config_setting_lookup_bool(settings, "feature_off", &offline);
+
+ if( offline == 0 )
+ bg->queue_on = true;
+
+ if( (arenas = config_setting_get_member(settings, "arenas")) != NULL ) {
+ arena_count = config_setting_length(arenas);
+ CREATE( bg->arena, struct bg_arena *, arena_count );
+ for(i = 0; i < arena_count; i++) {
+ config_setting_t *arena = config_setting_get_elem(arenas, i);
+ config_setting_t *reward;
+ const char *aName, *aEvent, *aDelayVar;
+ int minLevel = 0, maxLevel = 0;
+ int prizeWin, prizeLoss, prizeDraw;
+ int minPlayers, maxPlayers, minTeamPlayers;
+ int maxDuration;
+ int fillup_duration, pregame_duration;
+
+ bg->arena[i] = NULL;
+
+ if( !config_setting_lookup_string(arena, "name", &aName) ) {
+ ShowError("bg_config_read: failed to find 'name' for arena #%d\n",i);
+ continue;
+ }
+
+ if( !config_setting_lookup_string(arena, "event", &aEvent) ) {
+ ShowError("bg_config_read: failed to find 'event' for arena #%d\n",i);
+ continue;
+ }
+
+ config_setting_lookup_int(arena, "minLevel", &minLevel);
+ config_setting_lookup_int(arena, "maxLevel", &maxLevel);
+
+ if( minLevel < 0 ) {
+ ShowWarning("bg_config_read: invalid %d value for arena '%s' minLevel\n",minLevel,aName);
+ minLevel = 0;
+ }
+ if( maxLevel > MAX_LEVEL ) {
+ ShowWarning("bg_config_read: invalid %d value for arena '%s' maxLevel\n",maxLevel,aName);
+ maxLevel = MAX_LEVEL;
+ }
+
+ if( !(reward = config_setting_get_member(settings, "reward")) ) {
+ ShowError("bg_config_read: failed to find 'reward' for arena '%s'/#%d\n",aName,i);
+ continue;
+ }
+
+ config_setting_lookup_int(reward, "win", &prizeWin);
+ config_setting_lookup_int(reward, "loss", &prizeLoss);
+ config_setting_lookup_int(reward, "draw", &prizeDraw);
+
+ if( prizeWin < 0 ) {
+ ShowWarning("bg_config_read: invalid %d value for arena '%s' reward:win\n",prizeWin,aName);
+ prizeWin = 0;
+ }
+ if( prizeLoss < 0 ) {
+ ShowWarning("bg_config_read: invalid %d value for arena '%s' reward:loss\n",prizeLoss,aName);
+ prizeLoss = 0;
+ }
+ if( prizeDraw < 0 ) {
+ ShowWarning("bg_config_read: invalid %d value for arena '%s' reward:draw\n",prizeDraw,aName);
+ prizeDraw = 0;
+ }
+
+ config_setting_lookup_int(arena, "minPlayers", &minPlayers);
+ config_setting_lookup_int(arena, "maxPlayers", &maxPlayers);
+ config_setting_lookup_int(arena, "minTeamPlayers", &minTeamPlayers);
+
+ if( minPlayers < 0 ) {
+ ShowWarning("bg_config_read: invalid %d value for arena '%s' minPlayers\n",minPlayers,aName);
+ minPlayers = 0;
+ }
+ if( maxPlayers > MAX_BG_MEMBERS * 2 ) {
+ ShowWarning("bg_config_read: invalid %d value for arena '%s' maxPlayers, change #define MAX_BG_MEMBERS\n",maxPlayers,aName);
+ maxPlayers = 0;
+ }
+ if( minTeamPlayers < 0 ) {
+ ShowWarning("bg_config_read: invalid %d value for arena '%s' minTeamPlayers\n",minTeamPlayers,aName);
+ minTeamPlayers = 0;
+ }
+
+ if( !config_setting_lookup_string(arena, "delay_var", &aDelayVar) ) {
+ ShowError("bg_config_read: failed to find 'delay_var' for arena '%s'/#%d\n",aName,i);
+ continue;
+ }
+
+ config_setting_lookup_int(arena, "maxDuration", &maxDuration);
+
+ if( maxDuration < 0 ) {
+ ShowWarning("bg_config_read: invalid %d value for arena '%s' maxDuration\n",maxDuration,aName);
+ maxDuration = 30;
+ }
+
+ config_setting_lookup_int(arena, "fillDuration", &fillup_duration);
+ config_setting_lookup_int(arena, "pGameDuration", &pregame_duration);
+
+ if( fillup_duration < 20 ) {
+ ShowWarning("bg_config_read: invalid %d value for arena '%s' fillDuration, minimum has to be 20, defaulting to 20.\n",fillup_duration,aName);
+ fillup_duration = 20;
+ }
+
+ if( pregame_duration < 20 ) {
+ ShowWarning("bg_config_read: invalid %d value for arena '%s' pGameDuration, minimum has to be 20, defaulting to 20.\n",pregame_duration,aName);
+ pregame_duration = 20;
+ }
+
+
+ CREATE( bg->arena[i], struct bg_arena, 1 );
+
+ bg->arena[i]->id = i;
+ safestrncpy(bg->arena[i]->name, aName, NAME_LENGTH);
+ safestrncpy(bg->arena[i]->npc_event, aEvent, EVENT_NAME_LENGTH);
+ bg->arena[i]->min_level = minLevel;
+ bg->arena[i]->max_level = maxLevel;
+ bg->arena[i]->prize_win = prizeWin;
+ bg->arena[i]->prize_loss = prizeLoss;
+ bg->arena[i]->prize_draw = prizeDraw;
+ bg->arena[i]->min_players = minPlayers;
+ bg->arena[i]->max_players = maxPlayers;
+ bg->arena[i]->min_team_players = minTeamPlayers;
+ safestrncpy(bg->arena[i]->delay_var, aDelayVar, NAME_LENGTH);
+ bg->arena[i]->maxDuration = maxDuration;
+ bg->arena[i]->queue_id = -1;
+ bg->arena[i]->begin_timer = INVALID_TIMER;
+ bg->arena[i]->fillup_timer = INVALID_TIMER;
+ bg->arena[i]->pregame_duration = pregame_duration;
+ bg->arena[i]->fillup_duration = fillup_duration;
+
+ total++;
+ }
+ bg->arenas = arena_count;
+ }
+
+ ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' arenas in '"CL_WHITE"%s"CL_RESET"'.\n", total, config_filename);
+ config_destroy(&bg_conf);
+ }
+}
+struct bg_arena *bg_name2arena (char *name) {
+ int i;
+ for(i = 0; i < bg->arenas; i++) {
+ if( strcmpi(bg->arena[i]->name,name) == 0 )
+ return bg->arena[i];
+ }
+ return NULL;
+}
+int bg_id2pos ( int queue_id, int account_id ) {
+ struct hQueue *queue = script->queue(queue_id);
+ if( queue ) {
+ int i;
+ for(i = 0; i < queue->items; i++ ) {
+ if( queue->item[i] == account_id ) {
+ return i;
+ }
+ }
+ }
+ return 0;
+}
+void bg_queue_player_cleanup(struct map_session_data *sd) {
+ if ( sd->bg_queue.client_has_bg_data ) {
+ clif->bgqueue_notice_delete(sd,BGQND_CLOSEWINDOW, sd->bg_queue.arena->id);
+ }
+ script->queue_remove(sd->bg_queue.arena->queue_id,sd->status.account_id);
+ sd->bg_queue.arena = NULL;
+ sd->bg_queue.ready = 0;
+ sd->bg_queue.client_has_bg_data = 0;
+ sd->bg_queue.type = 0;
+}
+void bg_match_over(struct bg_arena *arena, bool canceled) {
+ struct hQueue *queue = &script->hq[arena->queue_id];
+ int i;//, count = 0;
+
+ /* if( !canceled ) <check time/score> */
+
+ for( i = 0; i < queue->items; i++ ) {
+ struct map_session_data * sd = NULL;
+
+ if( ( sd = iMap->id2sd(queue->item[i]) ) ) {
+ bg->queue_pc_cleanup(sd);
+ clif->colormes(sd->fd,COLOR_RED,"BG Match Cancelled: not enough players");
+ }
+ }
-void do_init_battleground(void)
-{
+ bg->arena[i]->begin_timer = INVALID_TIMER;
+ bg->arena[i]->fillup_timer = INVALID_TIMER;
+ /* reset queue */
+}
+void bg_begin(struct bg_arena *arena) {
+ struct hQueue *queue = &script->hq[arena->queue_id];
+ int i, count = 0;
+
+ for( i = 0; i < queue->items; i++ ) {
+ struct map_session_data * sd = NULL;
+
+ if( ( sd = iMap->id2sd(queue->item[i]) ) ) {
+ if( sd->bg_queue.ready == 1 )
+ count++;
+ else
+ bg->queue_pc_cleanup(sd);
+ }
+ }
+
+ if( count < arena->min_players ) {
+ bg_match_over(arena,true);
+ } else {
+ ;
+ /* we split evenly? */
+ /* but if a party of say 10 joins, it cant be split evenly unless by luck there are 10 soloers in the queue besides them */
+ /* not sure how to split T_T needs more info */
+ }
+}
+int bg_begin_timer(int tid, unsigned int tick, int id, intptr_t data) {
+ bg->begin(bg->arena[id]);
+ return 0;
+}
+
+void bg_queue_pregame(struct bg_arena *arena) {
+ struct hQueue *queue = &script->hq[arena->queue_id];
+ int i;
+
+ for( i = 0; i < queue->items; i++ ) {
+ struct map_session_data * sd = NULL;
+
+ if( ( sd = iMap->id2sd(queue->item[i]) ) ) {
+ clif->bgqueue_battlebegins(sd,arena->id,SELF);
+ }
+ }
+ arena->begin_timer = iTimer->add_timer( iTimer->gettick() + (arena->pregame_duration*1000), bg->begin_timer, arena->id, 0 );
+}
+int bg_fillup_timer(int tid, unsigned int tick, int id, intptr_t data) {
+ bg->queue_pregame(bg->arena[id]);
+ return 0;
+}
+
+void bg_queue_check(struct bg_arena *arena) {
+ int count = script->hq[arena->queue_id].items;
+
+ if( count == arena->max_players ) {
+ if( arena->fillup_timer != INVALID_TIMER ) {
+ iTimer->delete_timer(arena->fillup_timer,bg_fillup_timer);
+ arena->fillup_timer = INVALID_TIMER;
+ }
+ bg->queue_pregame(arena);
+ } else if( count >= arena->min_players && arena->fillup_timer == INVALID_TIMER ) {
+ arena->fillup_timer = iTimer->add_timer( iTimer->gettick() + (arena->fillup_duration*1000), bg->fillup_timer, arena->id, 0 );
+ }
+}
+void bg_queue_add(struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type) {
+ enum BATTLEGROUNDS_QUEUE_ACK result = bg->can_queue(sd,arena,type);
+ struct hQueue *queue;
+ int i, count = 0;
+
+ if( arena->begin_timer != INVALID_TIMER ) {
+ clif->bgqueue_ack(sd,BGQA_FAIL_QUEUING_FINISHED,arena->id);
+ return;
+ }
+
+ if( result != BGQA_SUCCESS ) {
+ clif->bgqueue_ack(sd,result,arena->id);
+ return;
+ }
+
+ switch( type ) { /* guild/party already validated in can_queue */
+ case BGQT_PARTY: {
+ struct party_data *p = iParty->search(sd->status.party_id);
+ for( i = 0; i < MAX_PARTY; i++ ) {
+ if( !p->data[i].sd || p->data[i].sd->bg_queue.arena != NULL ) continue;
+ count++;
+ }
+ }
+ break;
+ case BGQT_GUILD:
+ for ( i=0; i<sd->guild->max_member; i++ ) {
+ if ( !sd->guild->member[i].sd || sd->guild->member[i].sd->bg_queue.arena != NULL )
+ continue;
+ count++;
+ }
+ break;
+ case BGQT_INDIVIDUAL:
+ count = 1;
+ break;
+ }
+
+ if( !(queue = script->queue(arena->queue_id)) || (queue->items+count) >= arena->max_players ) {
+ clif->bgqueue_ack(sd,BGQA_FAIL_PPL_OVERAMOUNT,arena->id);
+ return;
+ }
+
+ switch( type ) {
+ case BGQT_INDIVIDUAL:
+ sd->bg_queue.type = type;
+ sd->bg_queue.arena = arena;
+ sd->bg_queue.ready = 0;
+ script->queue_add(arena->queue_id,sd->status.account_id);
+ clif->bgqueue_joined(sd,script->hq[arena->queue_id].items);
+ clif->bgqueue_update_info(sd,arena->id,script->hq[arena->queue_id].items);
+ break;
+ case BGQT_PARTY: {
+ struct party_data *p = iParty->search(sd->status.party_id);
+ for( i = 0; i < MAX_PARTY; i++ ) {
+ if( !p->data[i].sd || p->data[i].sd->bg_queue.arena != NULL ) continue;
+ p->data[i].sd->bg_queue.type = type;
+ p->data[i].sd->bg_queue.arena = arena;
+ p->data[i].sd->bg_queue.ready = 0;
+ script->queue_add(arena->queue_id,p->data[i].sd->status.account_id);
+ clif->bgqueue_joined(p->data[i].sd,script->hq[arena->queue_id].items);
+ clif->bgqueue_update_info(p->data[i].sd,arena->id,script->hq[arena->queue_id].items);
+ }
+ }
+ break;
+ case BGQT_GUILD:
+ for ( i=0; i<sd->guild->max_member; i++ ) {
+ if ( !sd->guild->member[i].sd || sd->guild->member[i].sd->bg_queue.arena != NULL )
+ continue;
+ sd->guild->member[i].sd->bg_queue.type = type;
+ sd->guild->member[i].sd->bg_queue.arena = arena;
+ sd->guild->member[i].sd->bg_queue.ready = 0;
+ script->queue_add(arena->queue_id,sd->guild->member[i].sd->status.account_id);
+ clif->bgqueue_joined(sd->guild->member[i].sd,script->hq[arena->queue_id].items);
+ clif->bgqueue_update_info(sd->guild->member[i].sd,arena->id,script->hq[arena->queue_id].items);
+ }
+ break;
+ }
+
+ clif->bgqueue_ack(sd,BGQA_SUCCESS,arena->id);
+
+}
+enum BATTLEGROUNDS_QUEUE_ACK bg_canqueue(struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type) {
+ int tick;
+ unsigned int tsec;
+ if ( sd->status.base_level > arena->max_level || sd->status.base_level < arena->max_level )
+ return BGQA_FAIL_LEVEL_INCORRECT;
+
+ if ( !(sd->class_&JOBL_2) ) /* TODO: maybe make this a per-arena setting, so users may make custom arenas like baby-only,whatever. */
+ return BGQA_FAIL_CLASS_INVALID;
+
+ tsec = (unsigned int)time(NULL);
+
+ if ( ( tick = pc_readglobalreg(sd, bg->gdelay_var) ) && tsec < tick ) {
+ char response[100];
+ if( (tick-tsec) > 60 )
+ sprintf(response, "You are a deserter! Wait %d minute(s) before you can apply again",(tick-tsec)/60);
+ else
+ sprintf(response, "You are a deserter! Wait %d seconds before you can apply again",(tick-tsec));
+ clif->colormes(sd->fd,COLOR_RED,response);
+ return BGQA_FAIL_DESERTER;
+ }
+
+ if ( ( tick = pc_readglobalreg(sd, arena->cooldown_variable) ) && tsec < tick ) {
+ char response[100];
+ if( (tick-tsec) > 60 )
+ sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %d minute(s)",(tick-tsec)/60);
+ else
+ sprintf(response, "You can't reapply to this arena so fast. Apply to the different arena or wait %d seconds",(tick-tsec));
+ clif->colormes(sd->fd,COLOR_RED,response);
+ return BGQA_FAIL_COOLDOWN;
+ }
+
+ if( sd->bg_queue.arena != NULL )
+ return BGQA_DUPLICATE_REQUEST;
+
+ switch(type) {
+ case BGQT_GUILD:
+ if( !sd->guild || !sd->state.gmaster_flag )
+ return BGQA_NOT_PARTY_GUILD_LEADER;
+ else {
+ int i, count = 0;
+ for ( i=0; i<sd->guild->max_member; i++ ) {
+ if ( !sd->guild->member[i].sd || sd->guild->member[i].sd->bg_queue.arena != NULL )
+ continue;
+ count++;
+ }
+ if ( count < arena->min_team_players ) {
+ char response[100];
+ if( count != sd->guild->connect_member && sd->guild->connect_member >= arena->min_team_players )
+ sprintf(response, "Can't apply: not enough members in your team/guild that have not entered the queue in individual mode, minimum is %d",arena->min_team_players);
+ else
+ sprintf(response, "Can't apply: not enough members in your team/guild, minimum is %d",arena->min_team_players);
+ clif->colormes(sd->fd,COLOR_RED,response);
+ return BGQA_FAIL_TEAM_COUNT;
+ }
+ }
+ break;
+ case BGQT_PARTY:
+ if( !sd->status.party_id )
+ return BGQA_NOT_PARTY_GUILD_LEADER;
+ else {
+ struct party_data *p;
+ if( (p = iParty->search(sd->status.party_id) ) ) {
+ int i, count = 0;
+ bool is_leader = false;
+
+ for(i = 0; i < MAX_PARTY; i++) {
+ if( !p->data[i].sd )
+ continue;
+ if( p->party.member[i].leader && sd == p->data[i].sd )
+ is_leader = true;
+ if( p->data[i].sd->bg_queue.arena == NULL )
+ count++;
+ }
+
+ if( !is_leader )
+ return BGQA_NOT_PARTY_GUILD_LEADER;
+
+ if( count < arena->min_team_players ) {
+ char response[100];
+ if( count != p->party.count && p->party.count >= arena->min_team_players )
+ sprintf(response, "Can't apply: not enough members in your team/party that have not entered the queue in individual mode, minimum is %d",arena->min_team_players);
+ else
+ sprintf(response, "Can't apply: not enough members in your team/party, minimum is %d",arena->min_team_players);
+ clif->colormes(sd->fd,COLOR_RED,response);
+ return BGQA_FAIL_TEAM_COUNT;
+ }
+
+ } else
+ return BGQA_NOT_PARTY_GUILD_LEADER;
+ }
+ break;
+ case BGQT_INDIVIDUAL:/* already did */
+ break;
+ default:
+ ShowDebug("bg_canqueue: unknown/unsupported type %d\n",type);
+ return BGQA_DUPLICATE_REQUEST;
+ }
+
+ return BGQA_SUCCESS;
+}
+void do_init_battleground(void) {
bg_team_db = idb_alloc(DB_OPT_RELEASE_DATA);
- add_timer_func_list(bg_send_xy_timer, "bg_send_xy_timer");
- add_timer_interval(gettick() + battle_config.bg_update_interval, bg_send_xy_timer, 0, 0, battle_config.bg_update_interval);
+ iTimer->add_timer_func_list(bg_send_xy_timer, "bg_send_xy_timer");
+ iTimer->add_timer_interval(iTimer->gettick() + battle_config.bg_update_interval, bg_send_xy_timer, 0, 0, battle_config.bg_update_interval);
}
-void do_final_battleground(void)
-{
+void do_final_battleground(void) {
+ int i;
+
bg_team_db->destroy(bg_team_db, NULL);
+
+ for( i = 0; i < bg->arenas; i++ ) {
+ if( bg->arena[i] )
+ aFree(bg->arena[i]);
+ }
+
+ if( bg->arena )
+ aFree(bg->arena);
+}
+void battleground_defaults(void) {
+ bg = &bg_s;
+
+ bg->queue_on = false;
+
+ bg->mafksec = 0;
+ bg->arena = NULL;
+ bg->arenas = 0;
+ /* */
+ bg->name2arena = bg_name2arena;
+ bg->queue_add = bg_queue_add;
+ bg->can_queue = bg_canqueue;
+ bg->id2pos = bg_id2pos;
+ bg->queue_pc_cleanup = bg_queue_player_cleanup;
+ bg->begin = bg_begin;
+ bg->begin_timer = bg_begin_timer;
+ bg->queue_pregame = bg_queue_pregame;
+ bg->fillup_timer = bg_fillup_timer;
+ /* */
+ bg->config_read = bg_config_read;
}
diff --git a/src/map/battleground.h b/src/map/battleground.h
index c2b74a534..8fe9f3b77 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -1,5 +1,6 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#ifndef _BATTLEGROUND_H_
#define _BATTLEGROUND_H_
@@ -7,7 +8,21 @@
#include "../common/mmo.h" // struct party
#include "guild.h"
+/**
+ * Defines
+ **/
#define MAX_BG_MEMBERS 30
+#define BG_DELAY_VAR_LENGTH 30
+
+/**
+ * Enumerations
+ **/
+enum bg_queue_types {
+ BGQT_INVALID,
+ BGQT_INDIVIDUAL,
+ BGQT_PARTY,
+ BGQT_GUILD
+};
struct battleground_member_data {
unsigned short x, y;
@@ -42,4 +57,51 @@ int bg_team_warp(int bg_id, unsigned short mapindex, short x, short y);
int bg_member_respawn(struct map_session_data *sd);
int bg_send_message(struct map_session_data *sd, const char *mes, int len);
+struct bg_arena {
+ char name[NAME_LENGTH];
+ unsigned char id;
+ char npc_event[EVENT_NAME_LENGTH];
+ short min_level, max_level;
+ short prize_win, prize_loss, prize_draw;
+ short min_players;
+ short max_players;
+ short min_team_players;
+ char cooldown_variable[NAME_LENGTH];
+ char delay_var[NAME_LENGTH];
+ unsigned short maxDuration;
+ int queue_id;
+ int begin_timer;
+ int fillup_timer;
+ int game_timer;
+ unsigned short fillup_duration;
+ unsigned short pregame_duration;
+};
+
+/* battleground.c interface (incomplete) */
+struct battleground_interface {
+ bool queue_on;
+ /* */
+ int mafksec;
+ char gdelay_var[BG_DELAY_VAR_LENGTH];
+ /* */
+ struct bg_arena **arena;
+ unsigned char arenas;
+ /* */
+ struct bg_arena *(*name2arena) (char *name);
+ void (*queue_add) (struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type);
+ enum BATTLEGROUNDS_QUEUE_ACK (*can_queue) (struct map_session_data *sd, struct bg_arena *arena, enum bg_queue_types type);
+ int (*id2pos) (int queue_id, int account_id);
+ void (*queue_pc_cleanup) (struct map_session_data *sd);
+ void (*begin) (struct bg_arena *arena);
+ int (*begin_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ void (*queue_pregame) (struct bg_arena *arena);
+ int (*fillup_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ /* */
+ void (*config_read) (void);
+} bg_s;
+
+struct battleground_interface *bg;
+
+void battleground_defaults(void);
+
#endif /* _BATTLEGROUND_H_ */
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index 0b59e8f1e..0fed57d37 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -64,7 +64,7 @@ bool buyingstore_setup(struct map_session_data* sd, unsigned char slots)
return false;
}
- if( map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
+ if( iMap->getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
{// custom: no vending cells
clif->message(sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
return false;
@@ -100,7 +100,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
return;
}
- if( !pc_can_give_items(sd) )
+ if( !iPc->can_give_items(sd) )
{// custom: GM is not allowed to buy (give zeny)
sd->buyingstore.slots = 0;
clif->message(sd->fd, msg_txt(246));
@@ -119,7 +119,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
return;
}
- if( map_getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
+ if( iMap->getcell(sd->bl.m, sd->bl.x, sd->bl.y, CELL_CHKNOVENDING) )
{// custom: no vending cells
clif->message(sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
return;
@@ -147,7 +147,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
break;
}
- if( !id->flag.buyingstore || !itemdb_cantrade_sub(id, pc_get_group_level(sd), pc_get_group_level(sd)) || ( idx = pc_search_inventory(sd, nameid) ) == -1 )
+ if( !id->flag.buyingstore || !itemdb_cantrade_sub(id, iPc->get_group_level(sd), iPc->get_group_level(sd)) || ( idx = iPc->search_inventory(sd, nameid) ) == -1 )
{// restrictions: allowed, no character-bound items and at least one must be owned
break;
}
@@ -221,13 +221,13 @@ void buyingstore_open(struct map_session_data* sd, int account_id)
return;
}
- if( !pc_can_give_items(sd) )
+ if( !iPc->can_give_items(sd) )
{// custom: GM is not allowed to sell
clif->message(sd->fd, msg_txt(246));
return;
}
- if( ( pl_sd = map_id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore )
+ if( ( pl_sd = iMap->id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore )
{// not online or not buying
return;
}
@@ -259,14 +259,14 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
return;
}
- if( !pc_can_give_items(sd) )
+ if( !iPc->can_give_items(sd) )
{// custom: GM is not allowed to sell
clif->message(sd->fd, msg_txt(246));
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0);
return;
}
- if( ( pl_sd = map_id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore || pl_sd->buyer_id != buyer_id )
+ if( ( pl_sd = iMap->id2sd(account_id) ) == NULL || !pl_sd->state.buyingstore || pl_sd->buyer_id != buyer_id )
{// not online, not buying or not same store
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, 0);
return;
@@ -314,7 +314,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
return;
}
- if( sd->status.inventory[index].expire_time || !itemdb_cantrade(&sd->status.inventory[index], pc_get_group_level(sd), pc_get_group_level(pl_sd)) || memcmp(sd->status.inventory[index].card, buyingstore_blankslots, sizeof(buyingstore_blankslots)) )
+ if( sd->status.inventory[index].expire_time || !itemdb_cantrade(&sd->status.inventory[index], iPc->get_group_level(sd), iPc->get_group_level(pl_sd)) || memcmp(sd->status.inventory[index].card, buyingstore_blankslots, sizeof(buyingstore_blankslots)) )
{// non-tradable item
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, nameid);
return;
@@ -333,7 +333,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
return;
}
- if( pc_checkadditem(pl_sd, nameid, amount) == ADDITEM_OVERAMOUNT )
+ if( iPc->checkadditem(pl_sd, nameid, amount) == ADDITEM_OVERAMOUNT )
{// buyer does not have enough space for this item
clif->buyingstore_trade_failed_seller(sd, BUYINGSTORE_TRADE_SELLER_FAILED, nameid);
return;
@@ -369,13 +369,13 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
zeny = amount*pl_sd->buyingstore.items[listidx].price;
// move item
- pc_additem(pl_sd, &sd->status.inventory[index], amount, LOG_TYPE_BUYING_STORE);
- pc_delitem(sd, index, amount, 1, 0, LOG_TYPE_BUYING_STORE);
+ iPc->additem(pl_sd, &sd->status.inventory[index], amount, LOG_TYPE_BUYING_STORE);
+ iPc->delitem(sd, index, amount, 1, 0, LOG_TYPE_BUYING_STORE);
pl_sd->buyingstore.items[listidx].amount-= amount;
// pay up
- pc_payzeny(pl_sd, zeny, LOG_TYPE_BUYING_STORE, sd);
- pc_getzeny(sd, zeny, LOG_TYPE_BUYING_STORE, pl_sd);
+ iPc->payzeny(pl_sd, zeny, LOG_TYPE_BUYING_STORE, sd);
+ iPc->getzeny(sd, zeny, LOG_TYPE_BUYING_STORE, pl_sd);
pl_sd->buyingstore.zenylimit-= zeny;
// notify clients
@@ -383,7 +383,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
clif->buyingstore_update_item(pl_sd, nameid, amount);
}
- if( save_settings&128 ) {
+ if( iMap->save_settings&128 ) {
chrif_save(sd, 0);
chrif_save(pl_sd, 0);
}
@@ -409,7 +409,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
// remove auto-trader
if( pl_sd->state.autotrade )
{
- map_quit(pl_sd);
+ iMap->quit(pl_sd);
}
}
diff --git a/src/map/chat.c b/src/map/chat.c
index a18e87eef..c0452f2c5 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -44,7 +44,7 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl
cd->owner = bl;
safestrncpy(cd->npc_event, ev, sizeof(cd->npc_event));
- cd->bl.id = map_get_new_object_id();
+ cd->bl.id = iMap->get_new_object_id();
cd->bl.m = bl->m;
cd->bl.x = bl->x;
cd->bl.y = bl->y;
@@ -57,7 +57,7 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl
cd = NULL;
}
- map_addiddb(&cd->bl);
+ iMap->addiddb(&cd->bl);
if( bl->type != BL_NPC )
cd->kick_list = idb_alloc(DB_OPT_BASE);
@@ -87,7 +87,7 @@ int chat_createpcchat(struct map_session_data* sd, const char* title, const char
return 0; //Can't create chatrooms on this map.
}
- if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) )
+ if( iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOCHAT) )
{
clif->message (sd->fd, msg_txt(665));
return 0;
@@ -117,7 +117,7 @@ int chat_joinchat(struct map_session_data* sd, int chatid, const char* pass)
struct chat_data* cd;
nullpo_ret(sd);
- cd = (struct chat_data*)map_id2bl(chatid);
+ cd = (struct chat_data*)iMap->id2bl(chatid);
if( cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m || sd->state.vending || sd->state.buyingstore || sd->chatID || ((cd->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit )
{
@@ -177,7 +177,7 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
nullpo_retr(1, sd);
- cd = (struct chat_data*)map_id2bl(sd->chatID);
+ cd = (struct chat_data*)iMap->id2bl(sd->chatID);
if( cd == NULL )
{
pc_setchatid(sd, 0);
@@ -207,11 +207,11 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
clif->clearchat(cd, 0);
db_destroy(cd->kick_list);
- map_deliddb(&cd->bl);
- map_delblock(&cd->bl);
- map_freeblock(&cd->bl);
+ iMap->deliddb(&cd->bl);
+ iMap->delblock(&cd->bl);
+ iMap->freeblock(&cd->bl);
- unit = map_find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0);
+ unit = iMap->find_skill_unit_oncell(&sd->bl, sd->bl.x, sd->bl.y, AL_WARP, NULL, 0);
group = (unit != NULL) ? unit->group : NULL;
if (group != NULL)
skill->unit_onplace(unit, &sd->bl, group->tick);
@@ -226,10 +226,10 @@ int chat_leavechat(struct map_session_data* sd, bool kicked)
clif->clearchat(cd, 0);
//Adjust Chat location after owner has been changed.
- map_delblock( &cd->bl );
+ iMap->delblock( &cd->bl );
cd->bl.x=cd->usersd[0]->bl.x;
cd->bl.y=cd->usersd[0]->bl.y;
- map_addblock( &cd->bl );
+ iMap->addblock( &cd->bl );
clif->dispchat(cd,0);
}
@@ -250,7 +250,7 @@ int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
nullpo_retr(1, sd);
- cd = (struct chat_data*)map_id2bl(sd->chatID);
+ cd = (struct chat_data*)iMap->id2bl(sd->chatID);
if( cd == NULL || (struct block_list*) sd != cd->owner )
return 1;
@@ -271,10 +271,10 @@ int chat_changechatowner(struct map_session_data* sd, const char* nextownername)
cd->usersd[0] = tmpsd;
// set the new chatroom position
- map_delblock( &cd->bl );
+ iMap->delblock( &cd->bl );
cd->bl.x = cd->owner->x;
cd->bl.y = cd->owner->y;
- map_addblock( &cd->bl );
+ iMap->addblock( &cd->bl );
// and display again
clif->dispchat(cd,0);
@@ -291,7 +291,7 @@ int chat_changechatstatus(struct map_session_data* sd, const char* title, const
nullpo_retr(1, sd);
- cd = (struct chat_data*)map_id2bl(sd->chatID);
+ cd = (struct chat_data*)iMap->id2bl(sd->chatID);
if( cd==NULL || (struct block_list *)sd != cd->owner )
return 1;
@@ -316,7 +316,7 @@ int chat_kickchat(struct map_session_data* sd, const char* kickusername)
nullpo_retr(1, sd);
- cd = (struct chat_data *)map_id2bl(sd->chatID);
+ cd = (struct chat_data *)iMap->id2bl(sd->chatID);
if( cd==NULL || (struct block_list *)sd != cd->owner )
return -1;
@@ -366,15 +366,15 @@ int chat_deletenpcchat(struct npc_data* nd)
struct chat_data *cd;
nullpo_ret(nd);
- cd = (struct chat_data*)map_id2bl(nd->chat_id);
+ cd = (struct chat_data*)iMap->id2bl(nd->chat_id);
if( cd == NULL )
return 0;
chat_npckickall(cd);
clif->clearchat(cd, 0);
- map_deliddb(&cd->bl);
- map_delblock(&cd->bl);
- map_freeblock(&cd->bl);
+ iMap->deliddb(&cd->bl);
+ iMap->delblock(&cd->bl);
+ iMap->freeblock(&cd->bl);
nd->chat_id = 0;
return 0;
diff --git a/src/map/chrif.c b/src/map/chrif.c
index efe976942..8a70b4931 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -53,11 +53,11 @@ static const int packet_len_table[0x3d] = { // U - used, F - free
//2af9: Incoming, chrif_connectack -> 'answer of the 2af8 login(ok / fail)'
//2afa: Outgoing, chrif_sendmap -> 'sending our maps'
//2afb: Incoming, chrif_sendmapack -> 'Maps received successfully / or not ..'
-//2afc: Outgoing, chrif_scdata_request -> request sc_data for pc_authok'ed char. <- new command reuses previous one.
+//2afc: Outgoing, chrif_scdata_request -> request sc_data for iPc->authok'ed char. <- new command reuses previous one.
//2afd: Incoming, chrif_authok -> 'client authentication ok'
//2afe: Outgoing, send_usercount_tochar -> 'sends player count of this map server to charserver'
//2aff: Outgoing, send_users_tochar -> 'sends all actual connected character ids to charserver'
-//2b00: Incoming, map_setusers -> 'set the actual usercount? PACKET.2B COUNT.L.. ?' (not sure)
+//2b00: Incoming, iMap->setusers -> 'set the actual usercount? PACKET.2B COUNT.L.. ?' (not sure)
//2b01: Outgoing, chrif_save -> 'charsave of char XY account XY (complete struct)'
//2b02: Outgoing, chrif_charselectreq -> 'player returns from ingame to charserver to select another char.., this packets includes sessid etc' ? (not 100% sure)
//2b03: Incoming, clif_charselectok -> '' (i think its the packet after enterworld?) (not sure)
@@ -185,7 +185,7 @@ static bool chrif_sd_to_auth(TBL_PC* sd, enum sd_state state) {
node->sex = sd->status.sex;
node->fd = sd->fd;
node->sd = sd; //Data from logged on char.
- node->node_created = gettick(); //timestamp for node timeouts
+ node->node_created = iTimer->gettick(); //timestamp for node timeouts
node->state = state;
sd->state.active = 0;
@@ -272,7 +272,7 @@ int chrif_isconnected(void) {
int chrif_save(struct map_session_data *sd, int flag) {
nullpo_retr(-1, sd);
- pc_makesavestatus(sd);
+ iPc->makesavestatus(sd);
if (flag && sd->state.active) { //Store player data which is quitting
//FIXME: SC are lost if there's no connection at save-time because of the way its related data is cleared immediately after this function. [Skotlex]
@@ -344,9 +344,9 @@ int chrif_sendmap(int fd) {
ShowStatus("Sending maps to char server...\n");
// Sending normal maps, not instances
- WFIFOHEAD(fd, 4 + instance_start * 4);
+ WFIFOHEAD(fd, 4 + instance->start_id * 4);
WFIFOW(fd,0) = 0x2afa;
- for(i = 0; i < instance_start; i++)
+ for(i = 0; i < instance->start_id; i++)
WFIFOW(fd,4+i*4) = map[i].index;
WFIFOW(fd,2) = 4 + i * 4;
WFIFOSET(fd,WFIFOW(fd,2));
@@ -361,7 +361,7 @@ int chrif_recvmap(int fd) {
uint16 port = ntohs(RFIFOW(fd,8));
for(i = 10, j = 0; i < RFIFOW(fd,2); i += 4, j++) {
- map_setipport(RFIFOW(fd,i), ip, port);
+ iMap->setipport(RFIFOW(fd,i), ip, port);
}
if (battle_config.etc_log)
@@ -379,7 +379,7 @@ int chrif_removemap(int fd) {
uint16 port = RFIFOW(fd,8);
for(i = 10, j = 0; i < RFIFOW(fd, 2); i += 4, j++)
- map_eraseipport(RFIFOW(fd, i), ip, port);
+ iMap->eraseipport(RFIFOW(fd, i), ip, port);
other_mapserver_count--;
@@ -479,12 +479,12 @@ int chrif_connectack(int fd) {
* @see DBApply
*/
static int chrif_reconnect(DBKey key, DBData *data, va_list ap) {
- struct auth_node *node = DB->data2ptr(data);
+ struct auth_node *node = iDB->data2ptr(data);
switch (node->state) {
case ST_LOGIN:
if ( node->sd && node->char_dat == NULL ) {//Since there is no way to request the char auth, make it fail.
- pc_authfail(node->sd);
+ iPc->authfail(node->sd);
chrif_char_offline(node->sd);
chrif_auth_delete(node->account_id, node->char_id, ST_LOGIN);
}
@@ -498,7 +498,7 @@ static int chrif_reconnect(DBKey key, DBData *data, va_list ap) {
uint32 ip;
uint16 port;
- if( map_mapname2ipport(sd->mapindex,&ip,&port) == 0 )
+ if( iMap->mapname2ipport(sd->mapindex,&ip,&port) == 0 )
chrif_changemapserver(sd, ip, port);
else //too much lag/timeout is the closest explanation for this error.
clif->authfail_fd(sd->fd, 3);
@@ -543,7 +543,7 @@ int chrif_sendmapack(int fd) {
exit(EXIT_FAILURE);
}
- memcpy(wisp_server_name, RFIFOP(fd,3), NAME_LENGTH);
+ memcpy(iMap->wisp_server_name, RFIFOP(fd,3), NAME_LENGTH);
chrif_on_ready();
@@ -619,7 +619,7 @@ void chrif_authok(int fd) {
//Check if we don't already have player data in our server
//Causes problems if the currently connected player tries to quit or this data belongs to an already connected player which is trying to re-auth.
- if ( ( sd = map_id2sd(account_id) ) != NULL )
+ if ( ( sd = iMap->id2sd(account_id) ) != NULL )
return;
if ( ( node = chrif_search(account_id) ) == NULL )
@@ -645,10 +645,10 @@ void chrif_authok(int fd) {
node->char_id == char_id &&
node->login_id1 == login_id1 )
{ //Auth Ok
- if (pc_authok(sd, login_id2, expiration_time, group_id, status, changing_mapservers))
+ if (iPc->authok(sd, login_id2, expiration_time, group_id, status, changing_mapservers))
return;
} else { //Auth Failed
- pc_authfail(sd);
+ iPc->authfail(sd);
}
chrif_char_offline(sd); //Set him offline, the char server likely has it set as online already.
@@ -687,14 +687,14 @@ void chrif_authfail(int fd) {/* HELLO WORLD. ip in RFIFOL 15 is not being used (
* @see DBApply
*/
int auth_db_cleanup_sub(DBKey key, DBData *data, va_list ap) {
- struct auth_node *node = DB->data2ptr(data);
+ struct auth_node *node = iDB->data2ptr(data);
const char* states[] = { "Login", "Logout", "Map change" };
- if(DIFF_TICK(gettick(),node->node_created)>60000) {
+ if(DIFF_TICK(iTimer->gettick(),node->node_created)>60000) {
switch (node->state) {
case ST_LOGOUT:
//Re-save attempt (->sd should never be null here).
- node->node_created = gettick(); //Refresh tick (avoid char-server load if connection is really bad)
+ node->node_created = iTimer->gettick(); //Refresh tick (avoid char-server load if connection is really bad)
chrif_save(node->sd, 1);
break;
default:
@@ -819,7 +819,7 @@ int chrif_changesex(struct map_session_data *sd) {
if (sd->fd)
clif->authfail_fd(sd->fd, 15);
else
- map_quit(sd);
+ iMap->quit(sd);
return 0;
}
@@ -839,7 +839,7 @@ static void chrif_char_ask_name_answer(int acc, const char* player_name, uint16
char action[25];
char output[256];
- sd = map_id2sd(acc);
+ sd = iMap->id2sd(acc);
if( acc < 0 || sd == NULL ) {
ShowError("chrif_char_ask_name_answer failed - player not online.\n");
@@ -875,7 +875,7 @@ int chrif_changedsex(int fd) {
if ( battle_config.etc_log )
ShowNotice("chrif_changedsex %d.\n", acc);
- sd = map_id2sd(acc);
+ sd = iMap->id2sd(acc);
if ( sd ) { //Normally there should not be a char logged on right now!
if ( sd->status.sex == sex )
return 0; //Do nothing? Likely safe.
@@ -915,7 +915,7 @@ int chrif_changedsex(int fd) {
// do same modify in login-server for the account, but no in char-server (it ask again login_id1 to login, and don't remember it)
clif->message(sd->fd, msg_txt(409)); //"Your sex has been changed (need disconnection by the server)..."
set_eof(sd->fd); // forced to disconnect for the change
- map_quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
+ iMap->quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
}
return 0;
}
@@ -945,18 +945,18 @@ int chrif_divorceack(int char_id, int partner_id) {
if( !char_id || !partner_id )
return 0;
- if( ( sd = map_charid2sd(char_id) ) != NULL && sd->status.partner_id == partner_id ) {
+ if( ( sd = iMap->charid2sd(char_id) ) != NULL && sd->status.partner_id == partner_id ) {
sd->status.partner_id = 0;
for(i = 0; i < MAX_INVENTORY; i++)
if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F)
- pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
+ iPc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
}
- if( ( sd = map_charid2sd(partner_id) ) != NULL && sd->status.partner_id == char_id ) {
+ if( ( sd = iMap->charid2sd(partner_id) ) != NULL && sd->status.partner_id == char_id ) {
sd->status.partner_id = 0;
for(i = 0; i < MAX_INVENTORY; i++)
if (sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F)
- pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
+ iPc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
}
return 0;
@@ -968,7 +968,7 @@ int chrif_deadopt(int father_id, int mother_id, int child_id) {
struct map_session_data* sd;
int idx = skill->get_index(WE_CALLBABY);
- if( father_id && ( sd = map_charid2sd(father_id) ) != NULL && sd->status.child == child_id ) {
+ if( father_id && ( sd = iMap->charid2sd(father_id) ) != NULL && sd->status.child == child_id ) {
sd->status.child = 0;
sd->status.skill[idx].id = 0;
sd->status.skill[idx].lv = 0;
@@ -976,7 +976,7 @@ int chrif_deadopt(int father_id, int mother_id, int child_id) {
clif->deleteskill(sd,WE_CALLBABY);
}
- if( mother_id && ( sd = map_charid2sd(mother_id) ) != NULL && sd->status.child == child_id ) {
+ if( mother_id && ( sd = iMap->charid2sd(mother_id) ) != NULL && sd->status.child == child_id ) {
sd->status.child = 0;
sd->status.skill[idx].id = 0;
sd->status.skill[idx].lv = 0;
@@ -999,7 +999,7 @@ int chrif_accountban(int fd) {
if ( battle_config.etc_log )
ShowNotice("chrif_accountban %d.\n", acc);
- sd = map_id2sd(acc);
+ sd = iMap->id2sd(acc);
if ( acc < 0 || sd == NULL ) {
ShowError("chrif_accountban failed - player not online.\n");
@@ -1025,7 +1025,7 @@ int chrif_accountban(int fd) {
}
set_eof(sd->fd); // forced to disconnect for the change
- map_quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
+ iMap->quit(sd); // Remove leftovers (e.g. autotrading) [Paradox924X]
return 0;
}
@@ -1035,7 +1035,7 @@ int chrif_disconnectplayer(int fd) {
struct map_session_data* sd;
int account_id = RFIFOL(fd, 2);
- sd = map_id2sd(account_id);
+ sd = iMap->id2sd(account_id);
if( sd == NULL ) {
struct auth_node* auth = chrif_search(account_id);
@@ -1047,7 +1047,7 @@ int chrif_disconnectplayer(int fd) {
if (!sd->fd) { //No connection
if (sd->state.autotrade)
- map_quit(sd); //Remove it.
+ iMap->quit(sd); //Remove it.
//Else we don't remove it because the char should have a timer to remove the player because it force-quit before,
//and we don't want them kicking their previous instance before the 10 secs penalty time passes. [Skotlex]
return 0;
@@ -1172,7 +1172,7 @@ int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the
const struct TimerData *timer;
chrif_check(-1);
- tick = gettick();
+ tick = iTimer->gettick();
WFIFOHEAD(char_fd, 14 + SC_MAX*sizeof(struct status_change_data));
WFIFOW(char_fd,0) = 0x2b1c;
@@ -1183,7 +1183,7 @@ int chrif_save_scdata(struct map_session_data *sd) { //parses the sc_data of the
if (!sc->data[i])
continue;
if (sc->data[i]->timer != INVALID_TIMER) {
- timer = get_timer(sc->data[i]->timer);
+ timer = iTimer->get_timer(sc->data[i]->timer);
if (timer == NULL || timer->func != status_change_timer || DIFF_TICK(timer->tick,tick) < 0)
continue;
data.tick = DIFF_TICK(timer->tick,tick); //Duration that is left before ending.
@@ -1221,7 +1221,7 @@ int chrif_load_scdata(int fd) {
aid = RFIFOL(fd,4); //Player Account ID
cid = RFIFOL(fd,8); //Player Char ID
- sd = map_id2sd(aid);
+ sd = iMap->id2sd(aid);
if ( !sd ) {
ShowError("chrif_load_scdata: Player of AID %d not found!\n", aid);
@@ -1245,7 +1245,7 @@ int chrif_load_scdata(int fd) {
}
/*==========================================
- * Send rates and motd to char server [Wizputer]
+ * Send rates to char server [Wizputer]
* S 2b16 <base rate>.L <job rate>.L <drop rate>.L
*------------------------------------------*/
int chrif_ragsrvinfo(int base_rate, int job_rate, int drop_rate) {
@@ -1338,10 +1338,10 @@ void chrif_on_disconnect(void) {
chrif_connected = 0;
other_mapserver_count = 0; //Reset counter. We receive ALL maps from all map-servers on reconnect.
- map_eraseallipport();
+ iMap->eraseallipport();
//Attempt to reconnect in a second. [Skotlex]
- add_timer(gettick() + 1000, check_connect_char_server, 0, 0);
+ iTimer->add_timer(iTimer->gettick() + 1000, check_connect_char_server, 0, 0);
}
@@ -1448,11 +1448,11 @@ int chrif_parse(int fd) {
case 0x2af9: chrif_connectack(fd); break;
case 0x2afb: chrif_sendmapack(fd); break;
case 0x2afd: chrif_authok(fd); break;
- case 0x2b00: map_setusers(RFIFOL(fd,2)); chrif_keepalive(fd); break;
+ case 0x2b00: iMap->setusers(RFIFOL(fd,2)); chrif_keepalive(fd); break;
case 0x2b03: clif->charselectok(RFIFOL(fd,2), RFIFOB(fd,6)); break;
case 0x2b04: chrif_recvmap(fd); break;
case 0x2b06: chrif_changemapserverack(RFIFOL(fd,2), RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), RFIFOW(fd,18), RFIFOW(fd,20), RFIFOW(fd,22), RFIFOL(fd,24), RFIFOW(fd,28)); break;
- case 0x2b09: map_addnickdb(RFIFOL(fd,2), (char*)RFIFOP(fd,6)); break;
+ case 0x2b09: iMap->addnickdb(RFIFOL(fd,2), (char*)RFIFOP(fd,6)); break;
case 0x2b0a: socket_datasync(fd, false); break;
case 0x2b0d: chrif_changedsex(fd); break;
case 0x2b0f: chrif_char_ask_name_answer(RFIFOL(fd,2), (char*)RFIFOP(fd,6), RFIFOW(fd,30), RFIFOW(fd,32)); break;
@@ -1486,7 +1486,7 @@ int send_usercount_tochar(int tid, unsigned int tick, int id, intptr_t data) {
WFIFOHEAD(char_fd,4);
WFIFOW(char_fd,0) = 0x2afe;
- WFIFOW(char_fd,2) = map_usercount();
+ WFIFOW(char_fd,2) = iMap->usercount();
WFIFOSET(char_fd,4);
return 0;
}
@@ -1502,7 +1502,7 @@ int send_users_tochar(void) {
chrif_check(-1);
- users = map_usercount();
+ users = iMap->usercount();
WFIFOHEAD(char_fd, 6+8*users);
WFIFOW(char_fd,0) = 0x2aff;
@@ -1537,9 +1537,8 @@ static int check_connect_char_server(int tid, unsigned int tick, int id, intptr_
}
chrif_state = 0;
- char_fd = make_connection(char_ip, char_port,false);
- if (char_fd == -1)//Attempt to connect later. [Skotlex]
+ if ( ( char_fd = make_connection(char_ip, char_port,NULL) ) == -1) //Attempt to connect later. [Skotlex]
return 0;
session[char_fd]->func_parse = chrif_parse;
@@ -1596,7 +1595,7 @@ void chrif_send_report(char* buf, int len) {
* @see DBApply
*/
int auth_db_final(DBKey key, DBData *data, va_list ap) {
- struct auth_node *node = DB->data2ptr(data);
+ struct auth_node *node = iDB->data2ptr(data);
if (node->char_dat)
aFree(node->char_dat);
@@ -1634,17 +1633,17 @@ int do_init_chrif(void) {
auth_db = idb_alloc(DB_OPT_BASE);
auth_db_ers = ers_new(sizeof(struct auth_node),"chrif.c::auth_db_ers",ERS_OPT_NONE);
- add_timer_func_list(check_connect_char_server, "check_connect_char_server");
- add_timer_func_list(auth_db_cleanup, "auth_db_cleanup");
+ iTimer->add_timer_func_list(check_connect_char_server, "check_connect_char_server");
+ iTimer->add_timer_func_list(auth_db_cleanup, "auth_db_cleanup");
// establish map-char connection if not present
- add_timer_interval(gettick() + 1000, check_connect_char_server, 0, 0, 10 * 1000);
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, check_connect_char_server, 0, 0, 10 * 1000);
// wipe stale data for timed-out client connection requests
- add_timer_interval(gettick() + 1000, auth_db_cleanup, 0, 0, 30 * 1000);
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, auth_db_cleanup, 0, 0, 30 * 1000);
// send the user count every 10 seconds, to hide the charserver's online counting problem
- add_timer_interval(gettick() + 1000, send_usercount_tochar, 0, 0, UPDATE_INTERVAL);
+ iTimer->add_timer_interval(iTimer->gettick() + 1000, send_usercount_tochar, 0, 0, UPDATE_INTERVAL);
return 0;
}
diff --git a/src/map/clif.c b/src/map/clif.c
index 0c5143ffd..39ffdd23d 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -226,7 +226,6 @@ uint32 clif_refresh_ip(void) {
}
return 0;
}
-
#if PACKETVER >= 20071106
static inline unsigned char clif_bl_type(struct block_list *bl) {
switch (bl->type) {
@@ -362,11 +361,11 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
clif->send (buf, len, bl, SELF);
case AREA_WOC:
case AREA_WOS:
- map_foreachinarea(clif->send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE,
+ iMap->foreachinarea(clif->send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE,
BL_PC, buf, len, bl, type);
break;
case AREA_CHAT_WOC:
- map_foreachinarea(clif->send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5),
+ iMap->foreachinarea(clif->send_sub, bl->m, bl->x-(AREA_SIZE-5), bl->y-(AREA_SIZE-5),
bl->x+(AREA_SIZE-5), bl->y+(AREA_SIZE-5), BL_PC, buf, len, bl, AREA_WOC);
break;
@@ -375,7 +374,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
{
struct chat_data *cd;
if (sd) {
- cd = (struct chat_data*)map_id2bl(sd->chatID);
+ cd = (struct chat_data*)iMap->id2bl(sd->chatID);
} else if (bl->type == BL_CHAT) {
cd = (struct chat_data*)bl;
} else break;
@@ -404,7 +403,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
case PARTY_SAMEMAP:
case PARTY_SAMEMAP_WOS:
if (sd && sd->status.party_id)
- p = party_search(sd->status.party_id);
+ p = iParty->search(sd->status.party_id);
if (p) {
for(i=0;i<MAX_PARTY;i++){
@@ -427,7 +426,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
memcpy(WFIFOP(fd,0), buf, len);
WFIFOSET(fd,len);
}
- if (!enable_spy) //Skip unnecessary parsing. [Skotlex]
+ if (!iMap->enable_spy) //Skip unnecessary parsing. [Skotlex]
break;
iter = mapit_getallusers();
@@ -504,7 +503,7 @@ int clif_send(const void* buf, int len, struct block_list* bl, enum send_target
WFIFOSET(fd,len);
}
}
- if (!enable_spy) //Skip unnecessary parsing. [Skotlex]
+ if (!iMap->enable_spy) //Skip unnecessary parsing. [Skotlex]
break;
iter = mapit_getallusers();
@@ -562,7 +561,7 @@ void clif_authok(struct map_session_data *sd)
struct packet_authok p;
p.PacketType = authokType;
- p.startTime = gettick();
+ p.startTime = iTimer->gettick();
WBUFPOS(&p.PosDir[0],0,sd->bl.x,sd->bl.y,sd->ud.dir); /* do the stupid client math */
p.xSize = p.ySize = 5; /* not-used */
@@ -646,7 +645,7 @@ void clif_charselectok(int id, uint8 ok)
struct map_session_data* sd;
int fd;
- if ((sd = map_id2sd(id)) == NULL || !sd->fd)
+ if ((sd = iMap->id2sd(id)) == NULL || !sd->fd)
return;
fd = sd->fd;
@@ -764,7 +763,7 @@ void clif_clearunit_delayed(struct block_list* bl, clr_type type, unsigned int t
{
struct block_list *tbl = ers_alloc(clif->delay_clearunit_ers, struct block_list);
memcpy (tbl, bl, sizeof (struct block_list));
- add_timer(tick, clif->clearunit_delayed_sub, (int)type, (intptr_t)tbl);
+ iTimer->add_timer(tick, clif->clearunit_delayed_sub, (int)type, (intptr_t)tbl);
}
void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, unsigned short *lhand)
@@ -850,7 +849,7 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu
p.speed = status_get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
- p.effectState = (sc) ? sc->option : 0;
+ p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
p.job = vd->class_;
p.head = vd->hair_style;
p.weapon = vd->weapon;
@@ -1092,7 +1091,7 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
p.speed = status_get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
- p.effectState = (sc) ? sc->option : 0;
+ p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
p.job = vd->class_;
p.head = vd->hair_style;
p.weapon = vd->weapon;
@@ -1136,9 +1135,9 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
p.isBoss = 0;
}
#endif
- clif->send(&p,sizeof(p),bl,target);
-
if( disguised(bl) ) {
+ if( sd->status.class_ != sd->disguise )
+ clif->send(&p,sizeof(p),bl,target);
#if PACKETVER >= 20071106
p.objecttype = pcdb_checkid(status_get_viewdata(bl)->class_) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE
p.GID = -bl->id;
@@ -1146,7 +1145,8 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) {
p.GID = -bl->id;
#endif
clif->send(&p,sizeof(p),bl,SELF);
- }
+ } else
+ clif->send(&p,sizeof(p),bl,target);
}
@@ -1171,12 +1171,12 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd,
p.speed = status_get_speed(bl);
p.bodyState = (sc) ? sc->opt1 : 0;
p.healthState = (sc) ? sc->opt2 : 0;
- p.effectState = (sc) ? sc->option : 0;
+ p.effectState = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
p.job = vd->class_;
p.head = vd->hair_style;
p.weapon = vd->weapon;
p.accessory = vd->head_bottom;
- p.moveStartTime = gettick();
+ p.moveStartTime = iTimer->gettick();
#if PACKETVER < 7
p.shield = vd->shield;
#endif
@@ -1332,7 +1332,7 @@ int clif_spawn(struct block_list *bl)
/**
* Hide NPC from maya purple card.
**/
- if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE))
+ if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->option&OPTION_INVISIBLE))
return 0;
clif->spawn_unit(bl,AREA_WOS);
@@ -1554,7 +1554,7 @@ void clif_walkok(struct map_session_data *sd)
WFIFOHEAD(fd, packet_len(0x87));
WFIFOW(fd,0)=0x87;
- WFIFOL(fd,2)=gettick();
+ WFIFOL(fd,2)=iTimer->gettick();
WFIFOPOS2(fd,6,sd->bl.x,sd->bl.y,sd->ud.to_x,sd->ud.to_y,8,8);
WFIFOSET(fd,packet_len(0x87));
}
@@ -1611,7 +1611,7 @@ void clif_move(struct unit_data *ud)
/**
* Hide NPC from maya purple card.
**/
- if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE))
+ if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->option&OPTION_INVISIBLE))
return;
if (ud->state.speed_changed) {
@@ -1625,10 +1625,9 @@ void clif_move(struct unit_data *ud)
WBUFW(buf,0)=0x86;
WBUFL(buf,2)=bl->id;
WBUFPOS2(buf,6,bl->x,bl->y,ud->to_x,ud->to_y,8,8);
- WBUFL(buf,12)=gettick();
+ WBUFL(buf,12)=iTimer->gettick();
clif->send(buf, packet_len(0x86), bl, AREA_WOS);
- if (disguised(bl))
- {
+ if (disguised(bl)) {
WBUFL(buf,2)=-bl->id;
clif->send(buf, packet_len(0x86), bl, SELF);
}
@@ -1636,14 +1635,14 @@ void clif_move(struct unit_data *ud)
/*==========================================
- * Delays the map_quit of a player after they are disconnected. [Skotlex]
+ * Delays the iMap->quit of a player after they are disconnected. [Skotlex]
*------------------------------------------*/
int clif_delayquit(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd = NULL;
//Remove player from map server
- if ((sd = map_id2sd(id)) != NULL && sd->fd == 0) //Should be a disconnected player.
- map_quit(sd);
+ if ((sd = iMap->id2sd(id)) != NULL && sd->fd == 0) //Should be a disconnected player.
+ iMap->quit(sd);
return 0;
}
@@ -1652,28 +1651,27 @@ int clif_delayquit(int tid, unsigned int tick, int id, intptr_t data) {
*------------------------------------------*/
void clif_quitsave(int fd,struct map_session_data *sd) {
if (!battle_config.prevent_logout ||
- DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout)
- map_quit(sd);
+ DIFF_TICK(iTimer->gettick(), sd->canlog_tick) > battle_config.prevent_logout)
+ iMap->quit(sd);
else if (sd->fd) {
//Disassociate session from player (session is deleted after this function was called)
//And set a timer to make him quit later.
session[sd->fd]->session_data = NULL;
sd->fd = 0;
- add_timer(gettick() + 10000, clif->delayquit, sd->bl.id, 0);
+ iTimer->add_timer(iTimer->gettick() + 10000, clif->delayquit, sd->bl.id, 0);
}
}
/// Notifies the client of a position change to coordinates on given map (ZC_NPCACK_MAPMOVE).
/// 0091 <map name>.16B <x>.W <y>.W
-void clif_changemap(struct map_session_data *sd, short map, int x, int y)
-{
+void clif_changemap(struct map_session_data *sd, short m, int x, int y) {
int fd;
nullpo_retv(sd);
fd = sd->fd;
WFIFOHEAD(fd,packet_len(0x91));
WFIFOW(fd,0) = 0x91;
- mapindex_getmapname_ext(mapindex_id2name(map), (char*)WFIFOP(fd,2));
+ mapindex_getmapname_ext(map[m].cName ? map[m].cName : map[m].name, (char*)WFIFOP(fd,2));
WFIFOW(fd,18) = x;
WFIFOW(fd,20) = y;
WFIFOSET(fd,packet_len(0x91));
@@ -1682,8 +1680,7 @@ void clif_changemap(struct map_session_data *sd, short map, int x, int y)
/// Notifies the client of a position change to coordinates on given map, which is on another map-server (ZC_NPCACK_SERVERMOVE).
/// 0092 <map name>.16B <x>.W <y>.W <ip>.L <port>.W
-void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port)
-{
+void clif_changemapserver(struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port) {
int fd;
nullpo_retv(sd);
fd = sd->fd;
@@ -1766,7 +1763,7 @@ void clif_buylist(struct map_session_data *sd, struct npc_data *nd)
if( id == NULL )
continue;
WFIFOL(fd, 4+c*11) = val;
- WFIFOL(fd, 8+c*11) = pc_modifybuyvalue(sd,val);
+ WFIFOL(fd, 8+c*11) = iPc->modifybuyvalue(sd,val);
WFIFOB(fd,12+c*11) = itemtype(id->type);
WFIFOW(fd,13+c*11) = ( id->view_id > 0 ) ? id->view_id : id->nameid;
c++;
@@ -1809,7 +1806,7 @@ void clif_selllist(struct map_session_data *sd)
{
if( sd->status.inventory[i].nameid > 0 && sd->inventory_data[i] )
{
- if( !itemdb_cansell(&sd->status.inventory[i], pc_get_group_level(sd)) )
+ if( !itemdb_cansell(&sd->status.inventory[i], iPc->get_group_level(sd)) )
continue;
if( sd->status.inventory[i].expire_time )
@@ -1820,7 +1817,7 @@ void clif_selllist(struct map_session_data *sd)
continue;
WFIFOW(fd,4+c*10)=i+2;
WFIFOL(fd,6+c*10)=val;
- WFIFOL(fd,10+c*10)=pc_modifysellvalue(sd,val);
+ WFIFOL(fd,10+c*10)=iPc->modifysellvalue(sd,val);
c++;
}
}
@@ -1837,11 +1834,12 @@ void clif_selllist(struct map_session_data *sd)
/// - set npcid of dialog window (0 by default)
/// - if set to clear on next mes, clear contents
/// - append this text
-void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes)
-{
+void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) {
int fd = sd->fd;
int slen = strlen(mes) + 9;
+ sd->state.dialog = 1;
+
WFIFOHEAD(fd, slen);
WFIFOW(fd,0)=0xb4;
WFIFOW(fd,2)=slen;
@@ -1954,7 +1952,7 @@ void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes)
int slen = strlen(mes) + 9;
struct block_list *bl = NULL;
- if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = map_id2bl(npcid)) && (bl->m!=sd->bl.m ||
+ if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = iMap->id2bl(npcid)) && (bl->m!=sd->bl.m ||
bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 ||
bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1))))
clif->sendfakenpc(sd, npcid);
@@ -1986,7 +1984,7 @@ void clif_scriptinput(struct map_session_data *sd, int npcid)
nullpo_retv(sd);
- if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = map_id2bl(npcid)) && (bl->m!=sd->bl.m ||
+ if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = iMap->id2bl(npcid)) && (bl->m!=sd->bl.m ||
bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 ||
bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1))))
clif->sendfakenpc(sd, npcid);
@@ -2017,7 +2015,7 @@ void clif_scriptinputstr(struct map_session_data *sd, int npcid)
nullpo_retv(sd);
- if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = map_id2bl(npcid)) && (bl->m!=sd->bl.m ||
+ if (!sd->state.using_fake_npc && (npcid == fake_nd->bl.id || ((bl = iMap->id2bl(npcid)) && (bl->m!=sd->bl.m ||
bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 ||
bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1))))
clif->sendfakenpc(sd, npcid);
@@ -2235,7 +2233,7 @@ void clif_additem(struct map_session_data *sd, int n, int amount, int fail) {
p.IsDamaged = sd->status.inventory[n].attribute;
p.refiningLevel =sd->status.inventory[n].refine;
clif->addcards2(&p.slot.card[0], &sd->status.inventory[n]);
- p.location = pc_equippoint(sd,n);
+ p.location = iPc->equippoint(sd,n);
p.type = itemtype(sd->inventory_data[n]->type);
#if PACKETVER >= 20061218
p.HireExpireDate = sd->status.inventory[n].expire_time;
@@ -2355,7 +2353,7 @@ void clif_inventorylist(struct map_session_data *sd) {
if( !itemdb_isstackable2(sd->inventory_data[i]) )
{ //Non-stackable (Equippable)
WBUFW(bufe,ne*se+4)=i+2;
- clif->item_sub(bufe, ne*se+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i));
+ clif->item_sub(bufe, ne*se+6, &sd->status.inventory[i], sd->inventory_data[i], iPc->equippoint(sd,i));
clif->addcards(WBUFP(bufe, ne*se+16), &sd->status.inventory[i]);
#if PACKETVER >= 20071002
WBUFL(bufe,ne*se+24)=sd->status.inventory[i].expire_time;
@@ -2445,7 +2443,7 @@ void clif_equiplist(struct map_session_data *sd)
continue;
//Equippable
WBUFW(buf,n*cmd+4)=i+2;
- clif->item_sub(buf, n*cmd+6, &sd->status.inventory[i], sd->inventory_data[i], pc_equippoint(sd,i));
+ clif->item_sub(buf, n*cmd+6, &sd->status.inventory[i], sd->inventory_data[i], iPc->equippoint(sd,i));
clif->addcards(WBUFP(buf, n*cmd+16), &sd->status.inventory[i]);
#if PACKETVER >= 20071002
WBUFL(buf,n*cmd+24)=sd->status.inventory[i].expire_time;
@@ -2747,6 +2745,9 @@ void read_channels_config(void) {
} else {
unsigned char d = 0, dlen = strlen(irc_server);
char server[40];
+
+ memset(server, '\0', sizeof(server));
+
for(d = 0; d < dlen; d++) {
if(irc_server[d] == ':') {
memcpy(server, irc_server, d);
@@ -2762,7 +2763,7 @@ void read_channels_config(void) {
ShowWarning("channels.conf : irc channel enabled but irc_channel_network wasn't found, disabling irc channel...\n");
}
if( config_setting_lookup_string(settings, "irc_channel_channel", &irc_channel) )
- safestrncpy(hChSys.irc_channel, irc_channel, 20);
+ safestrncpy(hChSys.irc_channel, irc_channel, 50);
else {
hChSys.irc = false;
ShowWarning("channels.conf : irc channel enabled but irc_channel_channel wasn't found, disabling irc channel...\n");
@@ -2771,7 +2772,7 @@ void read_channels_config(void) {
if( strcmpi(irc_nick,"Hercules_chSysBot") == 0 ) {
sprintf(hChSys.irc_nick, "Hercules_chSysBot%d",rand()%777);
} else
- safestrncpy(hChSys.irc_nick, irc_nick, 30);
+ safestrncpy(hChSys.irc_nick, irc_nick, 40);
} else {
hChSys.irc = false;
ShowWarning("channels.conf : irc channel enabled but irc_channel_nick wasn't found, disabling irc channel...\n");
@@ -2949,7 +2950,7 @@ int clif_hpmeter_sub(struct block_list *bl, va_list ap) {
*------------------------------------------*/
int clif_hpmeter(struct map_session_data *sd) {
nullpo_ret(sd);
- map_foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd);
+ iMap->foreachinarea(clif->hpmeter_sub, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd);
return 0;
}
@@ -2979,9 +2980,9 @@ void clif_updatestatus(struct map_session_data *sd,int type)
switch(type){
// 00b0
case SP_WEIGHT:
- pc_updateweightstatus(sd);
+ iPc->updateweightstatus(sd);
WFIFOHEAD(fd,14);
- WFIFOW(fd,0)=0xb0; //Need to re-set as pc_updateweightstatus can alter the buffer. [Skotlex]
+ WFIFOW(fd,0)=0xb0; //Need to re-set as iPc->updateweightstatus can alter the buffer. [Skotlex]
WFIFOW(fd,2)=type;
WFIFOL(fd,4)=sd->weight;
break;
@@ -3091,11 +3092,11 @@ void clif_updatestatus(struct map_session_data *sd,int type)
break;
case SP_NEXTBASEEXP:
WFIFOW(fd,0)=0xb1;
- WFIFOL(fd,4)=pc_nextbaseexp(sd);
+ WFIFOL(fd,4)=iPc->nextbaseexp(sd);
break;
case SP_NEXTJOBEXP:
WFIFOW(fd,0)=0xb1;
- WFIFOL(fd,4)=pc_nextjobexp(sd);
+ WFIFOL(fd,4)=iPc->nextjobexp(sd);
break;
/**
@@ -3108,7 +3109,7 @@ void clif_updatestatus(struct map_session_data *sd,int type)
case SP_UDEX:
case SP_ULUK:
WFIFOW(fd,0)=0xbe;
- WFIFOB(fd,4)=pc_need_status_point(sd,type-SP_USTR+SP_STR,1);
+ WFIFOB(fd,4)=iPc->need_status_point(sd,type-SP_USTR+SP_STR,1);
len=5;
break;
@@ -3405,17 +3406,17 @@ void clif_initialstatus(struct map_session_data *sd) {
WBUFW(buf,0)=0xbd;
WBUFW(buf,2)=min(sd->status.status_point, INT16_MAX);
WBUFB(buf,4)=min(sd->status.str, UINT8_MAX);
- WBUFB(buf,5)=pc_need_status_point(sd,SP_STR,1);
+ WBUFB(buf,5)=iPc->need_status_point(sd,SP_STR,1);
WBUFB(buf,6)=min(sd->status.agi, UINT8_MAX);
- WBUFB(buf,7)=pc_need_status_point(sd,SP_AGI,1);
+ WBUFB(buf,7)=iPc->need_status_point(sd,SP_AGI,1);
WBUFB(buf,8)=min(sd->status.vit, UINT8_MAX);
- WBUFB(buf,9)=pc_need_status_point(sd,SP_VIT,1);
+ WBUFB(buf,9)=iPc->need_status_point(sd,SP_VIT,1);
WBUFB(buf,10)=min(sd->status.int_, UINT8_MAX);
- WBUFB(buf,11)=pc_need_status_point(sd,SP_INT,1);
+ WBUFB(buf,11)=iPc->need_status_point(sd,SP_INT,1);
WBUFB(buf,12)=min(sd->status.dex, UINT8_MAX);
- WBUFB(buf,13)=pc_need_status_point(sd,SP_DEX,1);
+ WBUFB(buf,13)=iPc->need_status_point(sd,SP_DEX,1);
WBUFB(buf,14)=min(sd->status.luk, UINT8_MAX);
- WBUFB(buf,15)=pc_need_status_point(sd,SP_LUK,1);
+ WBUFB(buf,15)=iPc->need_status_point(sd,SP_LUK,1);
WBUFW(buf,16) = pc_leftside_atk(sd);
WBUFW(buf,18) = pc_rightside_atk(sd);
@@ -3507,7 +3508,7 @@ void clif_arrow_create_list(struct map_session_data *sd)
for (i = 0, c = 0; i < MAX_SKILL_ARROW_DB; i++) {
if (skill_arrow_db[i].nameid > 0 &&
- (j = pc_search_inventory(sd, skill_arrow_db[i].nameid)) >= 0 &&
+ (j = iPc->search_inventory(sd, skill_arrow_db[i].nameid)) >= 0 &&
!sd->status.inventory[j].equip && sd->status.inventory[j].identify)
{
if ((j = itemdb_viewid(skill_arrow_db[i].nameid)) > 0)
@@ -3638,16 +3639,17 @@ void clif_changeoption(struct block_list* bl)
struct map_session_data* sd;
nullpo_retv(bl);
- sc = status_get_sc(bl);
- if (!sc) return; //How can an option change if there's no sc?
+
+ if ( !(sc = status_get_sc(bl)) && bl->type != BL_NPC ) return; //How can an option change if there's no sc?
+
sd = BL_CAST(BL_PC, bl);
#if PACKETVER >= 7
WBUFW(buf,0) = 0x229;
WBUFL(buf,2) = bl->id;
- WBUFW(buf,6) = sc->opt1;
- WBUFW(buf,8) = sc->opt2;
- WBUFL(buf,10) = sc->option;
+ WBUFW(buf,6) = (sc) ? sc->opt1 : 0;
+ WBUFW(buf,8) = (sc) ? sc->opt2 : 0;
+ WBUFL(buf,10) = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
WBUFB(buf,14) = (sd)? sd->status.karma : 0;
if(disguised(bl)) {
clif->send(buf,packet_len(0x229),bl,AREA_WOS);
@@ -3661,9 +3663,9 @@ void clif_changeoption(struct block_list* bl)
#else
WBUFW(buf,0) = 0x119;
WBUFL(buf,2) = bl->id;
- WBUFW(buf,6) = sc->opt1;
- WBUFW(buf,8) = sc->opt2;
- WBUFW(buf,10) = sc->option;
+ WBUFW(buf,6) = (sc) ? sc->opt1 : 0;
+ WBUFW(buf,8) = (sc) ? sc->opt2 : 0;
+ WBUFL(buf,10) = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
WBUFB(buf,12) = (sd)? sd->status.karma : 0;
if(disguised(bl)) {
clif->send(buf,packet_len(0x119),bl,AREA_WOS);
@@ -3680,19 +3682,17 @@ void clif_changeoption(struct block_list* bl)
/// Displays status change effects on NPCs/monsters (ZC_NPC_SHOWEFST_UPDATE).
/// 028a <id>.L <effect state>.L <level>.L <showEFST>.L
-void clif_changeoption2(struct block_list* bl)
-{
+void clif_changeoption2(struct block_list* bl) {
unsigned char buf[20];
struct status_change *sc;
- sc = status_get_sc(bl);
- if (!sc) return; //How can an option change if there's no sc?
+ if ( !(sc = status_get_sc(bl)) && bl->type != BL_NPC ) return; //How can an option change if there's no sc?
WBUFW(buf,0) = 0x28a;
WBUFL(buf,2) = bl->id;
- WBUFL(buf,6) = sc->option;
+ WBUFL(buf,6) = (sc) ? sc->option : bl->type == BL_NPC ? ((TBL_NPC*)bl)->option : 0;
WBUFL(buf,10) = clif_setlevel(bl);
- WBUFL(buf,14) = sc->opt3;
+ WBUFL(buf,14) = (sc) ? sc->opt3 : 0;
if(disguised(bl)) {
clif->send(buf,packet_len(0x28a),bl,AREA_WOS);
WBUFL(buf,2) = -bl->id;
@@ -3748,7 +3748,7 @@ void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok)
}
void clif_hercules_chsys_send(struct hChSysCh *channel, struct map_session_data *sd, char *msg) {
- if( channel->msg_delay != 0 && DIFF_TICK(sd->hchsysch_tick + ( channel->msg_delay * 1000 ), gettick()) > 0 && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) {
+ if( channel->msg_delay != 0 && DIFF_TICK(sd->hchsysch_tick + ( channel->msg_delay * 1000 ), iTimer->gettick()) > 0 && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) {
clif->colormes(sd->fd,COLOR_RED,msg_txt(1455));
return;
} else {
@@ -3758,7 +3758,7 @@ void clif_hercules_chsys_send(struct hChSysCh *channel, struct map_session_data
if( channel->type == hChSys_IRC )
ircbot->relay(sd->status.name,msg);
if( channel->msg_delay != 0 )
- sd->hchsysch_tick = gettick();
+ sd->hchsysch_tick = iTimer->gettick();
}
}
@@ -4011,7 +4011,7 @@ void clif_traderequest(struct map_session_data* sd, const char* name)
safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH);
WFIFOSET(fd,packet_len(0xe5));
#else
- struct map_session_data* tsd = map_id2sd(sd->trade_partner);
+ struct map_session_data* tsd = iMap->id2sd(sd->trade_partner);
if( !tsd ) return;
WFIFOHEAD(fd,packet_len(0x1f4));
@@ -4037,7 +4037,7 @@ void clif_traderequest(struct map_session_data* sd, const char* name)
void clif_tradestart(struct map_session_data* sd, uint8 type)
{
int fd = sd->fd;
- struct map_session_data* tsd = map_id2sd(sd->trade_partner);
+ struct map_session_data* tsd = iMap->id2sd(sd->trade_partner);
if( PACKETVER < 6 || !tsd ) {
WFIFOHEAD(fd,packet_len(0xe7));
WFIFOW(fd,0) = 0xe7;
@@ -4299,7 +4299,7 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds
if( dstsd->chatID ) {
struct chat_data *cd = NULL;
- if( (cd = (struct chat_data*)map_id2bl(dstsd->chatID)) && cd->usersd[0]==dstsd)
+ if( (cd = (struct chat_data*)iMap->id2bl(dstsd->chatID)) && cd->usersd[0]==dstsd)
clif->dispchat(cd,sd->fd);
} else if( dstsd->state.vending )
clif->showvendingboard(&dstsd->bl,dstsd->message,sd->fd);
@@ -4328,7 +4328,7 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds
ARR_FIND( 0, 5, i, dstsd->devotion[i] > 0 );
if( i < 5 ) clif->devotion(&dstsd->bl, sd);
// display link (dstsd - crusader) to sd
- if( dstsd->sc.data[SC_DEVOTION] && (d_bl = map_id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != NULL )
+ if( dstsd->sc.data[SC_DEVOTION] && (d_bl = iMap->id2bl(dstsd->sc.data[SC_DEVOTION]->val1)) != NULL )
clif->devotion(d_bl, sd);
}
@@ -4343,7 +4343,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
/**
* Hide NPC from maya purple card.
**/
- if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE))
+ if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->option&OPTION_INVISIBLE))
return;
if ( ( ud = unit_bl2ud(bl) ) && ud->walktimer != INVALID_TIMER )
@@ -4376,7 +4376,7 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) {
{
TBL_NPC* nd = (TBL_NPC*)bl;
if( nd->chat_id )
- clif->dispchat((struct chat_data*)map_id2bl(nd->chat_id),sd->fd);
+ clif->dispchat((struct chat_data*)iMap->id2bl(nd->chat_id),sd->fd);
if( nd->size == SZ_BIG )
clif->specialeffect_single(bl,423,sd->fd);
else if( nd->size == SZ_MEDIUM )
@@ -4600,16 +4600,13 @@ void clif_changemapcell(int fd, int16 m, int x, int y, int type, enum send_targe
WBUFW(buf,2) = x;
WBUFW(buf,4) = y;
WBUFW(buf,6) = type;
- mapindex_getmapname_ext(map[m].name,(char*)WBUFP(buf,8));
+ mapindex_getmapname_ext(map[m].cName ? map[m].cName : map[m].name,(char*)WBUFP(buf,8));
- if( fd )
- {
+ if( fd ) {
WFIFOHEAD(fd,packet_len(0x192));
memcpy(WFIFOP(fd,0), buf, packet_len(0x192));
WFIFOSET(fd,packet_len(0x192));
- }
- else
- {
+ } else {
struct block_list dummy_bl;
dummy_bl.type = BL_NUL;
dummy_bl.x = x;
@@ -4782,7 +4779,7 @@ int clif_outsight(struct block_list *bl,va_list ap)
clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd);
if(sd->chatID){
struct chat_data *cd;
- cd=(struct chat_data*)map_id2bl(sd->chatID);
+ cd=(struct chat_data*)iMap->id2bl(sd->chatID);
if(cd->usersd[0]==sd)
clif->dispchat(cd,tsd->fd);
}
@@ -4798,7 +4795,7 @@ int clif_outsight(struct block_list *bl,va_list ap)
clif->clearchar_skillunit((struct skill_unit *)bl,tsd->fd);
break;
case BL_NPC:
- if( !(((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE) )
+ if( !(((TBL_NPC*)bl)->option&OPTION_INVISIBLE) )
clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd);
break;
default:
@@ -4809,7 +4806,7 @@ int clif_outsight(struct block_list *bl,va_list ap)
}
if (sd && sd->fd) { //sd is watching tbl go out of view.
if (((vd=status_get_viewdata(tbl)) && vd->class_ != INVISIBLE_CLASS) &&
- !(tbl->type == BL_NPC && (((TBL_NPC*)tbl)->sc.option&OPTION_INVISIBLE)))
+ !(tbl->type == BL_NPC && (((TBL_NPC*)tbl)->option&OPTION_INVISIBLE)))
clif->clearunit_single(tbl->id,CLR_OUTSIGHT,sd->fd);
}
return 0;
@@ -5935,7 +5932,7 @@ void clif_wis_message(int fd, const char* nick, const char* mes, int mes_len)
WFIFOW(fd,2) = mes_len + NAME_LENGTH + 8;
safestrncpy((char*)WFIFOP(fd,4), nick, NAME_LENGTH);
WFIFOL(fd,28) = 0; // isAdmin; if nonzero, also displays text above char
- // TODO: WFIFOL(fd,28) = pc_get_group_level(ssd);
+ // TODO: WFIFOL(fd,28) = iPc->get_group_level(ssd);
safestrncpy((char*)WFIFOP(fd,32), mes, mes_len);
WFIFOSET(fd,WFIFOW(fd,2));
#endif
@@ -6170,14 +6167,14 @@ void clif_item_refine_list(struct map_session_data *sd)
nullpo_retv(sd);
- skill_lv = pc_checkskill(sd,WS_WEAPONREFINE);
+ skill_lv = iPc->checkskill(sd,WS_WEAPONREFINE);
fd=sd->fd;
refine_item[0] = -1;
- refine_item[1] = pc_search_inventory(sd,1010);
- refine_item[2] = pc_search_inventory(sd,1011);
- refine_item[3] = refine_item[4] = pc_search_inventory(sd,984);
+ refine_item[1] = iPc->search_inventory(sd,1010);
+ refine_item[2] = iPc->search_inventory(sd,1011);
+ refine_item[3] = refine_item[4] = iPc->search_inventory(sd,984);
WFIFOHEAD(fd, MAX_INVENTORY * 13 + 4);
WFIFOW(fd,0)=0x221;
@@ -6369,7 +6366,7 @@ void clif_vendinglist(struct map_session_data* sd, unsigned int id, struct s_ven
nullpo_retv(sd);
nullpo_retv(vending);
- nullpo_retv(vsd=map_id2sd(id));
+ nullpo_retv(vsd=iMap->id2sd(id));
fd = sd->fd;
count = vsd->vend_num;
@@ -6528,7 +6525,7 @@ void clif_party_member_info(struct party_data *p, struct map_session_data *sd)
WBUFB(buf,14) = (p->party.member[i].online)?0:1;
memcpy(WBUFP(buf,15), p->party.name, NAME_LENGTH);
memcpy(WBUFP(buf,39), sd->status.name, NAME_LENGTH);
- mapindex_getmapname_ext(map[sd->bl.m].name, (char*)WBUFP(buf,63));
+ mapindex_getmapname_ext(map[sd->bl.m].cName ? map[sd->bl.m].cName : map[sd->bl.m].name, (char*)WBUFP(buf,63));
WBUFB(buf,79) = (p->party.item&1)?1:0;
WBUFB(buf,80) = (p->party.item&2)?1:0;
clif->send(buf,packet_len(0x1e9),&sd->bl,PARTY);
@@ -6613,7 +6610,7 @@ void clif_party_invite(struct map_session_data *sd,struct map_session_data *tsd)
fd=tsd->fd;
- if( (p=party_search(sd->status.party_id))==NULL )
+ if( (p=iParty->search(sd->status.party_id))==NULL )
return;
WFIFOHEAD(fd,packet_len(cmd));
@@ -7089,31 +7086,31 @@ void clif_autospell(struct map_session_data *sd,uint16 skill_lv)
WFIFOHEAD(fd,packet_len(0x1cd));
WFIFOW(fd, 0)=0x1cd;
- if(skill_lv>0 && pc_checkskill(sd,MG_NAPALMBEAT)>0)
+ if(skill_lv>0 && iPc->checkskill(sd,MG_NAPALMBEAT)>0)
WFIFOL(fd,2)= MG_NAPALMBEAT;
else
WFIFOL(fd,2)= 0x00000000;
- if(skill_lv>1 && pc_checkskill(sd,MG_COLDBOLT)>0)
+ if(skill_lv>1 && iPc->checkskill(sd,MG_COLDBOLT)>0)
WFIFOL(fd,6)= MG_COLDBOLT;
else
WFIFOL(fd,6)= 0x00000000;
- if(skill_lv>1 && pc_checkskill(sd,MG_FIREBOLT)>0)
+ if(skill_lv>1 && iPc->checkskill(sd,MG_FIREBOLT)>0)
WFIFOL(fd,10)= MG_FIREBOLT;
else
WFIFOL(fd,10)= 0x00000000;
- if(skill_lv>1 && pc_checkskill(sd,MG_LIGHTNINGBOLT)>0)
+ if(skill_lv>1 && iPc->checkskill(sd,MG_LIGHTNINGBOLT)>0)
WFIFOL(fd,14)= MG_LIGHTNINGBOLT;
else
WFIFOL(fd,14)= 0x00000000;
- if(skill_lv>4 && pc_checkskill(sd,MG_SOULSTRIKE)>0)
+ if(skill_lv>4 && iPc->checkskill(sd,MG_SOULSTRIKE)>0)
WFIFOL(fd,18)= MG_SOULSTRIKE;
else
WFIFOL(fd,18)= 0x00000000;
- if(skill_lv>7 && pc_checkskill(sd,MG_FIREBALL)>0)
+ if(skill_lv>7 && iPc->checkskill(sd,MG_FIREBALL)>0)
WFIFOL(fd,22)= MG_FIREBALL;
else
WFIFOL(fd,22)= 0x00000000;
- if(skill_lv>9 && pc_checkskill(sd,MG_FROSTDIVER)>0)
+ if(skill_lv>9 && iPc->checkskill(sd,MG_FROSTDIVER)>0)
WFIFOL(fd,26)= MG_FROSTDIVER;
else
WFIFOL(fd,26)= 0x00000000;
@@ -7152,7 +7149,7 @@ void clif_devotion(struct block_list *src, struct map_session_data *tsd)
for( i = 0; i < 5; i++ )
WBUFL(buf,6+4*i) = sd->devotion[i];
- WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, pc_checkskill(sd, CR_DEVOTION));
+ WBUFW(buf,26) = skill->get_range2(src, CR_DEVOTION, iPc->checkskill(sd, CR_DEVOTION));
}
if( tsd )
@@ -8086,7 +8083,7 @@ void clif_callpartner(struct map_session_data *sd)
if( sd->status.partner_id )
{
const char *p;
- if( ( p = map_charid2nick(sd->status.partner_id) ) != NULL )
+ if( ( p = iMap->charid2nick(sd->status.partner_id) ) != NULL )
{
memcpy(WBUFP(buf,2), p, NAME_LENGTH);
}
@@ -8209,7 +8206,7 @@ void clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd)
if( fd > 0 )
clif->authfail_fd(fd, 15);
else
- map_quit(tsd);
+ iMap->quit(tsd);
if( sd )
clif->GM_kickack(sd,tsd->status.account_id);
@@ -8484,7 +8481,7 @@ void clif_refresh(struct map_session_data *sd)
int i;
nullpo_retv(sd);
- clif->changemap(sd,sd->mapindex,sd->bl.x,sd->bl.y);
+ clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y);
clif->inventorylist(sd);
if(pc_iscarton(sd)) {
clif->cartlist(sd);
@@ -8514,7 +8511,7 @@ void clif_refresh(struct map_session_data *sd)
}
if( sd->ed )
clif->elemental_info(sd);
- map_foreachinrange(clif->getareachar,&sd->bl,AREA_SIZE,BL_ALL,sd);
+ iMap->foreachinrange(clif->getareachar,&sd->bl,AREA_SIZE,BL_ALL,sd);
clif->weather_check(sd);
if( sd->chatID )
chat_leavechat(sd,0);
@@ -8534,8 +8531,8 @@ void clif_refresh(struct map_session_data *sd)
if( disguised(&sd->bl) ) {/* refresh-da */
short disguise = sd->disguise;
- pc_disguise(sd, -1);
- pc_disguise(sd, disguise);
+ iPc->disguise(sd, -1);
+ iPc->disguise(sd, disguise);
}
}
@@ -8574,7 +8571,7 @@ void clif_charnameack (int fd, struct block_list *bl)
memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH);
if( ssd->status.party_id ) {
- p = party_search(ssd->status.party_id);
+ p = iParty->search(ssd->status.party_id);
}
if( ssd->status.guild_id ) {
if( ( g = ssd->guild ) != NULL ) {
@@ -8698,10 +8695,10 @@ void clif_charnameupdate (struct map_session_data *ssd)
if (!battle_config.display_party_name) {
if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = ssd->guild) != NULL)
- p = party_search(ssd->status.party_id);
+ p = iParty->search(ssd->status.party_id);
}else{
if (ssd->status.party_id > 0)
- p = party_search(ssd->status.party_id);
+ p = iParty->search(ssd->status.party_id);
}
if( ssd->status.guild_id > 0 && (g = ssd->guild) != NULL )
@@ -8887,7 +8884,7 @@ void clif_feel_info(struct map_session_data* sd, unsigned char feel_level, unsig
void clif_hate_info(struct map_session_data *sd, unsigned char hate_level,int class_, unsigned char type)
{
if( pcdb_checkid(class_) ) {
- clif->starskill(sd, job_name(class_), class_, hate_level, type ? 10 : 11);
+ clif->starskill(sd, iPc->job_name(class_), class_, hate_level, type ? 10 : 11);
} else if( mobdb_checkid(class_) ) {
clif->starskill(sd, mob_db(class_)->jname, class_, hate_level, type ? 10 : 11);
} else {
@@ -9002,7 +8999,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts
// Inventory position
WBUFW(buf, n*s+43) = i + 2;
// Add refine, identify flag, element, etc.
- clif->item_sub(WBUFP(buf,0), n*s+45, &tsd->status.inventory[i], tsd->inventory_data[i], pc_equippoint(tsd, i));
+ clif->item_sub(WBUFP(buf,0), n*s+45, &tsd->status.inventory[i], tsd->inventory_data[i], iPc->equippoint(tsd, i));
// Add cards
clif->addcards(WBUFP(buf, n*s+55), &tsd->status.inventory[i]);
// Expiration date stuff, if all of those are set to 0 then the client doesn't show anything related (6 bytes)
@@ -9251,7 +9248,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) {
}
//Check for double login.
- bl = map_id2bl(account_id);
+ bl = iMap->id2bl(account_id);
if(bl && bl->type != BL_PC) {
ShowError("clif_parse_WantToConnection: a non-player object already has id %d, please increase the starting account number\n", account_id);
WFIFOHEAD(fd,packet_len(0x6a));
@@ -9274,7 +9271,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) {
sd->fd = fd;
session[fd]->session_data = sd;
- pc_setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd);
+ iPc->setnewpc(sd, account_id, char_id, login_id1, client_tick, sex, fd);
#if PACKETVER < 20070521
WFIFOHEAD(fd,4);
@@ -9320,18 +9317,19 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
return;
if (!sd->state.active) { //Character loading is not complete yet!
- //Let pc_reg_received reinvoke this when ready.
+ //Let iPc->reg_received reinvoke this when ready.
sd->state.connect_new = 0;
return;
}
if (sd->state.rewarp) { //Rewarp player.
sd->state.rewarp = 0;
- clif->changemap(sd, sd->mapindex, sd->bl.x, sd->bl.y);
+ clif->changemap(sd, sd->bl.m, sd->bl.x, sd->bl.y);
return;
}
sd->state.warping = 0;
+ sd->state.dialog = 0;/* reset when warping, client dialog will go missing */
// look
#if PACKETVER < 4
@@ -9344,8 +9342,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if(sd->vd.cloth_color)
clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF);
// item
- clif->inventorylist(sd); // inventory list first, otherwise deleted items in pc_checkitem show up as 'unknown item'
- pc_checkitem(sd);
+ clif->inventorylist(sd); // inventory list first, otherwise deleted items in iPc->checkitem show up as 'unknown item'
+ iPc->checkitem(sd);
// cart
if(pc_iscarton(sd)) {
@@ -9363,30 +9361,30 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
guild->send_memberinfoshort(sd,1);
if(battle_config.pc_invincible_time > 0) {
- pc_setinvincibletimer(sd,battle_config.pc_invincible_time);
+ iPc->setinvincibletimer(sd,battle_config.pc_invincible_time);
}
if( map[sd->bl.m].users++ == 0 && battle_config.dynamic_mobs )
- map_spawnmobs(sd->bl.m);
+ iMap->spawnmobs(sd->bl.m);
if( !(sd->sc.option&OPTION_INVISIBLE) ) { // increment the number of pvp players on the map
map[sd->bl.m].users_pvp++;
}
- if( map[sd->bl.m].instance_id ) {
- instance[map[sd->bl.m].instance_id].users++;
- instance_check_idle(map[sd->bl.m].instance_id);
+ if( map[sd->bl.m].instance_id >= 0 ) {
+ instances[map[sd->bl.m].instance_id].users++;
+ instance->check_idle(map[sd->bl.m].instance_id);
}
sd->state.debug_remove_map = 0; // temporary state to track double remove_map's [FlavioJS]
// reset the callshop flag if the player changes map
sd->state.callshop = 0;
- map_addblock(&sd->bl);
+ iMap->addblock(&sd->bl);
clif->spawn(&sd->bl);
// Party
// (needs to go after clif_spawn() to show hp bars correctly)
if(sd->status.party_id) {
- party_send_movemap(sd);
+ iParty->send_movemap(sd);
clif->party_hp(sd); // Show hp after displacement [LuzZza]
}
@@ -9395,7 +9393,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if(map[sd->bl.m].flag.pvp && !(sd->sc.option&OPTION_INVISIBLE)) {
if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris]
if (!map[sd->bl.m].flag.pvp_nocalcrank)
- sd->pvp_timer = add_timer(gettick()+200, pc_calc_pvprank_timer, sd->bl.id, 0);
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+200, iPc->calc_pvprank_timer, sd->bl.id, 0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
sd->pvp_point = 5;
@@ -9415,7 +9413,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
clif->map_property(sd, MAPPROPERTY_AGITZONE);
// info about nearby objects
// must use foreachinarea (CIRCULAR_AREA interferes with foreachinrange)
- map_foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_ALL, sd);
+ iMap->foreachinarea(clif->getareachar, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_ALL, sd);
// pet
if( sd->pd ) {
@@ -9423,7 +9421,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
clif->message(sd->fd, msg_txt(666));
pet_menu(sd, 3); //Option 3 is return to egg.
} else {
- map_addblock(&sd->pd->bl);
+ iMap->addblock(&sd->pd->bl);
clif->spawn(&sd->pd->bl);
clif->send_petdata(sd,sd->pd,0,0);
clif->send_petstatus(sd);
@@ -9433,7 +9431,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
//homunculus [blackhole89]
if( homun_alive(sd->hd) ) {
- map_addblock(&sd->hd->bl);
+ iMap->addblock(&sd->hd->bl);
clif->spawn(&sd->hd->bl);
clif->send_homdata(sd,SP_ACK,0);
clif->hominfo(sd,sd->hd,1);
@@ -9442,11 +9440,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if( battle_config.hom_setting&0x8 )
status_calc_bl(&sd->hd->bl, SCB_SPEED); //Homunc mimic their master's speed on each map change
if( !(battle_config.hom_setting&0x2) )
- skill->unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately
+ skill->unit_move(&sd->hd->bl,iTimer->gettick(),1); // apply land skills immediately
}
if( sd->md ) {
- map_addblock(&sd->md->bl);
+ iMap->addblock(&sd->md->bl);
clif->spawn(&sd->md->bl);
clif->mercenary_info(sd);
clif->mercenary_skillblock(sd);
@@ -9454,7 +9452,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
}
if( sd->ed ) {
- map_addblock(&sd->ed->bl);
+ iMap->addblock(&sd->ed->bl);
clif->spawn(&sd->ed->bl);
clif->elemental_info(sd);
clif->elemental_updatestatus(sd,SP_HP);
@@ -9486,7 +9484,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
sc_start(&sd->bl,SC_NOCHAT,100,0,0);
//Auron reported that This skill only triggers when you logon on the map o.O [Skotlex]
- if ((lv = pc_checkskill(sd,SG_KNOWLEDGE)) > 0) {
+ if ((lv = iPc->checkskill(sd,SG_KNOWLEDGE)) > 0) {
if(sd->bl.m == sd->feel_map[0].m
|| sd->bl.m == sd->feel_map[1].m
|| sd->bl.m == sd->feel_map[2].m)
@@ -9499,13 +9497,13 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if(homun_alive(sd->hd))
homun->init_timers(sd->hd);
- if (night_flag && map[sd->bl.m].flag.nightenabled) {
+ if (iMap->night_flag && map[sd->bl.m].flag.nightenabled) {
sd->state.night = 1;
clif->status_change(&sd->bl, SI_NIGHT, 1, 0, 0, 0, 0);
}
// Notify everyone that this char logged in [Skotlex].
- map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1);
+ iMap->map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1);
//Login Event
npc_script_event(sd, NPCE_LOGIN);
@@ -9536,7 +9534,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
(map_flag_gvg(sd->state.pmap) || map_flag_gvg(sd->bl.m) || map[sd->state.pmap].flag.battleground || map[sd->bl.m].flag.battleground) )
status_calc_bl(&sd->bl, SCB_FLEE); //Refresh flee penalty
- if( night_flag && map[sd->bl.m].flag.nightenabled ) { //Display night.
+ if( iMap->night_flag && map[sd->bl.m].flag.nightenabled ) { //Display night.
if( !sd->state.night ) {
sd->state.night = 1;
clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_NIGHT);
@@ -9558,7 +9556,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
clif->broadcast(&sd->bl, output, strlen(output) + 1, 0x10, SELF);
}
- map_iwall_get(sd); // Updates Walls Info on this Map to Client
+ iMap->iwall_get(sd); // Updates Walls Info on this Map to Client
status_calc_pc(sd, false);/* some conditions are map-dependent so we must recalculate */
sd->state.changemap = false;
@@ -9587,7 +9585,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if(map[sd->bl.m].flag.loadevent) // Lance
npc_script_event(sd, NPCE_LOADMAP);
- if (pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd)) //blindness [Komurka]
+ if (iPc->checkskill(sd, SG_DEVIL) && !iPc->nextjobexp(sd)) //blindness [Komurka]
clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL);
if (sd->sc.opt2) //Client loses these on warp.
@@ -9596,7 +9594,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
clif->weather_check(sd);
// For automatic triggering of NPCs after map loading (so you don't need to walk 1 step first)
- if (map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC))
+ if (iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC))
npc_touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y);
else
sd->areanpc_id = 0;
@@ -9615,7 +9613,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
// Trigger skill effects if you appear standing on them
if(!battle_config.pc_invincible_time)
- skill->unit_move(&sd->bl,gettick(),1);
+ skill->unit_move(&sd->bl,iTimer->gettick(),1);
}
@@ -9639,7 +9637,7 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd)
{
sd->client_tick = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- clif->notify_time(sd, gettick());
+ clif->notify_time(sd, iTimer->gettick());
}
@@ -9719,7 +9717,7 @@ void clif_parse_progressbar(int fd, struct map_session_data * sd)
{
int npc_id = sd->progressbar.npc_id;
- if( gettick() < sd->progressbar.timeout && sd->st )
+ if( iTimer->gettick() < sd->progressbar.timeout && sd->st )
sd->st->state = END;
sd->progressbar.npc_id = sd->progressbar.timeout = 0;
@@ -9750,7 +9748,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd)
if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH])
return;
- pc_delinvincibletimer(sd);
+ iPc->delinvincibletimer(sd);
RFIFOPOS(fd, packet_db[RFIFOW(fd,0)].pos[0], &x, &y, NULL);
@@ -9786,7 +9784,7 @@ void clif_parse_QuitGame(int fd, struct map_session_data *sd)
{
/* Rovert's prevent logout option fixed [Valaris] */
if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] &&
- (!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) )
+ (!battle_config.prevent_logout || DIFF_TICK(iTimer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) )
{
set_eof(fd);
clif->disconnect_ack(sd, 0);
@@ -9809,7 +9807,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd)
if( id < 0 && -id == sd->bl.id ) // for disguises [Valaris]
id = sd->bl.id;
- bl = map_id2bl(id);
+ bl = iMap->id2bl(id);
if( bl == NULL )
return; // Lagged clients could request names of already gone mobs/players. [Skotlex]
@@ -9821,13 +9819,13 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd)
sc = status_get_sc(bl);
if (sc && sc->option&OPTION_INVISIBLE && !disguised(bl) &&
bl->type != BL_NPC && //Skip hidden NPCs which can be seen using Maya Purple
- pc_get_group_level(sd) < battle_config.hack_info_GM_level
+ iPc->get_group_level(sd) < battle_config.hack_info_GM_level
) {
char gm_msg[256];
sprintf(gm_msg, "Hack on NameRequest: character '%s' (account: %d) requested the name of an invisible target (id: %d).\n", sd->status.name, sd->status.account_id, id);
ShowWarning(gm_msg);
// information is sent to all online GMs
- intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
+ intif_wis_message_to_gm(iMap->wisp_server_name, battle_config.hack_info_GM_level, gm_msg);
return;
}
*/
@@ -9836,10 +9834,11 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd)
}
int clif_undisguise_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data * sd;
- if( (sd = map_id2sd(id)) && sd->fontcolor && sd->disguise == sd->status.class_ ) {
- pc_disguise(sd,-1);
+ if( (sd = iMap->id2sd(id)) ) {
+ sd->fontcolor_tid = INVALID_TIMER;
+ if( sd->fontcolor && sd->disguise == sd->status.class_ )
+ iPc->disguise(sd,-1);
}
- sd->fontcolor_tid = INVALID_TIMER;
return 0;
}
@@ -9867,9 +9866,9 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
return;
if( battle_config.min_chat_delay ) { //[Skotlex]
- if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0)
+ if (DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0)
return;
- sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay;
}
if( sd->gcbind ) {
@@ -9880,14 +9879,16 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
unsigned char mylen = 1;
if( sd->disguise == -1 ) {
- pc_disguise(sd,sd->status.class_);
+ sd->fontcolor_tid = iTimer->add_timer(iTimer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0);
+ iPc->disguise(sd,sd->status.class_);
if( pc_isdead(sd) )
clif_clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd);
- sd->fontcolor_tid = add_timer(gettick()+5000, clif->undisguise_timer, sd->bl.id, 0);
+ if( unit_is_walking(&sd->bl) )
+ clif->move(&sd->ud);
} else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != INVALID_TIMER ) {
const struct TimerData *timer;
- if( (timer = get_timer(sd->fontcolor_tid)) ) {
- settick_timer(sd->fontcolor_tid, timer->tick+5000);
+ if( (timer = iTimer->get_timer(sd->fontcolor_tid)) ) {
+ iTimer->settick_timer(sd->fontcolor_tid, timer->tick+5000);
}
}
@@ -9937,7 +9938,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
WFIFOSET(fd, WFIFOW(fd,2));
#ifdef PCRE_SUPPORT
// trigger listening npcs
- map_foreachinrange(npc_chat_sub, &sd->bl, AREA_SIZE, BL_NPC, text, textlen, &sd->bl);
+ iMap->foreachinrange(npc_chat_sub, &sd->bl, AREA_SIZE, BL_NPC, text, textlen, &sd->bl);
#endif
// Chat logging type 'O' / Global Chat
@@ -10018,7 +10019,7 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd)
{
int emoticon = RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- if (battle_config.basic_skill_check == 0 || pc_checkskill(sd, NV_BASIC) >= 2) {
+ if (battle_config.basic_skill_check == 0 || iPc->checkskill(sd, NV_BASIC) >= 2) {
if (emoticon == E_MUTE) {// prevent use of the mute emote [Valaris]
clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 1);
return;
@@ -10058,7 +10059,7 @@ void clif_user_count(struct map_session_data* sd, int count) {
/// 00c1
void clif_parse_HowManyConnections(int fd, struct map_session_data *sd)
{
- clif->user_count(sd, map_getusers());
+ clif->user_count(sd, iMap->getusers());
}
@@ -10097,19 +10098,19 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
if( sd->sc.data[SC_BASILICA] || sd->sc.data[SC__SHADOWFORM] )
return;
- if (!battle_config.sdelay_attack_enable && pc_checkskill(sd, SA_FREECAST) <= 0) {
+ if (!battle_config.sdelay_attack_enable && iPc->checkskill(sd, SA_FREECAST) <= 0) {
if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) {
clif->skill_fail(sd, 1, USESKILL_FAIL_SKILLINTERVAL, 0);
return;
}
}
- pc_delinvincibletimer(sd);
+ iPc->delinvincibletimer(sd);
sd->idletime = last_tick;
unit_attack(&sd->bl, target_id, action_type != 0);
break;
case 0x02: // sitdown
- if (battle_config.basic_skill_check && pc_checkskill(sd, NV_BASIC) < 3) {
+ if (battle_config.basic_skill_check && iPc->checkskill(sd, NV_BASIC) < 3) {
clif->skill_fail(sd, 1, USESKILL_FAIL_LEVEL, 2);
break;
}
@@ -10139,7 +10140,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
clif->standing(&sd->bl);
return;
}
- pc_setstand(sd);
+ iPc->setstand(sd);
skill->sit(sd,0);
clif->standing(&sd->bl);
break;
@@ -10274,7 +10275,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd)
clif->pActionRequest_sub(sd,
RFIFOB(fd,packet_db[RFIFOW(fd,0)].pos[1]),
RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]),
- gettick()
+ iTimer->gettick()
);
}
@@ -10287,12 +10288,12 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd)
void clif_parse_Restart(int fd, struct map_session_data *sd) {
switch(RFIFOB(fd,2)) {
case 0x00:
- pc_respawn(sd,CLR_RESPAWN);
+ iPc->respawn(sd,CLR_RESPAWN);
break;
case 0x01:
/* Rovert's Prevent logout option - Fixed [Valaris] */
if( !sd->sc.data[SC_CLOAKING] && !sd->sc.data[SC_HIDING] && !sd->sc.data[SC_CHASEWALK] && !sd->sc.data[SC_CLOAKINGEXCEED] &&
- (!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) )
+ (!battle_config.prevent_logout || DIFF_TICK(iTimer->gettick(), sd->canlog_tick) > battle_config.prevent_logout) )
{ //Send to char-server for character selection.
chrif_charselectreq(sd, session[fd]->client_addr);
} else {
@@ -10324,10 +10325,10 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
return;
if (battle_config.min_chat_delay) { //[Skotlex]
- if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0) {
+ if (DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0) {
return;
}
- sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay;
}
// Chat logging type 'W' / Whisper
@@ -10416,7 +10417,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
}
// searching destination character
- dstsd = map_nick2sd(target);
+ dstsd = iMap->nick2sd(target);
if (dstsd == NULL || strcmp(dstsd->status.name, target) != 0) {
// player is not on this map-server
@@ -10430,7 +10431,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
// if player ignores everyone
if (dstsd->state.ignoreAll) {
- if (dstsd->sc.option & OPTION_INVISIBLE && pc_get_group_level(sd) < pc_get_group_level(dstsd))
+ if (dstsd->sc.option & OPTION_INVISIBLE && iPc->get_group_level(sd) < iPc->get_group_level(dstsd))
clif->wis_end(fd, 1); // 1: target character is not loged in
else
clif->wis_end(fd, 3); // 3: everyone ignored by target
@@ -10441,7 +10442,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
if( dstsd->state.autotrade == 1 ) {
char output[256];
sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name);
- clif->wis_message(fd, wisp_server_name, output, strlen(output) + 1);
+ clif->wis_message(fd, iMap->wisp_server_name, output, strlen(output) + 1);
return;
}
@@ -10487,7 +10488,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd)
map_object_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- fitem = (struct flooritem_data*)map_id2bl(map_object_id);
+ fitem = (struct flooritem_data*)iMap->id2bl(map_object_id);
do {
if (pc_isdead(sd)) {
@@ -10511,7 +10512,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd)
if (pc_cant_act(sd))
break;
- if (!pc_takeitem(sd, fitem))
+ if (!iPc->takeitem(sd, fitem))
break;
return;
@@ -10544,7 +10545,7 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd)
))
break;
- if (!pc_dropitem(sd, item_index, item_amount))
+ if (!iPc->dropitem(sd, item_index, item_amount))
break;
return;
@@ -10577,7 +10578,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
if(n <0 || n >= MAX_INVENTORY)
return;
- if (!pc_useitem(sd,n))
+ if (!iPc->useitem(sd,n))
clif->useitemack(sd,n,0,false); //Send an empty ack packet or the client gets stuck.
}
@@ -10619,9 +10620,9 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd)
//Client doesn't send the position for ammo.
if(sd->inventory_data[index]->type == IT_AMMO)
- pc_equipitem(sd,index,EQP_AMMO);
+ iPc->equipitem(sd,index,EQP_AMMO);
else
- pc_equipitem(sd,index,RFIFOW(fd,4));
+ iPc->equipitem(sd,index,RFIFOW(fd,4));
}
void clif_hercules_chsys_delete(struct hChSysCh *channel) {
@@ -10734,7 +10735,7 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd)
index = RFIFOW(fd,2)-2;
- pc_unequipitem(sd,index,1);
+ iPc->unequipitem(sd,index,1);
}
@@ -10754,12 +10755,12 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd)
if ( pc_cant_act2(sd) )
return;
- bl = map_id2bl(RFIFOL(fd,2));
+ bl = iMap->id2bl(RFIFOL(fd,2));
if (!bl) return;
switch (bl->type) {
case BL_MOB:
case BL_PC:
- clif->pActionRequest_sub(sd, 0x07, bl->id, gettick());
+ clif->pActionRequest_sub(sd, 0x07, bl->id, iTimer->gettick());
break;
case BL_NPC:
if( bl->m != -1 )// the user can't click floating npcs directly (hack attempt)
@@ -10871,7 +10872,7 @@ void clif_parse_CreateChatRoom(int fd, struct map_session_data* sd)
if (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM)
return;
- if(battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 4) {
+ if(battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 4) {
clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,3);
return;
}
@@ -10978,7 +10979,7 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd)
{
struct map_session_data *t_sd;
- t_sd = map_id2sd(RFIFOL(fd,2));
+ t_sd = iMap->id2sd(RFIFOL(fd,2));
if(!sd->chatID && pc_cant_act(sd))
return; //You can trade while in a chatroom.
@@ -10989,7 +10990,7 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd)
return;
}
- if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 1) {
+ if( battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 1) {
clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,0);
return;
}
@@ -11063,7 +11064,7 @@ void clif_parse_PutItemToCart(int fd,struct map_session_data *sd)
return;
if (!pc_iscarton(sd))
return;
- pc_putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4));
+ iPc->putitemtocart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4));
}
@@ -11073,7 +11074,7 @@ void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd)
{
if (!pc_iscarton(sd))
return;
- pc_getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4));
+ iPc->getitemfromcart(sd,RFIFOW(fd,2)-2,RFIFOL(fd,4));
}
@@ -11085,11 +11086,11 @@ void clif_parse_RemoveOption(int fd,struct map_session_data *sd)
* Attempts to remove these options when this function is called (will remove all available)
**/
#ifdef NEW_CARTS
- pc_setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
+ iPc->setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
if( sd->sc.data[SC_PUSH_CART] )
- pc_setcart(sd,0);
+ iPc->setcart(sd,0);
#else
- pc_setoption(sd,sd->sc.option&~(OPTION_CART|OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
+ iPc->setoption(sd,sd->sc.option&~(OPTION_CART|OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR));
#endif
}
@@ -11100,7 +11101,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
{// TODO: State tracking?
int type;
- if( sd && pc_checkskill(sd, MC_CHANGECART) < 1 )
+ if( sd && iPc->checkskill(sd, MC_CHANGECART) < 1 )
return;
type = (int)RFIFOW(fd,2);
@@ -11121,7 +11122,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
(type == 2 && sd->status.base_level > 40) ||
(type == 1))
#endif
- pc_setcart(sd,type);
+ iPc->setcart(sd,type);
}
@@ -11134,7 +11135,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
/// the like
void clif_parse_StatusUp(int fd,struct map_session_data *sd)
{
- pc_statusup(sd,RFIFOW(fd,2));
+ iPc->statusup(sd,RFIFOW(fd,2));
}
@@ -11142,7 +11143,7 @@ void clif_parse_StatusUp(int fd,struct map_session_data *sd)
/// 0112 <skill id>.W
void clif_parse_SkillUp(int fd,struct map_session_data *sd)
{
- pc_skillup(sd,RFIFOW(fd,2));
+ iPc->skillup(sd,RFIFOW(fd,2));
}
void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, uint16 skill_id, uint16 skill_lv, int target_id)
@@ -11242,7 +11243,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
{
uint16 skill_id, skill_lv;
int tmp, target_id;
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
skill_lv = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0]);
skill_id = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[1]);
@@ -11313,7 +11314,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
if( skill_lv != sd->skillitemlv )
skill_lv = sd->skillitemlv;
if( !(tmp&INF_SELF_SKILL) )
- pc_delinvincibletimer(sd); // Target skills thru items cancel invincibility. [Inkfish]
+ iPc->delinvincibletimer(sd); // Target skills thru items cancel invincibility. [Inkfish]
unit_skilluse_id(&sd->bl, target_id, skill_id, skill_lv);
return;
}
@@ -11326,12 +11327,12 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
else
skill_lv = 0;
} else {
- tmp = pc_checkskill(sd, skill_id);
+ tmp = iPc->checkskill(sd, skill_id);
if( skill_lv > tmp )
skill_lv = tmp;
}
- pc_delinvincibletimer(sd);
+ iPc->delinvincibletimer(sd);
if( skill_lv )
unit_skilluse_id(&sd->bl, target_id, skill_id, skill_lv);
@@ -11342,7 +11343,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
*------------------------------------------*/
void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 skill_lv, uint16 skill_id, short x, short y, int skillmoreinfo)
{
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
if( !(skill->get_inf(skill_id)&INF_GROUND_SKILL) )
return; //Using a target skill on the ground? WRONG.
@@ -11394,7 +11395,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski
return; //Can't use skills while a menu is open.
}
- pc_delinvincibletimer(sd);
+ iPc->delinvincibletimer(sd);
if( sd->skillitem == skill_id ) {
if( skill_lv != sd->skillitemlv )
@@ -11403,7 +11404,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski
} else {
int lv;
sd->skillitem = sd->skillitemlv = 0;
- if( (lv = pc_checkskill(sd, skill_id)) > 0 ) {
+ if( (lv = iPc->checkskill(sd, skill_id)) > 0 ) {
if( skill_lv > lv )
skill_lv = lv;
unit_skilluse_pos(&sd->bl, x, y, skill_id,skill_lv);
@@ -11470,7 +11471,7 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd)
return;
}
- pc_delinvincibletimer(sd);
+ iPc->delinvincibletimer(sd);
skill->castend_map(sd,skill_id,map_name);
}
@@ -11480,7 +11481,7 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd)
void clif_parse_RequestMemo(int fd,struct map_session_data *sd)
{
if (!pc_isdead(sd))
- pc_memo(sd,-1);
+ iPc->memo(sd,-1);
}
@@ -11590,7 +11591,7 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd)
#ifdef SECURE_NPCTIMEOUT
if( sd->npc_idle_timer != INVALID_TIMER ) {
#endif
- TBL_NPC* nd = map_id2nd(npc_id);
+ TBL_NPC* nd = iMap->id2nd(npc_id);
ShowWarning("Invalid menu selection on npc %d:'%s' - got %d, valid range is [%d..%d] (player AID:%d, CID:%d, name:'%s')!\n", npc_id, (nd)?nd->name:"invalid npc id", select, 1, sd->npc_menu, sd->bl.id, sd->status.char_id, sd->status.name);
clif->GM_kick(NULL,sd);
#ifdef SECURE_NPCTIMEOUT
@@ -11728,7 +11729,7 @@ void clif_parse_InsertCard(int fd,struct map_session_data *sd)
{
if (sd->state.trading != 0)
return;
- pc_insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2);
+ iPc->insert_card(sd,RFIFOW(fd,2)-2,RFIFOW(fd,4)-2);
}
@@ -11741,7 +11742,7 @@ void clif_parse_SolveCharName(int fd, struct map_session_data *sd)
int charid;
charid = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- map_reqnickdb(sd, charid);
+ iMap->reqnickdb(sd, charid);
}
@@ -11932,12 +11933,12 @@ void clif_parse_CreateParty(int fd, struct map_session_data *sd)
clif->message(fd, msg_txt(227));
return;
}
- if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 ) {
+ if( battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 7 ) {
clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4);
return;
}
- party_create(sd,name,0,0);
+ iParty->create(sd,name,0,0);
}
void clif_parse_CreateParty2(int fd, struct map_session_data *sd)
@@ -11951,12 +11952,12 @@ void clif_parse_CreateParty2(int fd, struct map_session_data *sd)
clif->message(fd, msg_txt(227));
return;
}
- if( battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 7 ) {
+ if( battle_config.basic_skill_check && iPc->checkskill(sd,NV_BASIC) < 7 ) {
clif->skill_fail(sd,1,USESKILL_FAIL_LEVEL,4);
return;
}
- party_create(sd,name,item1,item2);
+ iParty->create(sd,name,item1,item2);
}
@@ -11972,14 +11973,14 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd)
return;
}
- t_sd = map_id2sd(RFIFOL(fd,2));
+ t_sd = iMap->id2sd(RFIFOL(fd,2));
if(t_sd && t_sd->state.noask) {// @noask [LuzZza]
clif->noask_sub(sd, t_sd, 1);
return;
}
- party_invite(sd, t_sd);
+ iParty->invite(sd, t_sd);
}
void clif_parse_PartyInvite2(int fd, struct map_session_data *sd)
@@ -11993,14 +11994,14 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd)
return;
}
- t_sd = map_nick2sd(name);
+ t_sd = iMap->nick2sd(name);
if(t_sd && t_sd->state.noask) { // @noask [LuzZza]
clif->noask_sub(sd, t_sd, 1);
return;
}
- party_invite(sd, t_sd);
+ iParty->invite(sd, t_sd);
}
@@ -12012,12 +12013,12 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd)
/// 1 = accept
void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd)
{
- party_reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6));
+ iParty->reply_invite(sd,RFIFOL(fd,2),RFIFOL(fd,6));
}
void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd)
{
- party_reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6));
+ iParty->reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6));
}
@@ -12029,7 +12030,7 @@ void clif_parse_LeaveParty(int fd, struct map_session_data *sd)
clif->message(fd, msg_txt(227));
return;
}
- party_leave(sd);
+ iParty->leave(sd);
}
@@ -12041,7 +12042,7 @@ void clif_parse_RemovePartyMember(int fd, struct map_session_data *sd)
clif->message(fd, msg_txt(227));
return;
}
- party_removemember(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6));
+ iParty->removemember(sd,RFIFOL(fd,2),(char*)RFIFOP(fd,6));
}
@@ -12056,7 +12057,7 @@ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd)
if( !sd->status.party_id )
return;
- p = party_search(sd->status.party_id);
+ p = iParty->search(sd->status.party_id);
if( p == NULL )
return;
@@ -12069,9 +12070,9 @@ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd)
#if PACKETVER < 20090603
//Client can't change the item-field
- party_changeoption(sd, RFIFOL(fd,2), p->party.item);
+ iParty->changeoption(sd, RFIFOL(fd,2), p->party.item);
#else
- party_changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0)));
+ iParty->changeoption(sd, RFIFOL(fd,2), ((RFIFOB(fd,6)?1:0)|(RFIFOB(fd,7)?2:0)));
#endif
}
@@ -12098,12 +12099,12 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd)
if( battle_config.min_chat_delay )
{ //[Skotlex]
- if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0)
+ if (DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0)
return;
- sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay;
}
- party_send_message(sd, text, textlen);
+ iParty->send_message(sd, text, textlen);
}
@@ -12111,7 +12112,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd)
/// 07da <account id>.L
void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd)
{
- party_changeleader(sd, map_id2sd(RFIFOL(fd,2)));
+ iParty->changeleader(sd, iMap->id2sd(RFIFOL(fd,2)));
}
@@ -12130,7 +12131,7 @@ void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd)
for(i=0; i<PARTY_BOOKING_JOBS; i++)
job[i] = RFIFOB(fd,6+i*2);
- party_booking_register(sd, level, mapid, job);
+ iParty->booking_register(sd, level, mapid, job);
}
@@ -12161,7 +12162,7 @@ void clif_parse_PartyBookingSearchReq(int fd, struct map_session_data* sd)
unsigned long lastindex = RFIFOL(fd,8);
short resultcount = RFIFOW(fd,12);
- party_booking_search(sd, level, mapid, job, lastindex, resultcount);
+ iParty->booking_search(sd, level, mapid, job, lastindex, resultcount);
}
@@ -12198,7 +12199,7 @@ void clif_PartyBookingSearchAck(int fd, struct party_booking_ad_info** results,
/// 0806
void clif_parse_PartyBookingDeleteReq(int fd, struct map_session_data* sd)
{
- if(party_booking_delete(sd))
+ if(iParty->booking_delete(sd))
clif->PartyBookingDeleteAck(sd, 0);
}
@@ -12231,7 +12232,7 @@ void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd)
for(i=0; i<PARTY_BOOKING_JOBS; i++)
job[i] = RFIFOW(fd,2+i*2);
- party_booking_update(sd, job);
+ iParty->booking_update(sd, job);
}
@@ -12359,7 +12360,7 @@ void clif_parse_OpenVending(int fd, struct map_session_data* sd)
clif->message (sd->fd, msg_txt(276)); // "You can't open a shop on this map"
return;
}
- if( map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) ) {
+ if( iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNOVENDING) ) {
clif->message (sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
return;
}
@@ -12557,7 +12558,7 @@ clif_sub_guild_invite(int fd, struct map_session_data *sd, struct map_session_da
/// 0168 <account id>.L <inviter account id>.L <inviter char id>.L
void clif_parse_GuildInvite(int fd,struct map_session_data *sd)
{
- struct map_session_data *t_sd = map_id2sd(RFIFOL(fd,2));
+ struct map_session_data *t_sd = iMap->id2sd(RFIFOL(fd,2));
if (clif_sub_guild_invite(fd, sd, t_sd))
return;
@@ -12567,7 +12568,7 @@ void clif_parse_GuildInvite(int fd,struct map_session_data *sd)
/// 0916 <char name>.24B
void clif_parse_GuildInvite2(int fd, struct map_session_data *sd)
{
- struct map_session_data *t_sd = map_nick2sd((char *)RFIFOP(fd, 2));
+ struct map_session_data *t_sd = iMap->nick2sd((char *)RFIFOP(fd, 2));
if (clif_sub_guild_invite(fd, sd, t_sd))
return;
@@ -12635,9 +12636,9 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd)
if( battle_config.min_chat_delay )
{ //[Skotlex]
- if (DIFF_TICK(sd->cantalk_tick, gettick()) > 0)
+ if (DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0)
return;
- sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay;
}
if( sd->bg_id )
@@ -12661,7 +12662,7 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd)
return;
}
- t_sd = map_id2sd(RFIFOL(fd,2));
+ t_sd = iMap->id2sd(RFIFOL(fd,2));
// @noask [LuzZza]
if(t_sd && t_sd->state.noask) {
@@ -12716,7 +12717,7 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd)
return;
}
- t_sd = map_id2sd(RFIFOL(fd,2));
+ t_sd = iMap->id2sd(RFIFOL(fd,2));
// @noask [LuzZza]
if(t_sd && t_sd->state.noask) {
@@ -12831,7 +12832,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
int tid;
tid = RFIFOL(fd,2);
- target = map_id2bl(tid);
+ target = iMap->id2bl(tid);
if (!target) {
clif->GM_kickack(sd, 0);
return;
@@ -12852,7 +12853,7 @@ void clif_parse_GMKick(int fd, struct map_session_data *sd)
case BL_MOB:
{
char command[100];
- if( !pc_can_use_command(sd, "@killmonster")) {
+ if( !iPc->can_use_command(sd, "@killmonster")) {
clif->GM_kickack(sd, 0);
return;
}
@@ -12915,7 +12916,7 @@ void clif_parse_GMRemove2(int fd, struct map_session_data* sd)
struct map_session_data* pl_sd;
account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- if( (pl_sd = map_id2sd(account_id)) != NULL ) {
+ if( (pl_sd = iMap->id2sd(account_id)) != NULL ) {
char command[NAME_LENGTH+8];
sprintf(command, "%cjumpto %s", atcommand->at_symbol, pl_sd->status.name);
atcommand->parse(fd, sd, command, 1);
@@ -12952,7 +12953,7 @@ void clif_parse_GMRecall2(int fd, struct map_session_data* sd)
struct map_session_data* pl_sd;
account_id = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
- if( (pl_sd = map_id2sd(account_id)) != NULL ) {
+ if( (pl_sd = iMap->id2sd(account_id)) != NULL ) {
char command[NAME_LENGTH+8];
sprintf(command, "%crecall %s", atcommand->at_symbol, pl_sd->status.name);
atcommand->parse(fd, sd, command, 1);
@@ -13023,10 +13024,10 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd)
//If type is 2 and the ids don't match, this is a crafted hacked packet!
//Disabled because clients keep self-muting when you give players public @ commands... [Skotlex]
- if (type == 2 /* && (pc_get_group_level(sd) > 0 || sd->bl.id != id)*/)
+ if (type == 2 /* && (iPc->get_group_level(sd) > 0 || sd->bl.id != id)*/)
return;
- dstsd = map_id2sd(id);
+ dstsd = iMap->id2sd(id);
if( dstsd == NULL )
return;
@@ -13090,7 +13091,7 @@ void clif_parse_GMChangeMapType(int fd, struct map_session_data *sd)
y = RFIFOW(fd,4);
type = RFIFOW(fd,6);
- map_setgatcell(sd->bl.m,x,y,type);
+ iMap->setgatcell(sd->bl.m,x,y,type);
clif->changemapcell(0,sd->bl.m,x,y,type,ALL_SAMEMAP);
//FIXME: once players leave the map, the client 'forgets' this information.
}
@@ -13113,7 +13114,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data* sd)
type = RFIFOB(fd,26);
if( type == 0 ) { // Add name to ignore list (block)
- if (strcmp(wisp_server_name, nick) == 0) {
+ if (strcmp(iMap->wisp_server_name, nick) == 0) {
clif->wisexin(sd, type, 1); // fail
return;
}
@@ -13240,8 +13241,8 @@ void clif_parse_NoviceDoriDori(int fd, struct map_session_data *sd)
void clif_parse_NoviceExplosionSpirits(int fd, struct map_session_data *sd)
{
if( ( sd->class_&MAPID_UPPERMASK ) == MAPID_SUPER_NOVICE ) {
- unsigned int next = pc_nextbaseexp(sd);
- if( next == 0 ) next = pc_thisbaseexp(sd);
+ unsigned int next = iPc->nextbaseexp(sd);
+ if( next == 0 ) next = iPc->thisbaseexp(sd);
if( next ) {
int percent = (int)( ( (float)sd->status.base_exp/(float)next )*1000. );
@@ -13314,7 +13315,7 @@ void clif_friendslist_send(struct map_session_data *sd)
}
for (n = 0; n < i; n++) { //Sending the online players
- if (map_charid2sd(sd->status.friends[n].char_id))
+ if (iMap->charid2sd(sd->status.friends[n].char_id))
clif->friendslist_toggle(sd, sd->status.friends[n].account_id, sd->status.friends[n].char_id, 1);
}
}
@@ -13366,7 +13367,7 @@ void clif_parse_FriendsListAdd(int fd, struct map_session_data *sd)
struct map_session_data *f_sd;
int i;
- f_sd = map_nick2sd((char*)RFIFOP(fd,2));
+ f_sd = iMap->nick2sd((char*)RFIFOP(fd,2));
// ensure that the request player's friend list is not full
ARR_FIND(0, MAX_FRIENDS, i, sd->status.friends[i].char_id == 0);
@@ -13431,7 +13432,7 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd)
return;
}
- f_sd = map_id2sd(account_id); //The account id is the same as the bl.id of players.
+ f_sd = iMap->id2sd(account_id); //The account id is the same as the bl.id of players.
if (f_sd == NULL)
return;
@@ -13496,7 +13497,7 @@ void clif_parse_FriendsListRemove(int fd, struct map_session_data *sd)
}
//remove from friend's list first
- if( (f_sd = map_id2sd(account_id)) && f_sd->status.char_id == char_id) {
+ if( (f_sd = iMap->id2sd(account_id)) && f_sd->status.char_id == char_id) {
for (i = 0; i < MAX_FRIENDS &&
(f_sd->status.friends[i].char_id != sd->status.char_id || f_sd->status.friends[i].account_id != sd->status.account_id); i++);
@@ -13577,7 +13578,7 @@ void clif_blacksmith(struct map_session_data* sd)
for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) {
if (smith_fame_list[i].id > 0) {
if (strcmp(smith_fame_list[i].name, "-") == 0 &&
- (name = map_charid2nick(smith_fame_list[i].id)) != NULL)
+ (name = iMap->charid2nick(smith_fame_list[i].id)) != NULL)
{
strncpy((char *)(WFIFOP(fd, 2 + 24 * i)), name, NAME_LENGTH);
} else
@@ -13629,7 +13630,7 @@ void clif_alchemist(struct map_session_data* sd) {
for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) {
if (chemist_fame_list[i].id > 0) {
if (strcmp(chemist_fame_list[i].name, "-") == 0 &&
- (name = map_charid2nick(chemist_fame_list[i].id)) != NULL)
+ (name = iMap->charid2nick(chemist_fame_list[i].id)) != NULL)
{
memcpy(WFIFOP(fd, 2 + 24 * i), name, NAME_LENGTH);
} else
@@ -13681,7 +13682,7 @@ void clif_taekwon(struct map_session_data* sd) {
for (i = 0; i < 10 && i < MAX_FAME_LIST; i++) {
if (taekwon_fame_list[i].id > 0) {
if (strcmp(taekwon_fame_list[i].name, "-") == 0 &&
- (name = map_charid2nick(taekwon_fame_list[i].id)) != NULL)
+ (name = iMap->charid2nick(taekwon_fame_list[i].id)) != NULL)
{
memcpy(WFIFOP(fd, 2 + 24 * i), name, NAME_LENGTH);
} else
@@ -13881,7 +13882,7 @@ void clif_parse_HomMenu(int fd, struct map_session_data *sd) { //[orn]
/// 0292
void clif_parse_AutoRevive(int fd, struct map_session_data *sd)
{
- int item_position = pc_search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED);
+ int item_position = iPc->search_inventory(sd, ITEMID_TOKEN_OF_SIEGFRIED);
if (item_position < 0)
return;
@@ -13893,7 +13894,7 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd)
return;
clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1);
- pc_delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME);
+ iPc->delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME);
}
@@ -13908,17 +13909,17 @@ void clif_check(int fd, struct map_session_data* pl_sd) {
WFIFOHEAD(fd,packet_len(0x214));
WFIFOW(fd, 0) = 0x214;
WFIFOB(fd, 2) = min(pl_sd->status.str, UINT8_MAX);
- WFIFOB(fd, 3) = pc_need_status_point(pl_sd, SP_STR, 1);
+ WFIFOB(fd, 3) = iPc->need_status_point(pl_sd, SP_STR, 1);
WFIFOB(fd, 4) = min(pl_sd->status.agi, UINT8_MAX);
- WFIFOB(fd, 5) = pc_need_status_point(pl_sd, SP_AGI, 1);
+ WFIFOB(fd, 5) = iPc->need_status_point(pl_sd, SP_AGI, 1);
WFIFOB(fd, 6) = min(pl_sd->status.vit, UINT8_MAX);
- WFIFOB(fd, 7) = pc_need_status_point(pl_sd, SP_VIT, 1);
+ WFIFOB(fd, 7) = iPc->need_status_point(pl_sd, SP_VIT, 1);
WFIFOB(fd, 8) = min(pl_sd->status.int_, UINT8_MAX);
- WFIFOB(fd, 9) = pc_need_status_point(pl_sd, SP_INT, 1);
+ WFIFOB(fd, 9) = iPc->need_status_point(pl_sd, SP_INT, 1);
WFIFOB(fd,10) = min(pl_sd->status.dex, UINT8_MAX);
- WFIFOB(fd,11) = pc_need_status_point(pl_sd, SP_DEX, 1);
+ WFIFOB(fd,11) = iPc->need_status_point(pl_sd, SP_DEX, 1);
WFIFOB(fd,12) = min(pl_sd->status.luk, UINT8_MAX);
- WFIFOB(fd,13) = pc_need_status_point(pl_sd, SP_LUK, 1);
+ WFIFOB(fd,13) = iPc->need_status_point(pl_sd, SP_LUK, 1);
WFIFOW(fd,14) = pl_sd->battle_status.batk+pl_sd->battle_status.rhw.atk+pl_sd->battle_status.lhw.atk;
WFIFOW(fd,16) = pl_sd->battle_status.rhw.atk2+pl_sd->battle_status.lhw.atk2;
WFIFOW(fd,18) = pl_sd->battle_status.matk_max;
@@ -13950,7 +13951,7 @@ void clif_parse_Check(int fd, struct map_session_data *sd)
safestrncpy(charname, (const char*)RFIFOP(fd,packet_db[RFIFOW(fd,0)].pos[0]), sizeof(charname));
- if( ( pl_sd = map_nick2sd(charname) ) == NULL || pc_get_group_level(sd) < pc_get_group_level(pl_sd) ) {
+ if( ( pl_sd = iMap->nick2sd(charname) ) == NULL || iPc->get_group_level(sd) < iPc->get_group_level(pl_sd) ) {
return;
}
@@ -14232,9 +14233,9 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd)
if ((data = itemdb_exists(sd->mail.inbox.msg[i].item.nameid)) == NULL)
return;
- switch( pc_checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) {
+ switch( iPc->checkadditem(sd, data->nameid, sd->mail.inbox.msg[i].item.amount) ) {
case ADDITEM_NEW:
- fail = ( pc_inventoryblank(sd) == 0 );
+ fail = ( iPc->inventoryblank(sd) == 0 );
break;
case ADDITEM_OVERAMOUNT:
fail = true;
@@ -14360,7 +14361,7 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd)
return;
}
- if( DIFF_TICK(sd->cansendmail_tick, gettick()) > 0 ) {
+ if( DIFF_TICK(sd->cansendmail_tick, iTimer->gettick()) > 0 ) {
clif->message(sd->fd,msg_txt(675)); //"Cannot send mails too fast!!."
clif->mail_send(fd, true); // fail
return;
@@ -14398,7 +14399,7 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd)
if( !intif_Mail_send(sd->status.account_id, &msg) )
mail_deliveryfail(sd, &msg);
- sd->cansendmail_tick = gettick() + 1000; // 1 Second flood Protection
+ sd->cansendmail_tick = iTimer->gettick() + 1000; // 1 Second flood Protection
}
@@ -14526,9 +14527,9 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd)
return;
}
- if( !pc_can_give_items(sd) || sd->status.inventory[idx].expire_time ||
+ if( !iPc->can_give_items(sd) || sd->status.inventory[idx].expire_time ||
!sd->status.inventory[idx].identify ||
- !itemdb_canauction(&sd->status.inventory[idx],pc_get_group_level(sd)) ) { // Quest Item or something else
+ !itemdb_canauction(&sd->status.inventory[idx],iPc->get_group_level(sd)) ) { // Quest Item or something else
clif->auction_setitem(sd->fd, idx, true);
return;
}
@@ -14645,10 +14646,10 @@ void clif_parse_Auction_register(int fd, struct map_session_data *sd)
{
int zeny = auction.hours*battle_config.auction_feeperhour;
- pc_delitem(sd, sd->auction.index, sd->auction.amount, 1, 6, LOG_TYPE_AUCTION);
+ iPc->delitem(sd, sd->auction.index, sd->auction.amount, 1, 6, LOG_TYPE_AUCTION);
sd->auction.amount = 0;
- pc_payzeny(sd, zeny, LOG_TYPE_AUCTION, NULL);
+ iPc->payzeny(sd, zeny, LOG_TYPE_AUCTION, NULL);
}
}
@@ -14680,7 +14681,7 @@ void clif_parse_Auction_bid(int fd, struct map_session_data *sd)
unsigned int auction_id = RFIFOL(fd,2);
int bid = RFIFOL(fd,6);
- if( !pc_can_give_items(sd) ) { //They aren't supposed to give zeny [Inkfish]
+ if( !iPc->can_give_items(sd) ) { //They aren't supposed to give zeny [Inkfish]
clif->message(sd->fd, msg_txt(246));
return;
}
@@ -14692,7 +14693,7 @@ void clif_parse_Auction_bid(int fd, struct map_session_data *sd)
else if ( CheckForCharServer() ) // char server is down (bugreport:1138)
clif->auction_message(fd, 0); // You have failed to bid into the auction
else {
- pc_payzeny(sd, bid, LOG_TYPE_AUCTION, NULL);
+ iPc->payzeny(sd, bid, LOG_TYPE_AUCTION, NULL);
intif_Auction_bid(sd->status.char_id, sd->status.name, auction_id, bid);
}
}
@@ -14877,9 +14878,9 @@ void clif_Adopt_request(struct map_session_data *sd, struct map_session_data *sr
/// 01f9 <account id>.L
void clif_parse_Adopt_request(int fd, struct map_session_data *sd)
{
- struct map_session_data *tsd = map_id2sd(RFIFOL(fd,2)), *p_sd = map_charid2sd(sd->status.partner_id);
+ struct map_session_data *tsd = iMap->id2sd(RFIFOL(fd,2)), *p_sd = iMap->charid2sd(sd->status.partner_id);
- if( pc_can_Adopt(sd, p_sd, tsd) ) {
+ if( iPc->can_Adopt(sd, p_sd, tsd) ) {
tsd->adopt_invite = sd->status.account_id;
clif->adopt_request(tsd, sd, p_sd->status.account_id);
}
@@ -14896,8 +14897,8 @@ void clif_parse_Adopt_reply(int fd, struct map_session_data *sd)
int p1_id = RFIFOL(fd,2);
int p2_id = RFIFOL(fd,6);
int result = RFIFOL(fd,10);
- struct map_session_data* p1_sd = map_id2sd(p1_id);
- struct map_session_data* p2_sd = map_id2sd(p2_id);
+ struct map_session_data* p1_sd = iMap->id2sd(p1_id);
+ struct map_session_data* p2_sd = iMap->id2sd(p2_id);
int pid = sd->adopt_invite;
sd->adopt_invite = 0;
@@ -14911,7 +14912,7 @@ void clif_parse_Adopt_reply(int fd, struct map_session_data *sd)
if( result == 0 )
return; // Rejected
- pc_adoption(p1_sd, p2_sd, sd);
+ iPc->adoption(p1_sd, p2_sd, sd);
}
@@ -14937,11 +14938,11 @@ void clif_bossmapinfo(int fd, struct mob_data *md, short flag)
} else
WFIFOB(fd,2) = 2; // First Time
} else if (md->spawn_timer != INVALID_TIMER) { // Boss is Dead
- const struct TimerData * timer_data = get_timer(md->spawn_timer);
+ const struct TimerData * timer_data = iTimer->get_timer(md->spawn_timer);
unsigned int seconds;
int hours, minutes;
- seconds = DIFF_TICK(timer_data->tick, gettick()) / 1000 + 60;
+ seconds = DIFF_TICK(timer_data->tick, iTimer->gettick()) / 1000 + 60;
hours = seconds / (60 * 60);
seconds = seconds - (60 * 60 * hours);
minutes = seconds / 60;
@@ -14962,7 +14963,7 @@ void clif_bossmapinfo(int fd, struct mob_data *md, short flag)
void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd)
{
int charid = RFIFOL(fd, 2);
- struct map_session_data* tsd = map_id2sd(charid);
+ struct map_session_data* tsd = iMap->id2sd(charid);
if (!tsd)
return;
@@ -15487,9 +15488,9 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd)
return;
if( battle_config.min_chat_delay ) {
- if( DIFF_TICK(sd->cantalk_tick, gettick()) > 0 )
+ if( DIFF_TICK(sd->cantalk_tick, iTimer->gettick()) > 0 )
return;
- sd->cantalk_tick = gettick() + battle_config.min_chat_delay;
+ sd->cantalk_tick = iTimer->gettick() + battle_config.min_chat_delay;
}
bg_send_message(sd, text, textlen);
@@ -15571,48 +15572,61 @@ void clif_font(struct map_session_data *sd)
/*==========================================
* Instancing Window
*------------------------------------------*/
-int clif_instance(int instance_id, int type, int flag)
-{
- struct map_session_data *sd;
- struct party_data *p;
+int clif_instance(int instance_id, int type, int flag) {
+ struct map_session_data *sd = NULL;
unsigned char buf[255];
+ enum send_target target = PARTY;
+
+ switch( instances[instance_id].owner_type ) {
+ case IOT_NONE:
+ return 0;
+ case IOT_GUILD:
+ target = GUILD;
+ sd = guild->getavailablesd(guild->search(instances[instance_id].owner_id));
+ break;
+ case IOT_PARTY:
+ /* default is already PARTY */
+ sd = iParty->getavailablesd(iParty->search(instances[instance_id].owner_id));
+ break;
+ case IOT_CHAR:
+ target = SELF;
+ sd = iMap->id2sd(instances[instance_id].owner_id);
+ break;
+ }
- if( (p = party_search(instance[instance_id].party_id)) == NULL || (sd = party_getavailablesd(p)) == NULL )
+ if( !sd )
return 0;
-
+
switch( type ) {
case 1:
// S 0x2cb <Instance name>.61B <Standby Position>.W
// Required to start the instancing information window on Client
// This window re-appear each "refresh" of client automatically until type 4 is send to client.
WBUFW(buf,0) = 0x02CB;
- memcpy(WBUFP(buf,2),instance[instance_id].name,INSTANCE_NAME_LENGTH);
+ memcpy(WBUFP(buf,2),instances[instance_id].name,INSTANCE_NAME_LENGTH);
WBUFW(buf,63) = flag;
- clif->send(buf,packet_len(0x02CB),&sd->bl,PARTY);
+ clif->send(buf,packet_len(0x02CB),&sd->bl,target);
break;
case 2:
// S 0x2cc <Standby Position>.W
// To announce Instancing queue creation if no maps available
WBUFW(buf,0) = 0x02CC;
WBUFW(buf,2) = flag;
- clif->send(buf,packet_len(0x02CC),&sd->bl,PARTY);
+ clif->send(buf,packet_len(0x02CC),&sd->bl,target);
break;
case 3:
case 4:
// S 0x2cd <Instance Name>.61B <Instance Remaining Time>.L <Instance Noplayers close time>.L
WBUFW(buf,0) = 0x02CD;
- memcpy(WBUFP(buf,2),instance[instance_id].name,61);
- if( type == 3 )
- {
- WBUFL(buf,63) = (uint32)instance[instance_id].progress_timeout;
+ memcpy(WBUFP(buf,2),instances[instance_id].name,61);
+ if( type == 3 ) {
+ WBUFL(buf,63) = instances[instance_id].progress_timeout;
WBUFL(buf,67) = 0;
- }
- else
- {
+ } else {
WBUFL(buf,63) = 0;
- WBUFL(buf,67) = (uint32)instance[instance_id].idle_timeout;
+ WBUFL(buf,67) = instances[instance_id].idle_timeout;
}
- clif->send(buf,packet_len(0x02CD),&sd->bl,PARTY);
+ clif->send(buf,packet_len(0x02CD),&sd->bl,target);
break;
case 5:
// S 0x2ce <Message ID>.L
@@ -15624,7 +15638,7 @@ int clif_instance(int instance_id, int type, int flag)
WBUFW(buf,0) = 0x02CE;
WBUFL(buf,2) = flag;
//WBUFL(buf,6) = EnterLimitDate;
- clif->send(buf,packet_len(0x02CE),&sd->bl,PARTY);
+ clif->send(buf,packet_len(0x02CE),&sd->bl,target);
break;
}
return 0;
@@ -15632,24 +15646,24 @@ int clif_instance(int instance_id, int type, int flag)
void clif_instance_join(int fd, int instance_id)
{
- if( instance[instance_id].idle_timer != INVALID_TIMER ) {
+ if( instances[instance_id].idle_timer != INVALID_TIMER ) {
WFIFOHEAD(fd,packet_len(0x02CD));
WFIFOW(fd,0) = 0x02CD;
- memcpy(WFIFOP(fd,2),instance[instance_id].name,61);
+ memcpy(WFIFOP(fd,2),instances[instance_id].name,61);
WFIFOL(fd,63) = 0;
- WFIFOL(fd,67) = (uint32)instance[instance_id].idle_timeout;
+ WFIFOL(fd,67) = instances[instance_id].idle_timeout;
WFIFOSET(fd,packet_len(0x02CD));
- } else if( instance[instance_id].progress_timer != INVALID_TIMER ) {
+ } else if( instances[instance_id].progress_timer != INVALID_TIMER ) {
WFIFOHEAD(fd,packet_len(0x02CD));
WFIFOW(fd,0) = 0x02CD;
- memcpy(WFIFOP(fd,2),instance[instance_id].name,61);
- WFIFOL(fd,63) = (uint32)instance[instance_id].progress_timeout;;
+ memcpy(WFIFOP(fd,2),instances[instance_id].name,61);
+ WFIFOL(fd,63) = instances[instance_id].progress_timeout;
WFIFOL(fd,67) = 0;
WFIFOSET(fd,packet_len(0x02CD));
} else {
WFIFOHEAD(fd,packet_len(0x02CB));
WFIFOW(fd,0) = 0x02CB;
- memcpy(WFIFOP(fd,2),instance[instance_id].name,61);
+ memcpy(WFIFOP(fd,2),instances[instance_id].name,61);
WFIFOW(fd,63) = 0;
WFIFOSET(fd,packet_len(0x02CB));
}
@@ -16822,14 +16836,14 @@ void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) {
if (!itemdb_isstackable2(data))
get_count = 1;
- pc_paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay);// [Ryuuzaki]
+ iPc->paycash(sd, clif->cs.data[tab][j]->price * qty, kafra_pay);// [Ryuuzaki]
for (k = 0; k < qty; k += get_count) {
if (!pet_create_egg(sd, data->nameid)) {
memset(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = data->nameid;
item_tmp.identify = 1;
- switch (pc_additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) {
+ switch (iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_NPC)) {
case 0:
result = CSBR_SUCCESS;
break;
@@ -16851,7 +16865,7 @@ void clif_parse_CashShopBuy(int fd, struct map_session_data *sd) {
}
if( result != CSBR_SUCCESS )
- pc_getcash(sd, clif->cs.data[tab][j]->price * get_count,0);
+ iPc->getcash(sd, clif->cs.data[tab][j]->price * get_count,0);
}
}
}
@@ -16947,6 +16961,133 @@ void clif_status_change_end(struct block_list *bl, int tid, enum send_target tar
clif->send(&p,sizeof(p), bl, target);
}
+void clif_bgqueue_ack(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id) {
+
+ switch (response) {
+ case BGQA_FAIL_COOLDOWN:
+ case BGQA_FAIL_DESERTER:
+ case BGQA_FAIL_TEAM_COUNT:
+ break;
+ default: {
+ struct packet_bgqueue_ack p;
+
+ p.PacketType = bgqueue_ackType;
+ p.type = response;
+ safestrncpy(p.bg_name, bg->arena[arena_id]->name, sizeof(p.bg_name));
+
+ clif->send(&p,sizeof(p), &sd->bl, SELF);
+ }
+ break;
+ }
+}
+
+
+void clif_bgqueue_notice_delete(struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, unsigned char arena_id) {
+ struct packet_bgqueue_notice_delete p;
+
+ p.PacketType = bgqueue_notice_deleteType;
+ p.type = response;
+ safestrncpy(p.bg_name, bg->arena[arena_id]->name, sizeof(p.bg_name));
+
+ clif->send(&p,sizeof(p), &sd->bl, SELF);
+}
+
+void clif_parse_bgqueue_register(int fd, struct map_session_data *sd) {
+ struct packet_bgqueue_register *p = P2PTR(fd, bgqueue_registerType);
+ struct bg_arena *arena = NULL;
+
+ if( !bg->queue_on ) return; /* temp, until feature is complete */
+
+ if( !(arena = bg->name2arena(p->bg_name)) ) {
+ clif->bgqueue_ack(sd,BGQA_FAIL_BGNAME_INVALID,0);
+ return;
+ }
+
+ switch( (enum bg_queue_types)p->type ) {
+ case BGQT_INDIVIDUAL:
+ case BGQT_PARTY:
+ case BGQT_GUILD:
+ break;
+ default:
+ clif->bgqueue_ack(sd,BGQA_FAIL_TYPE_INVALID, arena->id);
+ return;
+ }
+
+ bg->queue_add(sd, arena, (enum bg_queue_types)p->type);
+}
+
+void clif_bgqueue_update_info(struct map_session_data *sd, unsigned char arena_id, int position) {
+ struct packet_bgqueue_update_info p;
+
+ p.PacketType = bgqueue_updateinfoType;
+ safestrncpy(p.bg_name, bg->arena[arena_id]->name, sizeof(p.bg_name));
+ p.position = position;
+
+ sd->bg_queue.client_has_bg_data = true; // Client creates bg data when this packet arrives
+
+ clif->send(&p,sizeof(p), &sd->bl, SELF);
+}
+
+void clif_parse_bgqueue_checkstate(int fd, struct map_session_data *sd) {
+ //struct packet_bgqueue_checkstate *p = P2PTR(fd, bgqueue_checkstateType); /* TODO: bgqueue_notice_delete should use this p->bg_name */
+ if( !bg->queue_on ) return; /* temp, until feature is complete */
+ if ( sd->bg_queue.arena && sd->bg_queue.type ) {
+ sd->bg_queue.client_has_bg_data = true;
+ clif->bgqueue_update_info(sd,sd->bg_queue.arena->id,bg->id2pos(sd->bg_queue.arena->queue_id,sd->status.account_id));
+ } else
+ clif->bgqueue_notice_delete(sd, BGQND_FAIL_NOT_QUEUING,0);/* TODO: wrong response, should respond with p->bg_name not id 0 */
+}
+
+void clif_parse_bgqueue_revoke_req(int fd, struct map_session_data *sd) {
+ //struct packet_bgqueue_revoke_req *p = P2PTR(fd, bgqueue_revokereqType);
+ return;
+ //bg->queue_leave(sd, p->bg_name);
+}
+
+void clif_parse_bgqueue_battlebegin_ack(int fd, struct map_session_data *sd) {
+ //struct packet_bgqueue_battlebegin_ack *p = P2PTR(fd, bgqueue_checkstateType);
+ return;
+ //if ( p->result == 1 )
+ // bg->queue_pc_ready(sd);
+ //else
+ // bg->queue_leave(sd, p->bg_name);
+}
+
+void clif_bgqueue_joined(struct map_session_data *sd, int pos) {
+ struct packet_bgqueue_notify_entry p;
+
+ p.PacketType = bgqueue_notify_entryType;
+ safestrncpy(p.name,sd->status.name,sizeof(p.name));
+ p.position = pos;
+
+ clif->send(&p,sizeof(p), &sd->bl, BG_QUEUE);
+}
+
+void clif_bgqueue_pcleft(struct map_session_data *sd) {
+ /* no idea */
+ return;
+}
+
+// Sends BG ready req to all with same bg arena/type as sd
+void clif_bgqueue_battlebegins(struct map_session_data *sd, unsigned char arena_id, enum send_target target) {
+ struct packet_bgqueue_battlebegins p;
+
+ p.PacketType = bgqueue_battlebegins;
+ safestrncpy(p.bg_name, bg->arena[arena_id]->name, sizeof(p.bg_name));
+ safestrncpy(p.game_name, bg->arena[arena_id]->name, sizeof(p.game_name));
+
+ clif->send(&p,sizeof(p), &sd->bl, target);
+}
+
+void clif_scriptclear(struct map_session_data *sd, int npcid) {
+ struct packet_script_clear p;
+
+ p.PacketType = script_clearType;
+ p.NpcID = npcid;
+
+ clif->send(&p,sizeof(p), &sd->bl, SELF);
+}
+
/*==========================================
* Main client packet processing function
*------------------------------------------*/
@@ -16977,7 +17118,7 @@ int clif_parse(int fd) {
} else {
//Unusual logout (during log on/off/map-changer procedure)
ShowInfo("Player AID:%d/CID:%d logged off.\n", sd->status.account_id, sd->status.char_id);
- map_quit(sd);
+ iMap->quit(sd);
}
} else {
ShowInfo("Closed connection from '"CL_WHITE"%s"CL_RESET"'.\n", ip2str(session[fd]->client_addr, NULL));
@@ -17122,6 +17263,7 @@ void clif_bc_ready(void) {
int do_init_clif(void) {
const char* colors[COLOR_MAX] = { "0xFF0000", "0x00ff00", "0xffffff" };
int i;
+
/**
* Setup Color Table (saves unnecessary load of strtoul on every call)
**/
@@ -17138,8 +17280,8 @@ int do_init_clif(void) {
exit(EXIT_FAILURE);
}
- add_timer_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub");
- add_timer_func_list(clif->delayquit, "clif_delayquit");
+ iTimer->add_timer_func_list(clif->clearunit_delayed_sub, "clif_clearunit_delayed_sub");
+ iTimer->add_timer_func_list(clif->delayquit, "clif_delayquit");
clif->delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR);
@@ -17277,6 +17419,7 @@ void clif_defaults(void) {
clif->scriptinputstr = clif_scriptinputstr;
clif->cutin = clif_cutin;
clif->sendfakenpc = clif_sendfakenpc;
+ clif->scriptclear = clif_scriptclear;
/* client-user-interface-related */
clif->viewpoint = clif_viewpoint;
clif->damage = clif_damage;
@@ -17611,13 +17754,7 @@ void clif_defaults(void) {
/* elemental-related */
clif->elemental_info = clif_elemental_info;
clif->elemental_updatestatus = clif_elemental_updatestatus;
- /* misc-handling */
- clif->adopt_reply = clif_Adopt_reply;
- clif->adopt_request = clif_Adopt_request;
- clif->readbook = clif_readbook;
- clif->notify_time = clif_notify_time;
- clif->user_count = clif_user_count;
- clif->noask_sub = clif_noask_sub;
+ /* Hercules Channel System */
clif->chsys_create = clif_hercules_chsys_create;
clif->chsys_msg = clif_hercules_chsys_msg;
clif->chsys_msg2 = clif_hercules_chsys_msg2;
@@ -17630,6 +17767,20 @@ void clif_defaults(void) {
clif->chsys_quitg = clif_hercules_chsys_quitg;
clif->chsys_gjoin = clif_hercules_chsys_gjoin;
clif->chsys_gleave = clif_hercules_chsys_gleave;
+ /* bgqueue */
+ clif->bgqueue_ack = clif_bgqueue_ack;
+ clif->bgqueue_notice_delete = clif_bgqueue_notice_delete;
+ clif->bgqueue_update_info = clif_bgqueue_update_info;
+ clif->bgqueue_joined = clif_bgqueue_joined;
+ clif->bgqueue_pcleft = clif_bgqueue_pcleft;
+ clif->bgqueue_battlebegins = clif_bgqueue_battlebegins;
+ /* misc-handling */
+ clif->adopt_reply = clif_Adopt_reply;
+ clif->adopt_request = clif_Adopt_request;
+ clif->readbook = clif_readbook;
+ clif->notify_time = clif_notify_time;
+ clif->user_count = clif_user_count;
+ clif->noask_sub = clif_noask_sub;
clif->cashshop_load = clif_cashshop_db;
clif->bc_ready = clif_bc_ready;
clif->undisguise_timer = clif_undisguise_timer;
@@ -17835,6 +17986,11 @@ void clif_defaults(void) {
clif->pCashShopReqTab = clif_parse_CashShopReqTab;
clif->pCashShopSchedule = clif_parse_CashShopSchedule;
clif->pCashShopBuy = clif_parse_CashShopBuy;
+ /* BGQueue */
+ clif->pBGQueueRegister = clif_parse_bgqueue_register;
+ clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate;
+ clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req;
+ clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack;
/* */
clif->pPartyTick = clif_parse_PartyTick;
clif->pGuildInvite2 = clif_parse_GuildInvite2;
diff --git a/src/map/clif.h b/src/map/clif.h
index 3e3db98c1..a0959f92a 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -8,6 +8,7 @@
#include "../common/cbasetypes.h"
#include "../common/db.h"
#include "../common/mmo.h"
+#include "../common/socket.h"
#include <stdarg.h>
/**
@@ -42,6 +43,7 @@ struct eri;
* Defines
**/
#define packet_len(cmd) packet_db[cmd].len
+#define P2PTR(fd,cmd) RFIFO2PTR(fd,packet_db[cmd].len)
#define clif_menuskill_clear(sd) (sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0;
#define HCHSYS_NAME_LENGTH 20
@@ -86,6 +88,8 @@ typedef enum send_target {
BG_SAMEMAP_WOS,
BG_AREA,
BG_AREA_WOS,
+
+ BG_QUEUE,
} send_target;
typedef enum emotion_type {
@@ -365,6 +369,29 @@ enum CASH_SHOP_BUY_RESULT {
CSBR_UNKNOWN = 0xb,
};
+enum BATTLEGROUNDS_QUEUE_ACK {
+ BGQA_SUCCESS = 1,
+ BGQA_FAIL_QUEUING_FINISHED,
+ BGQA_FAIL_BGNAME_INVALID,
+ BGQA_FAIL_TYPE_INVALID,
+ BGQA_FAIL_PPL_OVERAMOUNT,
+ BGQA_FAIL_LEVEL_INCORRECT,
+ BGQA_DUPLICATE_REQUEST,
+ BGQA_PLEASE_RELOGIN,
+ BGQA_NOT_PARTY_GUILD_LEADER,
+ BGQA_FAIL_CLASS_INVALID,
+ /* not official way to respond (gotta find packet?) */
+ BGQA_FAIL_DESERTER,
+ BGQA_FAIL_COOLDOWN,
+ BGQA_FAIL_TEAM_COUNT,
+};
+
+enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED {
+ BGQND_CLOSEWINDOW = 1,
+ BGQND_FAIL_BGNAME_WRONG = 3,
+ BGQND_FAIL_NOT_QUEUING = 11,
+};
+
/**
* Structures
**/
@@ -385,7 +412,7 @@ struct {
unsigned char local_color, ally_color, irc_color;
bool closing;
bool allow_user_channel_creation;
- char irc_server[40], irc_channel[20], irc_nick[30], irc_nick_pw[30];
+ char irc_server[40], irc_channel[50], irc_nick[40], irc_nick_pw[30];
unsigned short irc_server_port;
} hChSys;
@@ -499,7 +526,7 @@ struct clif_interface {
/* main unit spawn */
int (*spawn) (struct block_list *bl);
/* map-related */
- void (*changemap) (struct map_session_data *sd, short map, int x, int y);
+ void (*changemap) (struct map_session_data *sd, short m, int x, int y);
void (*changemapcell) (int fd, int16 m, int x, int y, int type, enum send_target target);
void (*map_property) (struct map_session_data* sd, enum map_property property);
void (*pvpset) (struct map_session_data *sd, int pvprank, int pvpnum,int type);
@@ -526,6 +553,7 @@ struct clif_interface {
void (*scriptinputstr) (struct map_session_data *sd, int npcid);
void (*cutin) (struct map_session_data* sd, const char* image, int type);
void (*sendfakenpc) (struct map_session_data *sd, int npcid);
+ void (*scriptclear) (struct map_session_data *sd, int npcid);
/* client-user-interface-related */
void (*viewpoint) (struct map_session_data *sd, int npc_id, int type, int x, int y, int id, int color);
int (*damage) (struct block_list* src, struct block_list* dst, unsigned int tick, int sdelay, int ddelay, int damage, int div, int type, int damage2);
@@ -860,6 +888,13 @@ struct clif_interface {
/* elemental-related */
void (*elemental_info) (struct map_session_data *sd);
void (*elemental_updatestatus) (struct map_session_data *sd, int type);
+ /* bgqueue */
+ void (*bgqueue_ack) (struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_ACK response, unsigned char arena_id);
+ void (*bgqueue_notice_delete) (struct map_session_data *sd, enum BATTLEGROUNDS_QUEUE_NOTICE_DELETED response, unsigned char arena_id);
+ void (*bgqueue_update_info) (struct map_session_data *sd, unsigned char arena_id, int position);
+ void (*bgqueue_joined) (struct map_session_data *sd, int pos);
+ void (*bgqueue_pcleft) (struct map_session_data *sd);
+ void (*bgqueue_battlebegins) (struct map_session_data *sd, unsigned char arena_id, enum send_target target);
/* misc-handling */
void (*adopt_reply) (struct map_session_data *sd, int type);
void (*adopt_request) (struct map_session_data *sd, struct map_session_data *src, int p_id);
@@ -1078,6 +1113,11 @@ struct clif_interface {
void (*pSkillSelectMenu) (int fd, struct map_session_data *sd);
void (*pMoveItem) (int fd, struct map_session_data *sd);
void (*pDull) (int fd, struct map_session_data *sd);
+ /* BGQueue */
+ void (*pBGQueueRegister) (int fd, struct map_session_data *sd);
+ void (*pBGQueueCheckState) (int fd, struct map_session_data *sd);
+ void (*pBGQueueRevokeReq) (int fd, struct map_session_data *sd);
+ void (*pBGQueueBattleBeginAck) (int fd, struct map_session_data *sd);
/* RagExe Cash Shop [Ind/Hercules] */
void (*pCashShopOpen) (int fd, struct map_session_data *sd);
void (*pCashShopClose) (int fd, struct map_session_data *sd);
diff --git a/src/map/duel.c b/src/map/duel.c
index 7af427304..9a8b6d12b 100644
--- a/src/map/duel.c
+++ b/src/map/duel.c
@@ -75,7 +75,7 @@ void duel_showinfo(const unsigned int did, struct map_session_data* sd)
duel_list[did].members_count + duel_list[did].invites_count);
clif->disp_onlyself(sd, output, strlen(output));
- map_foreachpc(duel_showinfo_sub, sd, &p);
+ iMap->map_foreachpc(duel_showinfo_sub, sd, &p);
}
int duel_create(struct map_session_data* sd, const unsigned int maxpl)
@@ -135,7 +135,7 @@ void duel_leave(const unsigned int did, struct map_session_data* sd)
duel_list[did].members_count--;
if(duel_list[did].members_count == 0) {
- map_foreachpc(duel_leave_sub, did);
+ iMap->map_foreachpc(duel_leave_sub, did);
duel_count--;
}
diff --git a/src/map/elemental.c b/src/map/elemental.c
index dfe1a0c5b..17c6fe16d 100644
--- a/src/map/elemental.c
+++ b/src/map/elemental.c
@@ -77,27 +77,27 @@ int elemental_create(struct map_session_data *sd, int class_, unsigned int lifet
ele.mode = EL_MODE_PASSIVE; // Initial mode
i = db->status.size+1; // summon level
- //[(Caster’s Max HP/ 3 ) + (Caster’s INT x 10 )+ (Caster’s Job Level x 20 )] x [(Elemental Summon Level + 2) / 3]
+ //[(Caster�s Max HP/ 3 ) + (Caster�s INT x 10 )+ (Caster�s Job Level x 20 )] x [(Elemental Summon Level + 2) / 3]
ele.hp = ele.max_hp = (sd->battle_status.max_hp/3 + sd->battle_status.int_*10 + sd->status.job_level) * ((i + 2) / 3);
- //Caster’s Max SP /4
+ //Caster�s Max SP /4
ele.sp = ele.max_sp = sd->battle_status.max_sp/4;
- //Caster’s [ Max SP / (18 / Elemental Summon Skill Level) 1- 100 ]
+ //Caster�s [ Max SP / (18 / Elemental Summon Skill Level) 1- 100 ]
ele.atk = (sd->battle_status.max_sp / (18 / i) * 1 - 100);
- //Caster’s [ Max SP / (18 / Elemental Summon Skill Level) ]
+ //Caster�s [ Max SP / (18 / Elemental Summon Skill Level) ]
ele.atk2 = sd->battle_status.max_sp / 18;
- //Caster’s HIT + (Caster’s Base Level )
+ //Caster�s HIT + (Caster�s Base Level )
ele.hit = sd->battle_status.hit + sd->status.base_level;
- //[Elemental Summon Skill Level x (Caster’s INT / 2 + Caster’s DEX / 4)]
+ //[Elemental Summon Skill Level x (Caster�s INT / 2 + Caster�s DEX / 4)]
ele.matk = i * (sd->battle_status.int_ / 2 + sd->battle_status.dex / 4);
- //150 + [Caster’s DEX / 10] + [Elemental Summon Skill Level x 3 ]
+ //150 + [Caster�s DEX / 10] + [Elemental Summon Skill Level x 3 ]
ele.amotion = 150 + sd->battle_status.dex / 10 + i * 3;
- //Caster’s DEF + (Caster’s Base Level / (5 – Elemental Summon Skill Level)
+ //Caster�s DEF + (Caster�s Base Level / (5 � Elemental Summon Skill Level)
ele.def = sd->battle_status.def + sd->status.base_level / (5-i);
- //Caster’s MDEF + (Caster’s INT / (5 - Elemental Summon Skill Level)
+ //Caster�s MDEF + (Caster�s INT / (5 - Elemental Summon Skill Level)
ele.mdef = sd->battle_status.mdef + sd->battle_status.int_ / (5-i);
- //Caster’s FLEE + (Caster’s Base Level / (5 – Elemental Summon Skill Level)
+ //Caster�s FLEE + (Caster�s Base Level / (5 � Elemental Summon Skill Level)
ele.flee = sd->status.base_level / (5-i);
- //Caster’s HIT + (Caster’s Base Level )
+ //Caster�s HIT + (Caster�s Base Level )
ele.hit = sd->battle_status.hit + sd->status.base_level;
//per individual bonuses
@@ -126,7 +126,7 @@ int elemental_create(struct map_session_data *sd, int class_, unsigned int lifet
break;
}
- if( (i=pc_checkskill(sd,SO_EL_SYMPATHY)) > 0 ){
+ if( (i=iPc->checkskill(sd,SO_EL_SYMPATHY)) > 0 ){
ele.hp = ele.max_hp = ele.max_hp * 5 * i / 100;
ele.sp = ele.max_sp = ele.max_sp * 5 * i / 100;
ele.atk += 25 * i;
@@ -147,8 +147,8 @@ int elemental_get_lifetime(struct elemental_data *ed) {
if( ed == NULL || ed->summon_timer == INVALID_TIMER )
return 0;
- td = get_timer(ed->summon_timer);
- return (td != NULL) ? DIFF_TICK(td->tick, gettick()) : 0;
+ td = iTimer->get_timer(ed->summon_timer);
+ return (td != NULL) ? DIFF_TICK(td->tick, iTimer->gettick()) : 0;
}
int elemental_save(struct elemental_data *ed) {
@@ -173,7 +173,7 @@ static int elemental_summon_end(int tid, unsigned int tick, int id, intptr_t dat
struct map_session_data *sd;
struct elemental_data *ed;
- if( (sd = map_id2sd(id)) == NULL )
+ if( (sd = iMap->id2sd(id)) == NULL )
return 1;
if( (ed = sd->ed) == NULL )
return 1;
@@ -192,13 +192,12 @@ static int elemental_summon_end(int tid, unsigned int tick, int id, intptr_t dat
void elemental_summon_stop(struct elemental_data *ed) {
nullpo_retv(ed);
if( ed->summon_timer != INVALID_TIMER )
- delete_timer(ed->summon_timer, elemental_summon_end);
+ iTimer->delete_timer(ed->summon_timer, elemental_summon_end);
ed->summon_timer = INVALID_TIMER;
}
int elemental_delete(struct elemental_data *ed, int reply) {
struct map_session_data *sd;
-
nullpo_ret(ed);
sd = ed->master;
@@ -218,7 +217,7 @@ int elemental_delete(struct elemental_data *ed, int reply) {
void elemental_summon_init(struct elemental_data *ed) {
if( ed->summon_timer == INVALID_TIMER )
- ed->summon_timer = add_timer(gettick() + ed->elemental.life_time, elemental_summon_end, ed->master->bl.id, 0);
+ ed->summon_timer = iTimer->add_timer(iTimer->gettick() + ed->elemental.life_time, elemental_summon_end, ed->master->bl.id, 0);
ed->regen.state.block = 0;
}
@@ -229,7 +228,7 @@ int elemental_data_received(struct s_elemental *ele, bool flag) {
struct s_elemental_db *db;
int i = elemental_search_index(ele->class_);
- if( (sd = map_charid2sd(ele->char_id)) == NULL )
+ if( (sd = iMap->charid2sd(ele->char_id)) == NULL )
return 0;
if( !flag || i < 0 ) { // Not created - loaded - DB info
@@ -258,9 +257,9 @@ int elemental_data_received(struct s_elemental *ele, bool flag) {
ed->bl.x = ed->ud.to_x;
ed->bl.y = ed->ud.to_y;
- map_addiddb(&ed->bl);
+ iMap->addiddb(&ed->bl);
status_calc_elemental(ed,1);
- ed->last_spdrain_time = ed->last_thinktime = gettick();
+ ed->last_spdrain_time = ed->last_thinktime = iTimer->gettick();
ed->summon_timer = INVALID_TIMER;
elemental_summon_init(ed);
} else {
@@ -271,7 +270,7 @@ int elemental_data_received(struct s_elemental *ele, bool flag) {
sd->status.ele_id = ele->elemental_id;
if( ed->bl.prev == NULL && sd->bl.prev != NULL ) {
- map_addblock(&ed->bl);
+ iMap->addblock(&ed->bl);
clif->spawn(&ed->bl);
clif->elemental_info(sd);
clif->elemental_updatestatus(sd,SP_HP);
@@ -433,9 +432,9 @@ int elemental_action(struct elemental_data *ed, struct block_list *bl, unsigned
ed->ud.skill_lv = skill_lv;
if( skill->get_inf(skill_id) & INF_GROUND_SKILL )
- ed->ud.skilltimer = add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill->castend_pos, ed->bl.id, 0 );
+ ed->ud.skilltimer = iTimer->add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill->castend_pos, ed->bl.id, 0 );
else
- ed->ud.skilltimer = add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill->castend_id, ed->bl.id, 0 );
+ ed->ud.skilltimer = iTimer->add_timer( tick+status_get_speed(&ed->bl)*walk_dist, skill->castend_id, ed->bl.id, 0 );
}
return 1;
@@ -493,11 +492,11 @@ int elemental_change_mode_ack(struct elemental_data *ed, int mode) {
if( ed->ud.skilltimer != INVALID_TIMER )
return 0;
- else if( DIFF_TICK(gettick(), ed->ud.canact_tick) < 0 )
+ else if( DIFF_TICK(iTimer->gettick(), ed->ud.canact_tick) < 0 )
return 0;
ed->target_id = bl->id; // Set new target
- ed->last_thinktime = gettick();
+ ed->last_thinktime = iTimer->gettick();
if( skill->get_inf(skill_id) & INF_GROUND_SKILL )
unit_skilluse_pos(&ed->bl, bl->x, bl->y, skill_id, skill_lv);
@@ -707,16 +706,16 @@ static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_
return 0; //Already walking to him
if( DIFF_TICK(tick, ed->ud.canmove_tick) < 0 )
return 0; //Can't move yet.
- if( map_search_freecell(&ed->bl, sd->bl.m, &x, &y, MIN_ELEDISTANCE, MIN_ELEDISTANCE, 1)
+ if( iMap->search_freecell(&ed->bl, sd->bl.m, &x, &y, MIN_ELEDISTANCE, MIN_ELEDISTANCE, 1)
&& unit_walktoxy(&ed->bl, x, y, 0) )
return 0;
}
if( mode == EL_MODE_AGGRESSIVE ) {
- target = map_id2bl(ed->ud.target);
+ target = iMap->id2bl(ed->ud.target);
if( !target )
- map_foreachinrange(elemental_ai_sub_timer_activesearch, &ed->bl, view_range, BL_CHAR, ed, &target, status_get_mode(&ed->bl));
+ iMap->foreachinrange(elemental_ai_sub_timer_activesearch, &ed->bl, view_range, BL_CHAR, ed, &target, status_get_mode(&ed->bl));
if( !target ) { //No targets available.
elemental_unlocktarget(ed);
@@ -755,7 +754,7 @@ static int elemental_ai_sub_foreachclient(struct map_session_data *sd, va_list a
}
static int elemental_ai_timer(int tid, unsigned int tick, int id, intptr_t data) {
- map_foreachpc(elemental_ai_sub_foreachclient,tick);
+ iMap->map_foreachpc(elemental_ai_sub_foreachclient,tick);
return 0;
}
@@ -767,7 +766,7 @@ int read_elementaldb(void) {
struct s_elemental_db *db;
struct status_data *status;
- sprintf(line, "%s/%s", db_path, "elemental_db.txt");
+ sprintf(line, "%s/%s", iMap->db_path, "elemental_db.txt");
memset(elemental_db,0,sizeof(elemental_db));
fp = fopen(line, "r");
@@ -858,7 +857,7 @@ int read_elemental_skilldb(void) {
uint16 skill_id, skill_lv;
int skillmode;
- sprintf(line, "%s/%s", db_path, "elemental_skill_db.txt");
+ sprintf(line, "%s/%s", iMap->db_path, "elemental_skill_db.txt");
fp = fopen(line, "r");
if( !fp ) {
ShowError("read_elemental_skilldb : can't read elemental_skill_db.txt\n");
@@ -934,8 +933,8 @@ int do_init_elemental(void) {
read_elementaldb();
read_elemental_skilldb();
- add_timer_func_list(elemental_ai_timer,"elemental_ai_timer");
- add_timer_interval(gettick()+MIN_ELETHINKTIME,elemental_ai_timer,0,0,MIN_ELETHINKTIME);
+ iTimer->add_timer_func_list(elemental_ai_timer,"elemental_ai_timer");
+ iTimer->add_timer_interval(iTimer->gettick()+MIN_ELETHINKTIME,elemental_ai_timer,0,0,MIN_ELETHINKTIME);
return 0;
}
diff --git a/src/map/guild.c b/src/map/guild.c
index b83f05f00..fe801462f 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -24,6 +24,7 @@
#include "clif.h"
#include "skill.h"
#include "log.h"
+#include "instance.h"
#include <stdio.h>
#include <stdlib.h>
@@ -75,7 +76,7 @@ unsigned short guild_flags_count;
*------------------------------------------*/
static TBL_PC* guild_sd_check(int guild_id, int account_id, int char_id)
{
- TBL_PC* sd = map_id2sd(account_id);
+ TBL_PC* sd = iMap->id2sd(account_id);
if (!(sd && sd->status.char_id == char_id))
return NULL;
@@ -166,7 +167,7 @@ static bool guild_read_castledb(char* str[], int columns, int current)
struct guild_castle *gc;
int mapindex = mapindex_name2id(str[1]);
- if (map_mapindex2mapid(mapindex) < 0) // Map not found or on another map-server
+ if (iMap->mapindex2mapid(mapindex) < 0) // Map not found or on another map-server
return false;
CREATE(gc, struct guild_castle, 1);
@@ -296,7 +297,7 @@ int guild_payexp_timer_sub(DBKey key, DBData *data, va_list ap) {
struct guild_expcache *c;
struct guild *g;
- c = DB->data2ptr(data);
+ c = iDB->data2ptr(data);
if (
(g = guild->search(c->guild_id)) == NULL ||
@@ -331,7 +332,7 @@ int guild_payexp_timer(int tid, unsigned int tick, int id, intptr_t data)
*/
int guild_send_xy_timer_sub(DBKey key, DBData *data, va_list ap)
{
- struct guild *g = DB->data2ptr(data);
+ struct guild *g = iDB->data2ptr(data);
int i;
nullpo_ret(g);
@@ -385,7 +386,7 @@ int guild_create(struct map_session_data *sd, const char *name)
clif->guild_created(sd,1);
return 0;
}
- if( battle_config.guild_emperium_check && pc_search_inventory(sd,714) == -1 )
+ if( battle_config.guild_emperium_check && iPc->search_inventory(sd,714) == -1 )
{// item required
clif->guild_created(sd,3);
return 0;
@@ -399,7 +400,7 @@ int guild_create(struct map_session_data *sd, const char *name)
//Whether or not to create guild
int guild_created(int account_id,int guild_id) {
- struct map_session_data *sd=map_id2sd(account_id);
+ struct map_session_data *sd=iMap->id2sd(account_id);
if(sd==NULL)
return 0;
@@ -411,7 +412,7 @@ int guild_created(int account_id,int guild_id) {
sd->status.guild_id=guild_id;
clif->guild_created(sd,0);
if(battle_config.guild_emperium_check)
- pc_delitem(sd,pc_search_inventory(sd,ITEMID_EMPERIUM),1,0,0,LOG_TYPE_CONSUME); //emperium consumption
+ iPc->delitem(sd,iPc->search_inventory(sd,ITEMID_EMPERIUM),1,0,0,LOG_TYPE_CONSUME); //emperium consumption
return 0;
}
@@ -439,8 +440,8 @@ int guild_npc_request_info(int guild_id,const char *event)
ev=(struct eventlist *)aCalloc(sizeof(struct eventlist),1);
memcpy(ev->name,event,strlen(event));
//The one in the db (if present) becomes the next event from this.
- if (guild_infoevent_db->put(guild_infoevent_db, DB->i2key(guild_id), DB->ptr2data(ev), &prev))
- ev->next = DB->data2ptr(&prev);
+ if (guild_infoevent_db->put(guild_infoevent_db, iDB->i2key(guild_id), iDB->ptr2data(ev), &prev))
+ ev->next = iDB->data2ptr(&prev);
}
return guild->request_info(guild_id);
@@ -503,6 +504,8 @@ int guild_recv_info(struct guild *sg) {
if((g = (struct guild*)idb_get(guild_db,sg->guild_id))==NULL) {
guild_new = true;
g=(struct guild *)aCalloc(1,sizeof(struct guild));
+ g->instance = NULL;
+ g->instances = 0;
idb_put(guild_db,sg->guild_id,g);
if( hChSys.ally ) {
struct hChSysCh *channel;
@@ -552,7 +555,7 @@ int guild_recv_info(struct guild *sg) {
before=*sg;
//Perform the check on the user because the first load
guild_check_member(sg);
- if ((sd = map_nick2sd(sg->master)) != NULL) {
+ if ((sd = iMap->nick2sd(sg->master)) != NULL) {
//If the guild master is online the first time the guild_info is received,
//that means he was the first to join, so apply guild skill blocking here.
if( battle_config.guild_skill_relog_delay )
@@ -615,8 +618,8 @@ int guild_recv_info(struct guild *sg) {
}
//Occurrence of an event
- if (guild_infoevent_db->remove(guild_infoevent_db, DB->i2key(sg->guild_id), &data)) {
- struct eventlist *ev = DB->data2ptr(&data), *ev2;
+ if (guild_infoevent_db->remove(guild_infoevent_db, iDB->i2key(sg->guild_id), &data)) {
+ struct eventlist *ev = iDB->data2ptr(&data), *ev2;
while(ev) {
npc_event_do(ev->name);
ev2=ev->next;
@@ -659,7 +662,7 @@ int guild_invite(struct map_session_data *sd, struct map_session_data *tsd) {
if(tsd->status.guild_id>0 ||
tsd->guild_invite>0 ||
- ((agit_flag || agit2_flag) && map[tsd->bl.m].flag.gvg_castle))
+ ((iMap->agit_flag || iMap->agit2_flag) && map[tsd->bl.m].flag.gvg_castle))
{ //Can't invite people inside castles. [Skotlex]
clif->guild_inviteack(sd,0);
return 0;
@@ -693,7 +696,7 @@ int guild_reply_invite(struct map_session_data* sd, int guild_id, int flag)
// look up the person who sent the invite
//NOTE: this can be NULL because the person might have logged off in the meantime
- tsd = map_id2sd(sd->guild_invite_account);
+ tsd = iMap->id2sd(sd->guild_invite_account);
if ( sd->status.guild_id > 0 ) // [Paradox924X]
{ // Already in another guild.
@@ -785,7 +788,7 @@ void guild_member_joined(struct map_session_data *sd)
*----------------------------------------*/
int guild_member_added(int guild_id,int account_id,int char_id,int flag)
{
- struct map_session_data *sd= map_id2sd(account_id),*sd2;
+ struct map_session_data *sd= iMap->id2sd(account_id),*sd2;
struct guild *g;
if( (g=guild->search(guild_id))==NULL )
@@ -799,7 +802,7 @@ int guild_member_added(int guild_id,int account_id,int char_id,int flag)
}
return 0;
}
- sd2 = map_id2sd(sd->guild_invite_account);
+ sd2 = iMap->id2sd(sd->guild_invite_account);
sd->guild_invite = 0;
sd->guild_invite_account = 0;
@@ -844,7 +847,7 @@ int guild_leave(struct map_session_data* sd, int guild_id, int account_id, int c
if(sd->status.account_id!=account_id ||
sd->status.char_id!=char_id || sd->status.guild_id!=guild_id ||
- ((agit_flag || agit2_flag) && map[sd->bl.m].flag.gvg_castle))
+ ((iMap->agit_flag || iMap->agit2_flag) && map[sd->bl.m].flag.gvg_castle))
return 0;
intif_guild_leave(sd->status.guild_id, sd->status.account_id, sd->status.char_id,0,mes);
@@ -874,9 +877,9 @@ int guild_expulsion(struct map_session_data* sd, int guild_id, int account_id, i
return 0; //Expulsion permission
//Can't leave inside guild castles.
- if ((tsd = map_id2sd(account_id)) &&
+ if ((tsd = iMap->id2sd(account_id)) &&
tsd->status.char_id == char_id &&
- ((agit_flag || agit2_flag) && map[tsd->bl.m].flag.gvg_castle))
+ ((iMap->agit_flag || iMap->agit2_flag) && map[tsd->bl.m].flag.gvg_castle))
return 0;
// find the member and perform expulsion
@@ -891,7 +894,7 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
{
int i;
struct guild* g = guild->search(guild_id);
- struct map_session_data* sd = map_charid2sd(char_id);
+ struct map_session_data* sd = iMap->charid2sd(char_id);
struct map_session_data* online_member_sd;
if(g == NULL)
@@ -926,7 +929,8 @@ int guild_member_withdraw(int guild_id, int account_id, int char_id, int flag, c
sd->status.guild_id = 0;
sd->guild = NULL;
sd->guild_emblem_id = 0;
-
+ if( g->instances )
+ instance->check_kick(sd);
clif->charnameupdate(sd); //Update display name [Skotlex]
//TODO: send emblem update to self and people around
}
@@ -993,7 +997,7 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin
if(idx == -1 || c == 0) {
//Treat char_id who doesn't match guild_id (not found as member)
- struct map_session_data *sd = map_id2sd(account_id);
+ struct map_session_data *sd = iMap->id2sd(account_id);
if(sd && sd->status.char_id == char_id) {
sd->status.guild_id=0;
sd->guild_emblem_id=0;
@@ -1202,7 +1206,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
// update permanent guardians
for( i = 0; i < ARRAYLENGTH(gc->guardian); ++i )
{
- TBL_MOB* md = (gc->guardian[i].id ? map_id2md(gc->guardian[i].id) : NULL);
+ TBL_MOB* md = (gc->guardian[i].id ? iMap->id2md(gc->guardian[i].id) : NULL);
if( md == NULL || md->guardian_data == NULL )
continue;
md->guardian_data->emblem_id = emblem_id;
@@ -1211,7 +1215,7 @@ int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data)
// update temporary guardians
for( i = 0; i < gc->temp_guardians_max; ++i )
{
- TBL_MOB* md = (gc->temp_guardians[i] ? map_id2md(gc->temp_guardians[i]) : NULL);
+ TBL_MOB* md = (gc->temp_guardians[i] ? iMap->id2md(gc->temp_guardians[i]) : NULL);
if( md == NULL || md->guardian_data == NULL )
continue;
md->guardian_data->emblem_id = emblem_id;
@@ -1243,7 +1247,7 @@ static DBData create_expcache(DBKey key, va_list args)
c->account_id = sd->status.account_id;
c->char_id = sd->status.char_id;
c->exp = 0;
- return DB->ptr2data(c);
+ return iDB->ptr2data(c);
}
/*====================================================
@@ -1269,7 +1273,7 @@ unsigned int guild_payexp(struct map_session_data *sd,unsigned int exp) {
exp = exp * per / 100;
//Otherwise tax everything.
- c = DB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, DB->i2key(sd->status.char_id), create_expcache, sd));
+ c = iDB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, iDB->i2key(sd->status.char_id), create_expcache, sd));
if (c->exp > UINT64_MAX - exp)
c->exp = UINT64_MAX;
@@ -1292,7 +1296,7 @@ int guild_getexp(struct map_session_data *sd,int exp)
if (sd->status.guild_id == 0 || sd->guild == NULL)
return 0;
- c = DB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, DB->i2key(sd->status.char_id), create_expcache, sd));
+ c = iDB->data2ptr(guild_expcache_db->ensure(guild_expcache_db, iDB->i2key(sd->status.char_id), create_expcache, sd));
if (c->exp > UINT64_MAX - exp)
c->exp = UINT64_MAX;
else
@@ -1329,7 +1333,7 @@ int guild_skillup(TBL_PC* sd, uint16 skill_id)
*---------------------------------------------------*/
int guild_skillupack(int guild_id,uint16 skill_id,int account_id)
{
- struct map_session_data *sd=map_id2sd(account_id);
+ struct map_session_data *sd=iMap->id2sd(account_id);
struct guild *g=guild->search(guild_id);
int i;
if(g==NULL)
@@ -1359,7 +1363,7 @@ int guild_skillupack(int guild_id,uint16 skill_id,int account_id)
void guild_guildaura_refresh(struct map_session_data *sd, uint16 skill_id, uint16 skill_lv) {
struct skill_unit_group* group = NULL;
int type = status_skill2sc(skill_id);
- if( !(battle_config.guild_aura&((agit_flag || agit2_flag)?2:1)) &&
+ if( !(battle_config.guild_aura&((iMap->agit_flag || iMap->agit2_flag)?2:1)) &&
!(battle_config.guild_aura&(map_flag_gvg2(sd->bl.m)?8:4)) )
return;
if( !skill_lv )
@@ -1432,7 +1436,7 @@ int guild_reqalliance(struct map_session_data *sd,struct map_session_data *tsd)
struct guild *g[2];
int i;
- if(agit_flag || agit2_flag) { // Disable alliance creation during woe [Valaris]
+ if(iMap->agit_flag || iMap->agit2_flag) { // Disable alliance creation during woe [Valaris]
clif->message(sd->fd,msg_txt(676)); //"Alliances cannot be made during Guild Wars!"
return 0;
} // end addition [Valaris]
@@ -1490,7 +1494,7 @@ int guild_reply_reqalliance(struct map_session_data *sd,int account_id,int flag)
struct map_session_data *tsd;
nullpo_ret(sd);
- tsd= map_id2sd( account_id );
+ tsd= iMap->id2sd( account_id );
if (!tsd) { //Character left? Cancel alliance.
clif->guild_allianceack(sd,3);
return 0;
@@ -1550,7 +1554,7 @@ int guild_delalliance(struct map_session_data *sd,int guild_id,int flag)
{
nullpo_ret(sd);
- if(agit_flag || agit2_flag) { // Disable alliance breaking during woe [Valaris]
+ if(iMap->agit_flag || iMap->agit2_flag) { // Disable alliance breaking during woe [Valaris]
clif->message(sd->fd,msg_txt(677)); //"Alliances cannot be broken during Guild Wars!"
return 0;
} // end addition [Valaris]
@@ -1588,7 +1592,7 @@ int guild_opposition(struct map_session_data *sd,struct map_session_data *tsd)
clif->guild_oppositionack(sd,2);
return 0;
}
- if(agit_flag || agit2_flag) // Prevent the changing of alliances to oppositions during WoE.
+ if(iMap->agit_flag || iMap->agit2_flag) // Prevent the changing of alliances to oppositions during WoE.
return 0;
//Change alliance to opposition.
intif_guild_alliance( sd->status.guild_id,tsd->status.guild_id,
@@ -1617,8 +1621,8 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
guild_id[1] = guild_id2;
guild_name[0] = name1;
guild_name[1] = name2;
- sd[0] = map_id2sd(account_id1);
- sd[1] = map_id2sd(account_id2);
+ sd[0] = iMap->id2sd(account_id1);
+ sd[1] = iMap->id2sd(account_id2);
g[0]=guild->search(guild_id1);
g[1]=guild->search(guild_id2);
@@ -1692,7 +1696,7 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id
*/
int guild_broken_sub(DBKey key, DBData *data, va_list ap)
{
- struct guild *g = DB->data2ptr(data);
+ struct guild *g = iDB->data2ptr(data);
int guild_id=va_arg(ap,int);
int i,j;
struct map_session_data *sd=NULL;
@@ -1717,7 +1721,7 @@ int guild_broken_sub(DBKey key, DBData *data, va_list ap)
*/
int castle_guild_broken_sub(DBKey key, DBData *data, va_list ap)
{
- struct guild_castle *gc = DB->data2ptr(data);
+ struct guild_castle *gc = iDB->data2ptr(data);
int guild_id = va_arg(ap, int);
nullpo_ret(gc);
@@ -1922,7 +1926,7 @@ int guild_castledatasave(int castle_id, int index, int value)
struct mob_data *gd;
gc->guild_id = value;
for (i = 0; i < MAX_GUARDIANS; i++)
- if (gc->guardian[i].visible && (gd = map_id2md(gc->guardian[i].id)) != NULL)
+ if (gc->guardian[i].visible && (gd = iMap->id2md(gc->guardian[i].id)) != NULL)
mob_guardian_guildchange(gd);
break;
}
@@ -1934,7 +1938,7 @@ int guild_castledatasave(int castle_id, int index, int value)
struct mob_data *gd;
gc->defense = value;
for (i = 0; i < MAX_GUARDIANS; i++)
- if (gc->guardian[i].visible && (gd = map_id2md(gc->guardian[i].id)) != NULL)
+ if (gc->guardian[i].visible && (gd = iMap->id2md(gc->guardian[i].id)) != NULL)
status_calc_mob(gd, 0);
break;
}
@@ -2145,7 +2149,7 @@ void guild_flag_remove(struct npc_data *nd) {
*/
static int eventlist_db_final(DBKey key, DBData *data, va_list ap) {
struct eventlist *next = NULL;
- struct eventlist *current = DB->data2ptr(data);
+ struct eventlist *current = iDB->data2ptr(data);
while (current != NULL) {
next = current->next;
aFree(current);
@@ -2158,7 +2162,7 @@ static int eventlist_db_final(DBKey key, DBData *data, va_list ap) {
* @see DBApply
*/
static int guild_expcache_db_final(DBKey key, DBData *data, va_list ap) {
- ers_free(expcache_ers, DB->data2ptr(data));
+ ers_free(expcache_ers, iDB->data2ptr(data));
return 0;
}
@@ -2166,7 +2170,7 @@ static int guild_expcache_db_final(DBKey key, DBData *data, va_list ap) {
* @see DBApply
*/
static int guild_castle_db_final(DBKey key, DBData *data, va_list ap) {
- struct guild_castle* gc = DB->data2ptr(data);
+ struct guild_castle* gc = iDB->data2ptr(data);
if( gc->temp_guardians )
aFree(gc->temp_guardians);
aFree(gc);
@@ -2193,15 +2197,15 @@ void do_init_guild(void) {
guild_flags_count = 0;
- sv->readdb(db_path, "castle_db.txt", ',', 4, 5, -1, &guild_read_castledb);
+ sv->readdb(iMap->db_path, "castle_db.txt", ',', 4, 5, -1, &guild_read_castledb);
memset(guild_skill_tree,0,sizeof(guild_skill_tree));
- sv->readdb(db_path, "guild_skill_tree.txt", ',', 2+MAX_GUILD_SKILL_REQUIRE*2, 2+MAX_GUILD_SKILL_REQUIRE*2, -1, &guild_read_guildskill_tree_db); //guild skill tree [Komurka]
+ sv->readdb(iMap->db_path, "guild_skill_tree.txt", ',', 2+MAX_GUILD_SKILL_REQUIRE*2, 2+MAX_GUILD_SKILL_REQUIRE*2, -1, &guild_read_guildskill_tree_db); //guild skill tree [Komurka]
- add_timer_func_list(guild_payexp_timer,"guild_payexp_timer");
- add_timer_func_list(guild_send_xy_timer, "guild_send_xy_timer");
- add_timer_interval(gettick()+GUILD_PAYEXP_INVERVAL,guild_payexp_timer,0,0,GUILD_PAYEXP_INVERVAL);
- add_timer_interval(gettick()+GUILD_SEND_XY_INVERVAL,guild_send_xy_timer,0,0,GUILD_SEND_XY_INVERVAL);
+ iTimer->add_timer_func_list(guild_payexp_timer,"guild_payexp_timer");
+ iTimer->add_timer_func_list(guild_send_xy_timer, "guild_send_xy_timer");
+ iTimer->add_timer_interval(iTimer->gettick()+GUILD_PAYEXP_INVERVAL,guild_payexp_timer,0,0,GUILD_PAYEXP_INVERVAL);
+ iTimer->add_timer_interval(iTimer->gettick()+GUILD_SEND_XY_INVERVAL,guild_send_xy_timer,0,0,GUILD_SEND_XY_INVERVAL);
}
void do_final_guild(void) {
@@ -2211,6 +2215,10 @@ void do_final_guild(void) {
for( g = dbi_first(iter); dbi_exists(iter); g = dbi_next(iter) ) {
if( g->channel != NULL )
clif->chsys_delete((struct hChSysCh *)g->channel);
+ if( g->instance != NULL ) {
+ aFree(g->instance);
+ g->instance = NULL;
+ }
}
dbi_destroy(iter);
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index e306e7f60..9c18b9811 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -402,7 +402,7 @@ bool homunculus_evolve(struct homun_data *hd) {
hom->intimacy = 500;
unit_remove_map(&hd->bl, CLR_OUTSIGHT);
- map_addblock(&hd->bl);
+ iMap->addblock(&hd->bl);
clif->spawn(&hd->bl);
clif->emotion(&sd->bl, E_NO1);
@@ -414,7 +414,7 @@ bool homunculus_evolve(struct homun_data *hd) {
status_calc_homunculus(hd,1);
if (!(battle_config.hom_setting&0x2))
- skill->unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately
+ skill->unit_move(&sd->hd->bl,iTimer->gettick(),1); // apply land skills immediately
return true;
}
@@ -446,7 +446,7 @@ bool homunculus_mutate(struct homun_data *hd, int homun_id) {
}
unit_remove_map(&hd->bl, CLR_OUTSIGHT);
- map_addblock(&hd->bl);
+ iMap->addblock(&hd->bl);
clif->spawn(&hd->bl);
clif->emotion(&sd->bl, E_NO1);
@@ -461,7 +461,7 @@ bool homunculus_mutate(struct homun_data *hd, int homun_id) {
status_calc_homunculus(hd,1);
if (!(battle_config.hom_setting&0x2))
- skill->unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately
+ skill->unit_move(&sd->hd->bl,iTimer->gettick(),1); // apply land skills immediately
return true;
}
@@ -573,12 +573,12 @@ bool homunculus_feed(struct map_session_data *sd, struct homun_data *hd) {
return false;
foodID = hd->homunculusDB->foodID;
- i = pc_search_inventory(sd,foodID);
+ i = iPc->search_inventory(sd,foodID);
if(i < 0) {
clif->hom_food(sd,foodID,0);
return false;
}
- pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
+ iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
if ( hd->homunculus.hunger >= 91 ) {
homun->consume_intimacy(hd, 50);
@@ -617,7 +617,7 @@ int homunculus_hunger_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data *sd;
struct homun_data *hd;
- if(!(sd=map_id2sd(id)) || !sd->status.hom_id || !(hd=sd->hd))
+ if(!(sd=iMap->id2sd(id)) || !sd->status.hom_id || !(hd=sd->hd))
return 1;
if(hd->hungry_timer != tid){
@@ -645,14 +645,14 @@ int homunculus_hunger_timer(int tid, unsigned int tick, int id, intptr_t data) {
}
clif->send_homdata(sd,SP_HUNGRY,hd->homunculus.hunger);
- hd->hungry_timer = add_timer(tick+hd->homunculusDB->hungryDelay,homun->hunger_timer,sd->bl.id,0); //simple Fix albator
+ hd->hungry_timer = iTimer->add_timer(tick+hd->homunculusDB->hungryDelay,homun->hunger_timer,sd->bl.id,0); //simple Fix albator
return 0;
}
void homunculus_hunger_timer_delete(struct homun_data *hd) {
nullpo_retv(hd);
if(hd->hungry_timer != INVALID_TIMER) {
- delete_timer(hd->hungry_timer,homun->hunger_timer);
+ iTimer->delete_timer(hd->hungry_timer,homun->hunger_timer);
hd->hungry_timer = INVALID_TIMER;
}
}
@@ -754,7 +754,7 @@ bool homunculus_create(struct map_session_data *sd, struct s_homunculus *hom) {
hd->bl.x = hd->ud.to_x;
hd->bl.y = hd->ud.to_y;
- map_addiddb(&hd->bl);
+ iMap->addiddb(&hd->bl);
status_calc_homunculus(hd,1);
hd->hungry_timer = INVALID_TIMER;
@@ -763,7 +763,7 @@ bool homunculus_create(struct map_session_data *sd, struct s_homunculus *hom) {
void homunculus_init_timers(struct homun_data * hd) {
if (hd->hungry_timer == INVALID_TIMER)
- hd->hungry_timer = add_timer(gettick()+hd->homunculusDB->hungryDelay,homun->hunger_timer,hd->master->bl.id,0);
+ hd->hungry_timer = iTimer->add_timer(iTimer->gettick()+hd->homunculusDB->hungryDelay,homun->hunger_timer,hd->master->bl.id,0);
hd->regen.state.block = 0; //Restore HP/SP block.
}
@@ -788,7 +788,7 @@ bool homunculus_call(struct map_session_data *sd) {
hd->bl.x = sd->bl.x;
hd->bl.y = sd->bl.y;
hd->bl.m = sd->bl.m;
- map_addblock(&hd->bl);
+ iMap->addblock(&hd->bl);
clif->spawn(&hd->bl);
clif->send_homdata(sd,SP_ACK,0);
clif->hominfo(sd,hd,1);
@@ -808,7 +808,7 @@ bool homunculus_recv_data(int account_id, struct s_homunculus *sh, int flag) {
struct map_session_data *sd;
struct homun_data *hd;
- sd = map_id2sd(account_id);
+ sd = iMap->id2sd(account_id);
if(!sd)
return false;
if (sd->status.char_id != sh->char_id) {
@@ -834,7 +834,7 @@ bool homunculus_recv_data(int account_id, struct s_homunculus *sh, int flag) {
if(hd && hd->homunculus.hp && !hd->homunculus.vaporize && hd->bl.prev == NULL && sd->bl.prev != NULL) {
enum homun_type htype = homun->class2type(hd->homunculus.class_);
- map_addblock(&hd->bl);
+ iMap->addblock(&hd->bl);
clif->spawn(&hd->bl);
clif->send_homdata(sd,SP_ACK,0);
clif->hominfo(sd,hd,1);
@@ -919,7 +919,7 @@ bool homunculus_ressurect(struct map_session_data* sd, unsigned char per, short
hd->bl.m = sd->bl.m;
hd->bl.x = x;
hd->bl.y = y;
- map_addblock(&hd->bl);
+ iMap->addblock(&hd->bl);
clif->spawn(&hd->bl);
}
status_revive(&hd->bl, per, 0);
@@ -1127,14 +1127,14 @@ void homunculus_read_db(void) {
if( i > 0 ) {
char path[256];
- sprintf(path, "%s/%s", db_path, filename[i]);
+ sprintf(path, "%s/%s", iMap->db_path, filename[i]);
if( !exists(path) ) {
continue;
}
}
- sv->readdb(db_path, filename[i], ',', 50, 50, MAX_HOMUNCULUS_CLASS, homun->read_db_sub);
+ sv->readdb(iMap->db_path, filename[i], ',', 50, 50, MAX_HOMUNCULUS_CLASS, homun->read_db_sub);
}
}
@@ -1180,7 +1180,7 @@ bool homunculus_read_skill_db_sub(char* split[], int columns, int current) {
void homunculus_skill_db_read(void) {
memset(homun->skill_tree,0,sizeof(homun->skill_tree));
- sv->readdb(db_path, "homun_skill_tree.txt", ',', 13, 15, -1, homun->read_skill_db_sub);
+ sv->readdb(iMap->db_path, "homun_skill_tree.txt", ',', 13, 15, -1, homun->read_skill_db_sub);
}
@@ -1194,7 +1194,7 @@ void homunculus_exp_db_read(void) {
memset(homun->exptable,0,sizeof(homun->exptable));
for(i = 0; i < 2; i++) {
- sprintf(line, "%s/%s", db_path, filename[i]);
+ sprintf(line, "%s/%s", iMap->db_path, filename[i]);
if( (fp=fopen(line,"r")) == NULL) {
if(i != 0)
continue;
@@ -1233,7 +1233,7 @@ void do_init_homunculus(void) {
homun->exp_db_read();
homun->skill_db_read();
// Add homunc timer function to timer func list [Toms]
- add_timer_func_list(homun->hunger_timer, "homunculus_hunger_timer");
+ iTimer->add_timer_func_list(homun->hunger_timer, "homunculus_hunger_timer");
//Stock view data for homuncs
memset(&homun->viewdb, 0, sizeof(homun->viewdb));
diff --git a/src/map/instance.c b/src/map/instance.c
index 8ddde8b3e..def0a43a8 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -1,5 +1,6 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#include "../common/cbasetypes.h"
#include "../common/socket.h"
@@ -24,20 +25,13 @@
#include <stdarg.h>
#include <time.h>
-int instance_start = 0; // To keep the last index + 1 of normal map inserted in the map[ARRAY]
-struct s_instance instance[MAX_INSTANCE];
-
-
/// Checks whether given instance id is valid or not.
-static bool instance_is_valid(int instance_id)
-{
- if( instance_id < 1 || instance_id >= ARRAYLENGTH(instance) )
- {// out of range
+bool instance_is_valid(int instance_id) {
+ if( instance_id < 0 || instance_id >= instance->instances ) {// out of range
return false;
}
- if( instance[instance_id].state == INSTANCE_FREE )
- {// uninitialized/freed instance slot
+ if( instances[instance_id].state == INSTANCE_FREE ) {// uninitialized/freed instance slot
return false;
}
@@ -48,99 +42,154 @@ static bool instance_is_valid(int instance_id)
/*--------------------------------------
* name : instance name
* Return value could be
- * -4 = already exists | -3 = no free instances | -2 = party not found | -1 = invalid type
+ * -4 = already exists | -3 = no free instances | -2 = owner not found | -1 = invalid type
* On success return instance_id
*--------------------------------------*/
-int instance_create(int party_id, const char *name)
-{
- int i;
- struct party_data* p;
-
- if( ( p = party_search(party_id) ) == NULL )
- {
- ShowError("instance_create: party %d not found for instance '%s'.\n", party_id, name);
- return -2;
+int instance_create(int owner_id, const char *name, enum instance_owner_type type) {
+ unsigned short *iptr = NULL, *icptr = NULL;
+ struct map_session_data *sd = NULL;
+ struct party_data *p = NULL;
+ struct guild *g = NULL;
+ int i, j;
+
+ switch ( type ) {
+ case IOT_NONE:
+ break;
+ case IOT_CHAR:
+ if( ( sd = iMap->id2sd(owner_id) ) == NULL ) {
+ ShowError("instance_create: character %d not found for instance '%s'.\n", owner_id, name);
+ return -2;
+ }
+ iptr = sd->instance;
+ icptr = &sd->instances;
+ break;
+ case IOT_PARTY:
+ if( ( p = iParty->search(owner_id) ) == NULL ) {
+ ShowError("instance_create: party %d not found for instance '%s'.\n", owner_id, name);
+ return -2;
+ }
+ iptr = p->instance;
+ icptr = &p->instances;
+ break;
+ case IOT_GUILD:
+ if( ( g = guild->search(owner_id) ) == NULL ) {
+ ShowError("instance_create: guild %d not found for instance '%s'.\n", owner_id, name);
+ return -2;
+ }
+ iptr = g->instance;
+ icptr = &g->instances;
+ break;
+ default:
+ ShowError("instance_create: unknown type %d for owner_id %d and name %s.\n", type,owner_id,name);
+ return -1;
}
-
- if( p->instance_id )
- return -4; // Party already instancing
-
- // Searching a Free Instance
- // 0 is ignored as this mean "no instance" on maps
- ARR_FIND(1, MAX_INSTANCE, i, instance[i].state == INSTANCE_FREE);
- if( i == MAX_INSTANCE )
- {
- ShowError("instance_create: no free instances, consider increasing MAX_INSTANCE.\n");
- return -3;
+
+ if( type != IOT_NONE && *icptr ) {
+ ARR_FIND(0, *icptr, i, strcmp(instances[iptr[i]].name,name) == 0 );
+ if( i != *icptr )
+ return -4;/* already got this instance */
}
-
- instance[i].state = INSTANCE_IDLE;
- instance[i].instance_id = i;
- instance[i].idle_timer = INVALID_TIMER;
- instance[i].idle_timeout = instance[i].idle_timeoutval = 0;
- instance[i].progress_timer = INVALID_TIMER;
- instance[i].progress_timeout = 0;
- instance[i].users = 0;
- instance[i].party_id = party_id;
- instance[i].vars = idb_alloc(DB_OPT_RELEASE_DATA);
-
- safestrncpy( instance[i].name, name, sizeof(instance[i].name) );
- memset( instance[i].map, 0x00, sizeof(instance[i].map) );
- p->instance_id = i;
-
+
+ ARR_FIND(0, instance->instances, i, instances[i].state == INSTANCE_FREE);
+
+ if( i == instance->instances )
+ RECREATE(instances, struct instance_data, ++instance->instances);
+
+ instances[i].state = INSTANCE_IDLE;
+ instances[i].id = i;
+ instances[i].idle_timer = INVALID_TIMER;
+ instances[i].idle_timeout = instances[i].idle_timeoutval = 0;
+ instances[i].progress_timer = INVALID_TIMER;
+ instances[i].progress_timeout = 0;
+ instances[i].users = 0;
+ instances[i].map = NULL;
+ instances[i].num_map = 0;
+ instances[i].owner_id = owner_id;
+ instances[i].owner_type = type;
+ instances[i].vars = idb_alloc(DB_OPT_RELEASE_DATA);
+
+ safestrncpy( instances[i].name, name, sizeof(instances[i].name) );
+ instances[i].map = NULL;
+
+ if( type != IOT_NONE ) {
+ ARR_FIND(0, *icptr, j, iptr[j] == 0);
+ if( j == *icptr ) {
+ switch( type ) {
+ case IOT_CHAR:
+ RECREATE(sd->instance, unsigned short, ++*icptr);
+ sd->instance[sd->instances-1] = i;
+ break;
+ case IOT_PARTY:
+ RECREATE(p->instance, unsigned short, ++*icptr);
+ p->instance[p->instances-1] = i;
+ break;
+ case IOT_GUILD:
+ RECREATE(g->instance, unsigned short, ++*icptr);
+ g->instance[g->instances-1] = i;
+ break;
+ }
+ } else
+ iptr[j] = i;
+ }
+
clif->instance(i, 1, 0); // Start instancing window
- ShowInfo("[Instance] Created: %s.\n", name);
return i;
}
/*--------------------------------------
* Add a map to the instance using src map "name"
*--------------------------------------*/
-int instance_add_map(const char *name, int instance_id, bool usebasename)
-{
- int16 m = map_mapname2mapid(name);
+int instance_add_map(const char *name, int instance_id, bool usebasename, const char *map_name) {
+ int16 m = iMap->mapname2mapid(name);
int i, im = -1;
size_t num_cell, size;
if( m < 0 )
return -1; // source map not found
- if( !instance_is_valid(instance_id) )
- {
+ if( !instance->valid(instance_id) ) {
ShowError("instance_add_map: trying to attach '%s' map to non-existing instance %d.\n", name, instance_id);
return -1;
}
- if( instance[instance_id].num_map >= MAX_MAP_PER_INSTANCE )
- {
- ShowError("instance_add_map: trying to add '%s' map to instance %d (%s) failed. Please increase MAX_MAP_PER_INSTANCE.\n", name, instance_id, instance[instance_id].name);
+
+ if( map_name != NULL && strdb_iget(mapindex_db, map_name) ) {
+ ShowError("instance_add_map: trying to create instanced map with existent name '%s'\n", map_name);
return -2;
}
- if( map[m].instance_id != 0 )
- { // Source map already belong to a Instance.
+
+ if( map[m].instance_id >= 0 ) { // Source map already belong to a Instance.
ShowError("instance_add_map: trying to instance already instanced map %s.\n", name);
return -4;
}
-
- ARR_FIND( instance_start, map_num, i, !map[i].name[0] ); // Searching for a Free Map
- if( i < map_num ) im = i; // Unused map found (old instance)
- else if( map_num - 1 >= MAX_MAP_PER_SERVER )
- { // No more free maps
- ShowError("instance_add_map: no more free space to create maps on this server.\n");
- return -5;
+
+ ARR_FIND( instance->start_id, iMap->map_num, i, !map[i].name[0] ); // Searching for a Free Map
+
+ if( i < iMap->map_num )
+ im = i; // Unused map found (old instance)
+ else {
+ im = iMap->map_num; // Using next map index
+ RECREATE(map,struct map_data,++iMap->map_num);
}
- else im = map_num++; // Using next map index
+
+ if( map[m].cell == (struct mapcell *)0xdeadbeaf )
+ iMap->cellfromcache(&map[m]);
memcpy( &map[im], &map[m], sizeof(struct map_data) ); // Copy source map
- snprintf(map[im].name, MAP_NAME_LENGTH, (usebasename ? "%.3d#%s" : "%.3d%s"), instance_id, name); // Generate Name for Instance Map
+ if( map_name != NULL ) {
+ snprintf(map[im].name, MAP_NAME_LENGTH, "%s", map_name);
+ map[im].cName = map[m].name;
+ } else
+ snprintf(map[im].name, MAP_NAME_LENGTH, (usebasename ? "%.3d#%s" : "%.3d%s"), instance_id, name); // Generate Name for Instance Map
map[im].index = mapindex_addmap(-1, map[im].name); // Add map index
- if( !map[im].index )
- {
+ map[im].channel = NULL;
+
+ if( !map[im].index ) {
map[im].name[0] = '\0';
ShowError("instance_add_map: no more free map indexes.\n");
return -3; // No free map index
}
-
+
// Reallocate cells
num_cell = map[im].xs * map[im].ys;
CREATE( map[im].cell, struct mapcell, num_cell );
@@ -161,9 +210,11 @@ int instance_add_map(const char *name, int instance_id, bool usebasename)
map[im].instance_src_map = m;
map[m].flag.src4instance = 1; // Flag this map as a src map for instances
- instance[instance_id].map[instance[instance_id].num_map++] = im; // Attach to actual instance
- map_addmap2db(&map[im]);
+ RECREATE(instances[instance_id].map, unsigned short, ++instances[instance_id].num_map);
+ instances[instance_id].map[instances[instance_id].num_map - 1] = im; // Attach to actual instance
+ iMap->addmap2db(&map[im]);
+
return im;
}
@@ -172,19 +223,16 @@ int instance_add_map(const char *name, int instance_id, bool usebasename)
* party_id : source party of this instance
* type : result (0 = map id | 1 = instance id)
*--------------------------------------*/
-int instance_map2imap(int16 m, int instance_id)
-{
+int instance_map2imap(int16 m, int instance_id) {
int i;
- if( !instance_is_valid(instance_id) )
- {
+ if( !instance->valid(instance_id) ) {
return -1;
}
- for( i = 0; i < instance[instance_id].num_map; i++ )
- {
- if( instance[instance_id].map[i] && map[instance[instance_id].map[i]].instance_src_map == m )
- return instance[instance_id].map[i];
+ for( i = 0; i < instances[instance_id].num_map; i++ ) {
+ if( instances[instance_id].map[i] && map[instances[instance_id].map[i]].instance_src_map == m )
+ return instances[instance_id].map[i];
}
return -1;
}
@@ -194,63 +242,60 @@ int instance_map2imap(int16 m, int instance_id)
* instance_id : where to search
* result : mapid of map "m" in this instance
*--------------------------------------*/
-int instance_mapid2imapid(int16 m, int instance_id)
-{
+int instance_mapid2imapid(int16 m, int instance_id) {
if( map[m].flag.src4instance == 0 )
return m; // not instances found for this map
- else if( map[m].instance_id )
- { // This map is a instance, not a src map instance
+ else if( map[m].instance_id >= 0 ) { // This map is a instance, not a src map instance
ShowError("map_instance_mapid2imapid: already instanced (%d / %d)\n", m, instance_id);
return -1;
}
- if( !instance_is_valid(instance_id) )
+ if( !instance->valid(instance_id) )
return -1;
- return instance_map2imap(m, instance_id);
+ return instance->map2imap(m, instance_id);
}
/*--------------------------------------
* map_instance_map_npcsub
* Used on Init instance. Duplicates each script on source map
*--------------------------------------*/
-int instance_map_npcsub(struct block_list* bl, va_list args)
-{
+int instance_map_npcsub(struct block_list* bl, va_list args) {
struct npc_data* nd = (struct npc_data*)bl;
int16 m = va_arg(args, int); // Destination Map
- npc_duplicate4instance(nd, m);
+ if ( npc_duplicate4instance(nd, m) )
+ ShowDebug("instance_map_npcsub:npc_duplicate4instance failed (%s/%d)\n",nd->name,m);
+
return 1;
}
/*--------------------------------------
* Init all map on the instance. Npcs are created here
*--------------------------------------*/
-void instance_init(int instance_id)
-{
+void instance_init(int instance_id) {
int i;
- if( !instance_is_valid(instance_id) )
+ if( !instance->valid(instance_id) )
return; // nothing to do
- for( i = 0; i < instance[instance_id].num_map; i++ )
- map_foreachinmap(instance_map_npcsub, map[instance[instance_id].map[i]].instance_src_map, BL_NPC, instance[instance_id].map[i]);
+ for( i = 0; i < instances[instance_id].num_map; i++ )
+ iMap->foreachinmap(instance_map_npcsub, map[instances[instance_id].map[i]].instance_src_map, BL_NPC, instances[instance_id].map[i]);
- instance[instance_id].state = INSTANCE_BUSY;
- ShowInfo("[Instance] Initialized %s.\n", instance[instance_id].name);
+ instances[instance_id].state = INSTANCE_BUSY;
}
/*--------------------------------------
* Used on instance deleting process.
* Warps all players on each instance map to its save points.
*--------------------------------------*/
-int instance_del_load(struct map_session_data* sd, va_list args)
-{
+int instance_del_load(struct map_session_data* sd, va_list args) {
int16 m = va_arg(args,int);
+
if( !sd || sd->bl.m != m )
return 0;
- pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
+ iPc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
return 1;
}
@@ -260,7 +305,7 @@ int instance_cleanup_sub(struct block_list *bl, va_list ap) {
switch(bl->type) {
case BL_PC:
- map_quit((struct map_session_data *) bl);
+ iMap->quit((struct map_session_data *) bl);
break;
case BL_NPC:
npc_unload((struct npc_data *)bl,true);
@@ -272,7 +317,7 @@ int instance_cleanup_sub(struct block_list *bl, va_list ap) {
//There is no need for this, the pet is removed together with the player. [Skotlex]
break;
case BL_ITEM:
- map_clearflooritem(bl);
+ iMap->clearflooritem(bl);
break;
case BL_SKILL:
skill->delunit((struct skill_unit *) bl);
@@ -285,130 +330,158 @@ int instance_cleanup_sub(struct block_list *bl, va_list ap) {
/*--------------------------------------
* Removes a simple instance map
*--------------------------------------*/
-void instance_del_map(int16 m)
-{
+void instance_del_map(int16 m) {
int i;
- if( m <= 0 || !map[m].instance_id )
- {
- ShowError("Tried to remove non-existing instance map (%d)\n", m);
+
+ if( m <= 0 || map[m].instance_id == -1 ) {
+ ShowError("instance_del_map: tried to remove non-existing instance map (%d)\n", m);
return;
}
- map_foreachpc(instance_del_load, m);
- map_foreachinmap(instance_cleanup_sub, m, BL_ALL);
+ iMap->map_foreachpc(instance_del_load, m);
+ iMap->foreachinmap(instance_cleanup_sub, m, BL_ALL);
if( map[m].mob_delete_timer != INVALID_TIMER )
- delete_timer(map[m].mob_delete_timer, map_removemobs_timer);
-
+ iTimer->delete_timer(map[m].mob_delete_timer, iMap->removemobs_timer);
+
mapindex_removemap( map[m].index );
// Free memory
aFree(map[m].cell);
aFree(map[m].block);
aFree(map[m].block_mob);
-
+
// Remove from instance
- for( i = 0; i < instance[map[m].instance_id].num_map; i++ )
- {
- if( instance[map[m].instance_id].map[i] == m )
- {
- instance[map[m].instance_id].num_map--;
- for( ; i < instance[map[m].instance_id].num_map; i++ )
- instance[map[m].instance_id].map[i] = instance[map[m].instance_id].map[i+1];
+ for( i = 0; i < instances[map[m].instance_id].num_map; i++ ) {
+ if( instances[map[m].instance_id].map[i] == m ) {
+ instances[map[m].instance_id].num_map--;
+ for( ; i < instances[map[m].instance_id].num_map; i++ )
+ instances[map[m].instance_id].map[i] = instances[map[m].instance_id].map[i+1];
i = -1;
break;
}
}
- if( i == instance[map[m].instance_id].num_map )
- ShowError("map_instance_del: failed to remove %s from instance list (%s): %d\n", map[m].name, instance[map[m].instance_id].name, m);
-
- map_removemapdb(&map[m]);
+
+ if( i == instances[map[m].instance_id].num_map )
+ ShowError("map_instance_del: failed to remove %s from instance list (%s): %d\n", map[m].name, instances[map[m].instance_id].name, m);
+
+ if( map[m].channel )
+ clif->chsys_delete(map[m].channel);
+
+ iMap->removemapdb(&map[m]);
memset(&map[m], 0x00, sizeof(map[0]));
-
- /* for it is default and makes it not try to delete a non-existent timer since we did not delete this entry. */
+ map[m].instance_id = -1;
map[m].mob_delete_timer = INVALID_TIMER;
}
/*--------------------------------------
* Timer to destroy instance by process or idle
*--------------------------------------*/
-int instance_destroy_timer(int tid, unsigned int tick, int id, intptr_t data)
-{
- instance_destroy(id);
+int instance_destroy_timer(int tid, unsigned int tick, int id, intptr_t data) {
+ instance->destroy(id);
return 0;
}
/*--------------------------------------
* Removes a instance, all its maps and npcs.
*--------------------------------------*/
-void instance_destroy(int instance_id)
-{
- int last = 0, type;
- struct party_data *p;
- time_t now = time(NULL);
-
- if( !instance_is_valid(instance_id) )
+void instance_destroy(int instance_id) {
+ unsigned short *iptr = NULL, *icptr = NULL;
+ struct map_session_data *sd = NULL;
+ struct party_data *p = NULL;
+ struct guild *g = NULL;
+ int last = 0, type, j;
+ unsigned int now = (unsigned int)time(NULL);
+
+ if( !instance->valid(instance_id) )
return; // nothing to do
- if( instance[instance_id].progress_timeout && instance[instance_id].progress_timeout <= now )
+ if( instances[instance_id].progress_timeout && instances[instance_id].progress_timeout <= now )
type = 1;
- else if( instance[instance_id].idle_timeout && instance[instance_id].idle_timeout <= now )
+ else if( instances[instance_id].idle_timeout && instances[instance_id].idle_timeout <= now )
type = 2;
else
type = 3;
clif->instance(instance_id, 5, type); // Report users this instance has been destroyed
- while( instance[instance_id].num_map && last != instance[instance_id].map[0] )
- { // Remove all maps from instance
- last = instance[instance_id].map[0];
- instance_del_map( instance[instance_id].map[0] );
+ switch ( instances[instance_id].owner_type ) {
+ case IOT_NONE:
+ break;
+ case IOT_CHAR:
+ if( ( sd = iMap->id2sd(instances[instance_id].owner_id) ) == NULL ) {
+ break;
+ }
+ iptr = sd->instance;
+ icptr = &sd->instances;
+ break;
+ case IOT_PARTY:
+ if( ( p = iParty->search(instances[instance_id].owner_id) ) == NULL ) {
+ break;
+ }
+ iptr = p->instance;
+ icptr = &p->instances;
+ break;
+ case IOT_GUILD:
+ if( ( g = guild->search(instances[instance_id].owner_id) ) == NULL ) {
+ break;
+ }
+ iptr = g->instance;
+ icptr = &g->instances;
+ break;
+ default:
+ ShowError("instance_destroy: unknown type %d for owner_id %d and name %s.\n", instances[instance_id].owner_type,instances[instance_id].owner_id,instances[instance_id].name);
+ break;
+ }
+
+ if( iptr != NULL ) {
+ ARR_FIND(0, *icptr, j, iptr[j] == instance_id);
+ if( j != *icptr )
+ iptr[j] = 0;
+ }
+
+ while( instances[instance_id].num_map && last != instances[instance_id].map[0] ) { // Remove all maps from instance
+ last = instances[instance_id].map[0];
+ instance->del_map( instances[instance_id].map[0] );
}
- if( instance[instance_id].vars )
- db_destroy(instance[instance_id].vars);
-
- if( instance[instance_id].progress_timer != INVALID_TIMER )
- delete_timer( instance[instance_id].progress_timer, instance_destroy_timer);
- if( instance[instance_id].idle_timer != INVALID_TIMER )
- delete_timer( instance[instance_id].idle_timer, instance_destroy_timer);
+ if( instances[instance_id].vars )
+ db_destroy(instances[instance_id].vars);
- instance[instance_id].vars = NULL;
+ if( instances[instance_id].progress_timer != INVALID_TIMER )
+ iTimer->delete_timer( instances[instance_id].progress_timer, instance_destroy_timer);
+ if( instances[instance_id].idle_timer != INVALID_TIMER )
+ iTimer->delete_timer( instances[instance_id].idle_timer, instance_destroy_timer);
- if( instance[instance_id].party_id && (p = party_search(instance[instance_id].party_id)) != NULL )
- p->instance_id = 0; // Update Party information
+ instances[instance_id].vars = NULL;
- ShowInfo("[Instance] Destroyed %s.\n", instance[instance_id].name);
- memset( &instance[instance_id], 0x00, sizeof(instance[0]) );
+ aFree(instances[instance_id].map);
+
+ memset( &instances[instance_id], 0x00, sizeof(struct instance_data) );
- instance[instance_id].state = INSTANCE_FREE;
}
/*--------------------------------------
* Checks if there are users in the instance or not to start idle timer
*--------------------------------------*/
-void instance_check_idle(int instance_id)
-{
+void instance_check_idle(int instance_id) {
bool idle = true;
- time_t now = time(NULL);
+ unsigned int now = (unsigned int)time(NULL);
- if( !instance_is_valid(instance_id) || instance[instance_id].idle_timeoutval == 0 )
+ if( !instance->valid(instance_id) || instances[instance_id].idle_timeoutval == 0 )
return;
- if( instance[instance_id].users )
+ if( instances[instance_id].users )
idle = false;
- if( instance[instance_id].idle_timer != INVALID_TIMER && !idle )
- {
- delete_timer(instance[instance_id].idle_timer, instance_destroy_timer);
- instance[instance_id].idle_timer = INVALID_TIMER;
- instance[instance_id].idle_timeout = 0;
+ if( instances[instance_id].idle_timer != INVALID_TIMER && !idle ) {
+ iTimer->delete_timer(instances[instance_id].idle_timer, instance_destroy_timer);
+ instances[instance_id].idle_timer = INVALID_TIMER;
+ instances[instance_id].idle_timeout = 0;
clif->instance(instance_id, 3, 0); // Notify instance users normal instance expiration
- }
- else if( instance[instance_id].idle_timer == INVALID_TIMER && idle )
- {
- instance[instance_id].idle_timeout = now + instance[instance_id].idle_timeoutval;
- instance[instance_id].idle_timer = add_timer( gettick() + (unsigned int)instance[instance_id].idle_timeoutval * 1000, instance_destroy_timer, instance_id, 0);
+ } else if( instances[instance_id].idle_timer == INVALID_TIMER && idle ) {
+ instances[instance_id].idle_timeout = now + instances[instance_id].idle_timeoutval;
+ instances[instance_id].idle_timer = iTimer->add_timer( iTimer->gettick() + instances[instance_id].idle_timeoutval * 1000, instance_destroy_timer, instance_id, 0);
clif->instance(instance_id, 4, 0); // Notify instance users it will be destroyed of no user join it again in "X" time
}
}
@@ -418,71 +491,88 @@ void instance_check_idle(int instance_id)
*--------------------------------------*/
void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsigned int idle_timeout)
{
- time_t now = time(0);
+ unsigned int now = (unsigned int)time(0);
- if( !instance_is_valid(instance_id) )
+ if( !instance->valid(instance_id) )
return;
- if( instance[instance_id].progress_timer != INVALID_TIMER )
- delete_timer( instance[instance_id].progress_timer, instance_destroy_timer);
- if( instance[instance_id].idle_timer != INVALID_TIMER )
- delete_timer( instance[instance_id].idle_timer, instance_destroy_timer);
-
- if( progress_timeout )
- {
- instance[instance_id].progress_timeout = now + progress_timeout;
- instance[instance_id].progress_timer = add_timer( gettick() + progress_timeout * 1000, instance_destroy_timer, instance_id, 0);
- }
- else
- {
- instance[instance_id].progress_timeout = 0;
- instance[instance_id].progress_timer = INVALID_TIMER;
+ if( instances[instance_id].progress_timer != INVALID_TIMER )
+ iTimer->delete_timer( instances[instance_id].progress_timer, instance_destroy_timer);
+ if( instances[instance_id].idle_timer != INVALID_TIMER )
+ iTimer->delete_timer( instances[instance_id].idle_timer, instance_destroy_timer);
+
+ if( progress_timeout ) {
+ instances[instance_id].progress_timeout = now + progress_timeout;
+ instances[instance_id].progress_timer = iTimer->add_timer( iTimer->gettick() + progress_timeout * 1000, instance_destroy_timer, instance_id, 0);
+ } else {
+ instances[instance_id].progress_timeout = 0;
+ instances[instance_id].progress_timer = INVALID_TIMER;
}
- if( idle_timeout )
- {
- instance[instance_id].idle_timeoutval = idle_timeout;
- instance[instance_id].idle_timer = INVALID_TIMER;
+ if( idle_timeout ) {
+ instances[instance_id].idle_timeoutval = idle_timeout;
+ instances[instance_id].idle_timer = INVALID_TIMER;
instance_check_idle(instance_id);
- }
- else
- {
- instance[instance_id].idle_timeoutval = 0;
- instance[instance_id].idle_timeout = 0;
- instance[instance_id].idle_timer = INVALID_TIMER;
+ } else {
+ instances[instance_id].idle_timeoutval = 0;
+ instances[instance_id].idle_timeout = 0;
+ instances[instance_id].idle_timer = INVALID_TIMER;
}
- if( instance[instance_id].idle_timer == INVALID_TIMER && instance[instance_id].progress_timer != INVALID_TIMER )
+ if( instances[instance_id].idle_timer == INVALID_TIMER && instances[instance_id].progress_timer != INVALID_TIMER )
clif->instance(instance_id, 3, 0);
}
/*--------------------------------------
* Checks if sd in on a instance and should be kicked from it
*--------------------------------------*/
-void instance_check_kick(struct map_session_data *sd)
-{
+void instance_check_kick(struct map_session_data *sd) {
int16 m = sd->bl.m;
clif->instance_leave(sd->fd);
- if( map[m].instance_id )
- { // User was on the instance map
+ if( map[m].instance_id >= 0 ) { // User was on the instance map
if( map[m].save.map )
- pc_setpos(sd, map[m].save.map, map[m].save.x, map[m].save.y, CLR_TELEPORT);
+ iPc->setpos(sd, map[m].save.map, map[m].save.x, map[m].save.y, CLR_TELEPORT);
else
- pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
+ iPc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
}
}
-void do_final_instance(void)
-{
+void do_final_instance(void) {
int i;
- for( i = 1; i < MAX_INSTANCE; i++ )
+ for(i = 0; i < instance->instances; i++) {
instance_destroy(i);
+ }
+
+ aFree(instances);
}
-void do_init_instance(void)
-{
- memset(instance, 0x00, sizeof(instance));
- add_timer_func_list(instance_destroy_timer, "instance_destroy_timer");
+void do_init_instance(void) {
+ iTimer->add_timer_func_list(instance_destroy_timer, "instance_destroy_timer");
+}
+
+void instance_defaults(void) {
+ instance = &instance_s;
+
+ instance->init = do_init_instance;
+ instance->final = do_final_instance;
+
+ /* start point */
+ instance->start_id = 0;
+ /* count */
+ instance->instances = 0;
+
+ /* */
+ instance->create = instance_create;
+ instance->add_map = instance_add_map;
+ instance->del_map = instance_del_map;
+ instance->map2imap = instance_map2imap;
+ instance->mapid2imapid = instance_mapid2imapid;
+ instance->destroy = instance_destroy;
+ instance->start = instance_init;
+ instance->check_idle = instance_check_idle;
+ instance->check_kick = instance_check_kick;
+ instance->set_timeout = instance_set_timeout;
+ instance->valid = instance_is_valid;
}
diff --git a/src/map/instance.h b/src/map/instance.h
index 03b0d0898..e86586e44 100644
--- a/src/map/instance.h
+++ b/src/map/instance.h
@@ -1,51 +1,71 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#ifndef _INSTANCE_H_
#define _INSTANCE_H_
-#define MAX_MAP_PER_INSTANCE 10
-#define MAX_INSTANCE 500
-
#define INSTANCE_NAME_LENGTH (60+1)
-typedef enum instance_state { INSTANCE_FREE, INSTANCE_IDLE, INSTANCE_BUSY } instance_state;
+typedef enum instance_state {
+ INSTANCE_FREE,
+ INSTANCE_IDLE,
+ INSTANCE_BUSY
+} instance_state;
+
+enum instance_owner_type {
+ IOT_NONE,
+ IOT_CHAR,
+ IOT_PARTY,
+ IOT_GUILD,
+ /* ... */
+ IOT_MAX,
+};
-struct s_instance {
+struct instance_data {
+ unsigned short id;
char name[INSTANCE_NAME_LENGTH]; // Instance Name - required for clif functions.
instance_state state;
- short instance_id;
- int party_id;
+ enum instance_owner_type owner_type;
+ int owner_id;
- int map[MAX_MAP_PER_INSTANCE];
- int num_map;
- int users;
+ unsigned short *map;
+ unsigned short num_map;
+ unsigned short users;
struct DBMap* vars; // Instance Variable for scripts
int progress_timer;
- time_t progress_timeout;
+ unsigned int progress_timeout;
int idle_timer;
- time_t idle_timeout, idle_timeoutval;
+ unsigned int idle_timeout, idle_timeoutval;
};
-extern int instance_start;
-extern struct s_instance instance[MAX_INSTANCE];
+struct instance_data *instances;
-int instance_create(int party_id, const char *name);
-int instance_add_map(const char *name, int instance_id, bool usebasename);
-void instance_del_map(int16 m);
-int instance_map2imap(int16 m, int instance_id);
-int instance_mapid2imapid(int16 m, int instance_id);
-void instance_destroy(int instance_id);
-void instance_init(int instance_id);
+struct instance_interface {
+ void (*init) (void);
+ void (*final) (void);
+ /* start point */
+ unsigned short start_id;
+ unsigned short instances;
+ /* */
+ int (*create) (int party_id, const char *name, enum instance_owner_type type);
+ int (*add_map) (const char *name, int instance_id, bool usebasename, const char *map_name);
+ void (*del_map) (int16 m);
+ int (*map2imap) (int16 m, int instance_id);
+ int (*mapid2imapid) (int16 m, int instance_id);
+ void (*destroy) (int instance_id);
+ void (*start) (int instance_id);
+ void (*check_idle) (int instance_id);
+ void (*check_kick) (struct map_session_data *sd);
+ void (*set_timeout) (int instance_id, unsigned int progress_timeout, unsigned int idle_timeout);
+ bool (*valid) (int instance_id);
+} instance_s;
-void instance_check_idle(int instance_id);
-void instance_check_kick(struct map_session_data *sd);
-void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsigned int idle_timeout);
+struct instance_interface *instance;
-void do_final_instance(void);
-void do_init_instance(void);
+void instance_defaults(void);
#endif
diff --git a/src/map/intif.c b/src/map/intif.c
index 93bb8add7..607300e57 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -467,7 +467,7 @@ int intif_party_changemap(struct map_session_data *sd,int online)
if(!sd)
return 0;
- if( (m=map_mapindex2mapid(sd->mapindex)) >= 0 && map[m].instance_id )
+ if( (m=iMap->mapindex2mapid(sd->mapindex)) >= 0 && map[m].instance_id >= 0 )
mapindex = map[map[m].instance_src_map].index;
else
mapindex = sd->mapindex;
@@ -862,7 +862,7 @@ int intif_parse_WisMessage(int fd)
id=RFIFOL(fd,4);
safestrncpy(name, (char*)RFIFOP(fd,32), NAME_LENGTH);
- sd = map_nick2sd(name);
+ sd = iMap->nick2sd(name);
if(sd == NULL || strcmp(sd->status.name, name) != 0)
{ //Not found
intif_wis_replay(id,1);
@@ -896,7 +896,7 @@ int intif_parse_WisEnd(int fd)
if (battle_config.etc_log)
ShowInfo("intif_parse_wisend: player: %s, flag: %d\n", RFIFOP(fd,2), RFIFOB(fd,26)); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
- sd = (struct map_session_data *)map_nick2sd((char *) RFIFOP(fd,2));
+ sd = (struct map_session_data *)iMap->nick2sd((char *) RFIFOP(fd,2));
if (sd != NULL)
clif->wis_end(sd->fd, RFIFOB(fd,26));
@@ -935,7 +935,7 @@ int mapif_parse_WisToGM(int fd)
safestrncpy(Wisp_name, (char*)RFIFOP(fd,4), NAME_LENGTH);
safestrncpy(message, (char*)RFIFOP(fd,32), mes_len);
// information is sent to all online GM
- map_foreachpc(mapif_parse_WisToGM_sub, permission, Wisp_name, message, mes_len);
+ iMap->map_foreachpc(mapif_parse_WisToGM_sub, permission, Wisp_name, message, mes_len);
if (message != mbuf)
aFree(message);
@@ -954,7 +954,7 @@ int intif_parse_Registers(int fd)
if (node)
sd = node->sd;
else { //Normally registries should arrive for in log-in chars.
- sd = map_id2sd(account_id);
+ sd = iMap->id2sd(account_id);
if (sd && RFIFOB(fd,12) == 3 && sd->status.char_id != char_id)
sd = NULL; //Character registry from another character.
}
@@ -993,7 +993,7 @@ int intif_parse_Registers(int fd)
*qty = j;
if (flag && sd->save_reg.global_num > -1 && sd->save_reg.account_num > -1 && sd->save_reg.account2_num > -1)
- pc_reg_received(sd); //Received all registry values, execute init scripts and what-not. [Skotlex]
+ iPc->reg_received(sd); //Received all registry values, execute init scripts and what-not. [Skotlex]
return 1;
}
@@ -1006,7 +1006,7 @@ int intif_parse_LoadGuildStorage(int fd)
guild_id = RFIFOL(fd,8);
if(guild_id <= 0)
return 1;
- sd=map_id2sd( RFIFOL(fd,4) );
+ sd=iMap->id2sd( RFIFOL(fd,4) );
if(sd==NULL){
ShowError("intif_parse_LoadGuildStorage: user not found %d\n",RFIFOL(fd,4));
return 1;
@@ -1047,7 +1047,7 @@ int intif_parse_PartyCreated(int fd)
{
if(battle_config.etc_log)
ShowInfo("intif: party created by account %d\n\n", RFIFOL(fd,2));
- party_created(RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10),RFIFOL(fd,11), (char *)RFIFOP(fd,15));
+ iParty->created(RFIFOL(fd,2), RFIFOL(fd,6),RFIFOB(fd,10),RFIFOL(fd,11), (char *)RFIFOP(fd,15));
return 0;
}
@@ -1056,13 +1056,13 @@ int intif_parse_PartyInfo(int fd)
{
if( RFIFOW(fd,2) == 12 ){
ShowWarning("intif: party noinfo (char_id=%d party_id=%d)\n", RFIFOL(fd,4), RFIFOL(fd,8));
- party_recv_noinfo(RFIFOL(fd,8), RFIFOL(fd,4));
+ iParty->recv_noinfo(RFIFOL(fd,8), RFIFOL(fd,4));
return 0;
}
if( RFIFOW(fd,2) != 8+sizeof(struct party) )
ShowError("intif: party info : data size error (char_id=%d party_id=%d packet_len=%d expected_len=%d)\n", RFIFOL(fd,4), RFIFOL(fd,8), RFIFOW(fd,2), 8+sizeof(struct party));
- party_recv_info((struct party *)RFIFOP(fd,8), RFIFOL(fd,4));
+ iParty->recv_info((struct party *)RFIFOP(fd,8), RFIFOL(fd,4));
return 0;
}
@@ -1071,14 +1071,14 @@ int intif_parse_PartyMemberAdded(int fd)
{
if(battle_config.etc_log)
ShowInfo("intif: party member added Party (%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
- party_member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10), RFIFOB(fd, 14));
+ iParty->member_added(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10), RFIFOB(fd, 14));
return 0;
}
// ACK changing party option
int intif_parse_PartyOptionChanged(int fd)
{
- party_optionchanged(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOW(fd,10),RFIFOW(fd,12),RFIFOB(fd,14));
+ iParty->optionchanged(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOW(fd,10),RFIFOW(fd,12),RFIFOB(fd,14));
return 0;
}
@@ -1087,28 +1087,28 @@ int intif_parse_PartyMemberWithdraw(int fd)
{
if(battle_config.etc_log)
ShowInfo("intif: party member withdraw: Party(%d), Account(%d), Char(%d)\n",RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
- party_member_withdraw(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
+ iParty->member_withdraw(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10));
return 0;
}
// ACK party break
int intif_parse_PartyBroken(int fd)
{
- party_broken(RFIFOL(fd,2));
+ iParty->broken(RFIFOL(fd,2));
return 0;
}
// ACK party on new map
int intif_parse_PartyMove(int fd)
{
- party_recv_movemap(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOW(fd,14),RFIFOB(fd,16),RFIFOW(fd,17));
+ iParty->recv_movemap(RFIFOL(fd,2),RFIFOL(fd,6),RFIFOL(fd,10),RFIFOW(fd,14),RFIFOB(fd,16),RFIFOW(fd,17));
return 0;
}
// ACK party messages
int intif_parse_PartyMessage(int fd)
{
- party_recv_message(RFIFOL(fd,4),RFIFOL(fd,8),(char *) RFIFOP(fd,12),RFIFOW(fd,2)-12);
+ iParty->recv_message(RFIFOL(fd,4),RFIFOL(fd,8),(char *) RFIFOP(fd,12),RFIFOW(fd,2)-12);
return 0;
}
@@ -1322,7 +1322,7 @@ int intif_parse_DeletePetOk(int fd)
int intif_parse_ChangeNameOk(int fd)
{
struct map_session_data *sd = NULL;
- if((sd=map_id2sd(RFIFOL(fd,2)))==NULL ||
+ if((sd=iMap->id2sd(RFIFOL(fd,2)))==NULL ||
sd->status.char_id != RFIFOL(fd,6))
return 0;
@@ -1405,7 +1405,7 @@ int intif_parse_questlog(int fd)
{
int char_id = RFIFOL(fd, 4);
int i;
- TBL_PC * sd = map_charid2sd(char_id);
+ TBL_PC * sd = iMap->charid2sd(char_id);
//User not online anymore
if(!sd)
@@ -1442,7 +1442,7 @@ int intif_parse_questlog(int fd)
int intif_parse_questsave(int fd)
{
int cid = RFIFOL(fd, 2);
- TBL_PC *sd = map_id2sd(cid);
+ TBL_PC *sd = iMap->id2sd(cid);
if( !RFIFOB(fd, 6) )
ShowError("intif_parse_questsave: Failed to save quest(s) for character %d!\n", cid);
@@ -1500,7 +1500,7 @@ int intif_parse_Mail_inboxreceived(int fd)
struct map_session_data *sd;
unsigned char flag = RFIFOB(fd,8);
- sd = map_charid2sd(RFIFOL(fd,4));
+ sd = iMap->charid2sd(RFIFOL(fd,4));
if (sd == NULL)
{
@@ -1566,7 +1566,7 @@ int intif_parse_Mail_getattach(int fd)
struct item item;
int zeny = RFIFOL(fd,8);
- sd = map_charid2sd( RFIFOL(fd,4) );
+ sd = iMap->charid2sd( RFIFOL(fd,4) );
if (sd == NULL)
{
@@ -1608,7 +1608,7 @@ int intif_parse_Mail_delete(int fd)
int mail_id = RFIFOL(fd,6);
bool failed = RFIFOB(fd,10);
- struct map_session_data *sd = map_charid2sd(char_id);
+ struct map_session_data *sd = iMap->charid2sd(char_id);
if (sd == NULL)
{
ShowError("intif_parse_Mail_delete: char not found %d\n", char_id);
@@ -1651,7 +1651,7 @@ int intif_Mail_return(int char_id, int mail_id)
int intif_parse_Mail_return(int fd)
{
- struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+ struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
int mail_id = RFIFOL(fd,6);
short fail = RFIFOB(fd,10);
@@ -1714,7 +1714,7 @@ static void intif_parse_Mail_send(int fd)
fail = (msg.id == 0);
// notify sender
- sd = map_charid2sd(msg.send_id);
+ sd = iMap->charid2sd(msg.send_id);
if( sd != NULL )
{
if( fail )
@@ -1722,7 +1722,7 @@ static void intif_parse_Mail_send(int fd)
else
{
clif->mail_send(sd->fd, false);
- if( save_settings&16 )
+ if( iMap->save_settings&16 )
chrif_save(sd, 0);
}
}
@@ -1730,7 +1730,7 @@ static void intif_parse_Mail_send(int fd)
static void intif_parse_Mail_new(int fd)
{
- struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+ struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
int mail_id = RFIFOL(fd,6);
const char* sender_name = (char*)RFIFOP(fd,10);
const char* title = (char*)RFIFOP(fd,34);
@@ -1768,7 +1768,7 @@ int intif_Auction_requestlist(int char_id, short type, int price, const char* se
static void intif_parse_Auction_results(int fd)
{
- struct map_session_data *sd = map_charid2sd(RFIFOL(fd,4));
+ struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,4));
short count = RFIFOW(fd,8);
short pages = RFIFOW(fd,10);
uint8* data = RFIFOP(fd,12);
@@ -1807,13 +1807,13 @@ static void intif_parse_Auction_register(int fd)
}
memcpy(&auction, RFIFOP(fd,4), sizeof(struct auction_data));
- if( (sd = map_charid2sd(auction.seller_id)) == NULL )
+ if( (sd = iMap->charid2sd(auction.seller_id)) == NULL )
return;
if( auction.auction_id > 0 )
{
clif->auction_message(sd->fd, 1); // Confirmation Packet ??
- if( save_settings&32 )
+ if( iMap->save_settings&32 )
chrif_save(sd,0);
}
else
@@ -1821,9 +1821,9 @@ static void intif_parse_Auction_register(int fd)
int zeny = auction.hours*battle_config.auction_feeperhour;
clif->auction_message(sd->fd, 4);
- pc_additem(sd, &auction.item, auction.item.amount, LOG_TYPE_AUCTION);
+ iPc->additem(sd, &auction.item, auction.item.amount, LOG_TYPE_AUCTION);
- pc_getzeny(sd, zeny, LOG_TYPE_AUCTION, NULL);
+ iPc->getzeny(sd, zeny, LOG_TYPE_AUCTION, NULL);
}
}
@@ -1843,7 +1843,7 @@ int intif_Auction_cancel(int char_id, unsigned int auction_id)
static void intif_parse_Auction_cancel(int fd)
{
- struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+ struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
int result = RFIFOB(fd,6);
if( sd == NULL )
@@ -1874,7 +1874,7 @@ int intif_Auction_close(int char_id, unsigned int auction_id)
static void intif_parse_Auction_close(int fd)
{
- struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+ struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
unsigned char result = RFIFOB(fd,6);
if( sd == NULL )
@@ -1910,7 +1910,7 @@ int intif_Auction_bid(int char_id, const char* name, unsigned int auction_id, in
static void intif_parse_Auction_bid(int fd)
{
- struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+ struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
int bid = RFIFOL(fd,6);
unsigned char result = RFIFOB(fd,10);
@@ -1919,7 +1919,7 @@ static void intif_parse_Auction_bid(int fd)
clif->auction_message(sd->fd, result);
if( bid > 0 ) {
- pc_getzeny(sd, bid, LOG_TYPE_AUCTION,NULL);
+ iPc->getzeny(sd, bid, LOG_TYPE_AUCTION,NULL);
}
if( result == 1 ) { // To update the list, display your buy list
clif->pAuction_cancelreg(fd, sd);
@@ -1930,7 +1930,7 @@ static void intif_parse_Auction_bid(int fd)
// Used to send 'You have won the auction' and 'You failed to won the auction' messages
static void intif_parse_Auction_message(int fd)
{
- struct map_session_data *sd = map_charid2sd(RFIFOL(fd,2));
+ struct map_session_data *sd = iMap->charid2sd(RFIFOL(fd,2));
unsigned char result = RFIFOB(fd,6);
if( sd == NULL )
diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c
index 0e155011e..7f03ed8d4 100644
--- a/src/map/irc-bot.c
+++ b/src/map/irc-bot.c
@@ -22,15 +22,19 @@
char send_string[200];
int irc_connect_timer(int tid, unsigned int tick, int id, intptr_t data) {
+ struct hSockOpt opt;
if( ircbot->isOn || ++ircbot->fails >= 3 )
return 0;
- ircbot->last_try = gettick();
+ opt.silent = 1;
+ opt.setTimeo = 0;
+
+ ircbot->last_try = iTimer->gettick();
- if( ( ircbot->fd = make_connection(ircbot->ip,hChSys.irc_server_port,true) ) > 0 ){
+ if( ( ircbot->fd = make_connection(ircbot->ip,hChSys.irc_server_port,&opt) ) > 0 ){
session[ircbot->fd]->func_parse = ircbot->parse;
session[ircbot->fd]->flag.server = 1;
- add_timer(gettick() + 3000, ircbot->identify_timer, 0, 0);
+ iTimer->add_timer(iTimer->gettick() + 3000, ircbot->identify_timer, 0, 0);
ircbot->isOn = true;
}
return 0;
@@ -45,7 +49,7 @@ int irc_identify_timer(int tid, unsigned int tick, int id, intptr_t data) {
sprintf(send_string, "NICK %s", hChSys.irc_nick);
ircbot->send(send_string);
- add_timer(gettick() + 3000, ircbot->join_timer, 0, 0);
+ iTimer->add_timer(iTimer->gettick() + 3000, ircbot->join_timer, 0, 0);
return 0;
}
@@ -86,7 +90,7 @@ int irc_parse(int fd) {
ircbot->isIn = false;
ircbot->fails = 0;
ircbot->ip = host2ip(hChSys.irc_server);
- add_timer(gettick() + 120000, ircbot->connect_timer, 0, 0);
+ iTimer->add_timer(iTimer->gettick() + 120000, ircbot->connect_timer, 0, 0);
return 0;
}
@@ -114,14 +118,14 @@ void irc_parse_source(char *source, char *nick, char *ident, char *host) {
for(i = 0; i < len; i++) {
if( stage == 0 && source[i] == '!' ) {
- memcpy(nick, &source[0], len - i);
+ memcpy(nick, &source[0], min(i,IRC_NICK_LENGTH));
nick[i] = '\0';
pos = i+1;
stage = 1;
} else if( stage == 1 && source[i] == '@' ) {
- memcpy(ident, &source[pos], i - pos);
+ memcpy(ident, &source[pos], min(i - pos,IRC_IDENT_LENGTH));
ident[i-pos] = '\0';
- memcpy(host, &source[i+1], len);
+ memcpy(host, &source[i+1], min(len - i,IRC_HOST_LENGTH));
host[len] = '\0';
break;
}
@@ -173,7 +177,7 @@ void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) {
if( strcmpi(target,hChSys.irc_nick) == 0 ) {
if( msg[0] == ':' ) msg++;
if( strcmpi(msg,"VERSION") == 0 ) {
- char source_nick[40], source_ident[40], source_host[100];
+ char source_nick[IRC_NICK_LENGTH], source_ident[IRC_IDENT_LENGTH], source_host[IRC_HOST_LENGTH];
source_nick[0] = source_ident[0] = source_host[0] = '\0';
@@ -185,13 +189,13 @@ void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) {
return;
}
} else if( strcmpi(target,hChSys.irc_channel) == 0 ) {
- char source_nick[40], source_ident[40], source_host[100];
+ char source_nick[IRC_NICK_LENGTH], source_ident[IRC_IDENT_LENGTH], source_host[IRC_HOST_LENGTH];
source_nick[0] = source_ident[0] = source_host[0] = '\0';
if( source[0] != '\0' )
ircbot->parse_source(source,source_nick,source_ident,source_host);
-
+
if( ircbot->channel ) {
snprintf(send_string, 150, "[ #%s ] IRC.%s : %s",ircbot->channel->name,source_nick,msg);
clif->chsys_msg2(ircbot->channel,send_string);
@@ -241,8 +245,8 @@ void irc_bot_init(void) {
ircbot->isIn = false;
ircbot->isOn = false;
- add_timer_func_list(ircbot->connect_timer, "irc_connect_timer");
- add_timer(gettick() + 7000, ircbot->connect_timer, 0, 0);
+ iTimer->add_timer_func_list(ircbot->connect_timer, "irc_connect_timer");
+ iTimer->add_timer(iTimer->gettick() + 7000, ircbot->connect_timer, 0, 0);
}
void irc_bot_final(void) {
diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h
index f4244e024..911a15b0e 100644
--- a/src/map/irc-bot.h
+++ b/src/map/irc-bot.h
@@ -6,6 +6,9 @@
#ifndef _IRC_BOT_H_
#define _IRC_BOT_H_
+#define IRC_NICK_LENGTH 40
+#define IRC_IDENT_LENGTH 40
+#define IRC_HOST_LENGTH 63
#define IRC_FUNC_LENGTH 30
struct hChSysCh;
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 2a5fa48de..e0cb642fb 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -30,7 +30,7 @@ struct item_data dummy_item; //This is the default dummy item used for non-exist
*/
static int itemdb_searchname_sub(DBKey key, DBData *data, va_list ap)
{
- struct item_data *item = DB->data2ptr(data), **dst, **dst2;
+ struct item_data *item = iDB->data2ptr(data), **dst, **dst2;
char *str;
str=va_arg(ap,char *);
dst=va_arg(ap,struct item_data **);
@@ -83,7 +83,7 @@ struct item_data* itemdb_searchname(const char *str)
*/
static int itemdb_searchname_array_sub(DBKey key, DBData data, va_list ap)
{
- struct item_data *item = DB->data2ptr(&data);
+ struct item_data *item = iDB->data2ptr(&data);
char *str;
str=va_arg(ap,char *);
if (item == &dummy_item)
@@ -127,7 +127,7 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str)
size -= count;
db_count = itemdb_other->getall(itemdb_other, (DBData**)&db_data, size, itemdb_searchname_array_sub, str);
for (i = 0; i < db_count; i++)
- data[count++] = DB->data2ptr(db_data[i]);
+ data[count++] = iDB->data2ptr(db_data[i]);
count += db_count;
}
return count;
@@ -590,7 +590,7 @@ static void itemdb_read_itemgroup(void)
{
char path[256];
unsigned int count;
- snprintf(path, 255, "%s/"DBPATH"item_group_db.txt", db_path);
+ snprintf(path, 255, "%s/"DBPATH"item_group_db.txt", iMap->db_path);
memset(&itemgroup_db, 0, sizeof(itemgroup_db));
count = itemdb_read_itemgroup_sub(path);
ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, "item_group_db.txt");
@@ -785,7 +785,7 @@ void itemdb_read_combos() {
char path[256];
FILE* fp;
- sprintf(path, "%s/%s", db_path, DBPATH"item_combo_db.txt");
+ sprintf(path, "%s/%s", iMap->db_path, DBPATH"item_combo_db.txt");
if ((fp = fopen(path, "r")) == NULL) {
ShowError("itemdb_read_combos: File not found \"%s\".\n", path);
@@ -1110,7 +1110,7 @@ static int itemdb_readdb(void)
char path[256];
FILE* fp;
- sprintf(path, "%s/%s", db_path, filename[fi]);
+ sprintf(path, "%s/%s", iMap->db_path, filename[fi]);
fp = fopen(path, "r");
if( fp == NULL ) {
ShowWarning("itemdb_readdb: File not found \"%s\", skipping.\n", path);
@@ -1226,11 +1226,11 @@ static int itemdb_read_sqldb(void) {
const char* item_db_name[] = {
#ifdef RENEWAL
- item_db_re_db,
+ iMap->item_db_re_db,
#else
- item_db_db,
+ iMap->item_db_db,
#endif
- item_db2_db };
+ iMap->item_db2_db };
int fi;
for( fi = 0; fi < ARRAYLENGTH(item_db_name); ++fi ) {
@@ -1318,19 +1318,19 @@ int itemdb_uid_load(){
*------------------------------------*/
static void itemdb_read(void) {
- if (db_use_sqldbs)
+ if (iMap->db_use_sqldbs)
itemdb_read_sqldb();
else
itemdb_readdb();
itemdb_read_combos();
itemdb_read_itemgroup();
- sv->readdb(db_path, "item_avail.txt", ',', 2, 2, -1, &itemdb_read_itemavail);
- sv->readdb(db_path, DBPATH"item_trade.txt", ',', 3, 3, -1, &itemdb_read_itemtrade);
- sv->readdb(db_path, "item_delay.txt", ',', 2, 2, -1, &itemdb_read_itemdelay);
- sv->readdb(db_path, "item_stack.txt", ',', 3, 3, -1, &itemdb_read_stack);
- sv->readdb(db_path, DBPATH"item_buyingstore.txt", ',', 1, 1, -1, &itemdb_read_buyingstore);
- sv->readdb(db_path, "item_nouse.txt", ',', 3, 3, -1, &itemdb_read_nouse);
+ sv->readdb(iMap->db_path, "item_avail.txt", ',', 2, 2, -1, &itemdb_read_itemavail);
+ sv->readdb(iMap->db_path, DBPATH"item_trade.txt", ',', 3, 3, -1, &itemdb_read_itemtrade);
+ sv->readdb(iMap->db_path, "item_delay.txt", ',', 2, 2, -1, &itemdb_read_itemdelay);
+ sv->readdb(iMap->db_path, "item_stack.txt", ',', 3, 3, -1, &itemdb_read_stack);
+ sv->readdb(iMap->db_path, DBPATH"item_buyingstore.txt", ',', 1, 1, -1, &itemdb_read_buyingstore);
+ sv->readdb(iMap->db_path, "item_nouse.txt", ',', 3, 3, -1, &itemdb_read_nouse);
itemdb_uid_load();
}
@@ -1376,7 +1376,7 @@ static void destroy_item_data(struct item_data* self, int free_self)
*/
static int itemdb_final_sub(DBKey key, DBData *data, va_list ap)
{
- struct item_data *id = DB->data2ptr(data);
+ struct item_data *id = iDB->data2ptr(data);
if( id != &dummy_item )
destroy_item_data(id, 1);
@@ -1435,7 +1435,7 @@ void itemdb_reload(void)
iter = mapit_geteachpc();
for( sd = (struct map_session_data*)mapit->first(iter); mapit->exists(iter); sd = (struct map_session_data*)mapit->next(iter) ) {
memset(sd->item_delay, 0, sizeof(sd->item_delay)); // reset item delays
- pc_setinventorydata(sd);
+ iPc->setinventorydata(sd);
/* clear combo bonuses */
if( sd->combos.count ) {
aFree(sd->combos.bonus);
@@ -1443,7 +1443,7 @@ void itemdb_reload(void)
sd->combos.bonus = NULL;
sd->combos.id = NULL;
sd->combos.count = 0;
- if( pc_load_combo(sd) > 0 )
+ if( iPc->load_combo(sd) > 0 )
status_calc_pc(sd,0);
}
diff --git a/src/map/log.c b/src/map/log.c
index f57b91a2a..8823a9a66 100644
--- a/src/map/log.c
+++ b/src/map/log.c
@@ -369,7 +369,7 @@ void log_chat(e_log_chat_type type, int type_id, int src_charid, int src_accid,
return;
}
- if( logs->config.log_chat_woe_disable && ( agit_flag || agit2_flag ) )
+ if( logs->config.log_chat_woe_disable && ( iMap->agit_flag || iMap->agit2_flag ) )
{// no chat logging during woe
return;
}
diff --git a/src/map/mail.c b/src/map/mail.c
index fa842b70f..ab3d78ed2 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -31,7 +31,7 @@ int mail_removeitem(struct map_session_data *sd, short flag)
if( sd->mail.amount )
{
if (flag) // Item send
- pc_delitem(sd, sd->mail.index, sd->mail.amount, 1, 0, LOG_TYPE_MAIL);
+ iPc->delitem(sd, sd->mail.index, sd->mail.amount, 1, 0, LOG_TYPE_MAIL);
else
clif->additem(sd, sd->mail.index, sd->mail.amount, 0);
}
@@ -48,7 +48,7 @@ int mail_removezeny(struct map_session_data *sd, short flag)
if (flag && sd->mail.zeny > 0)
{ //Zeny send
- pc_payzeny(sd,sd->mail.zeny,LOG_TYPE_MAIL, NULL);
+ iPc->payzeny(sd,sd->mail.zeny,LOG_TYPE_MAIL, NULL);
}
sd->mail.zeny = 0;
@@ -61,7 +61,7 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) {
return 1;
if( idx == 0 ) { // Zeny Transfer
- if( amount < 0 || !pc_can_give_items(sd) )
+ if( amount < 0 || !iPc->can_give_items(sd) )
return 1;
if( amount > sd->status.zeny )
@@ -78,8 +78,8 @@ unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) {
return 1;
if( amount < 0 || amount > sd->status.inventory[idx].amount )
return 1;
- if( !pc_can_give_items(sd) || sd->status.inventory[idx].expire_time ||
- !itemdb_canmail(&sd->status.inventory[idx],pc_get_group_level(sd)) )
+ if( !iPc->can_give_items(sd) || sd->status.inventory[idx].expire_time ||
+ !itemdb_canmail(&sd->status.inventory[idx],iPc->get_group_level(sd)) )
return 1;
sd->mail.index = idx;
@@ -131,13 +131,13 @@ void mail_getattachment(struct map_session_data* sd, int zeny, struct item* item
{
if( item->nameid > 0 && item->amount > 0 )
{
- pc_additem(sd, item, item->amount, LOG_TYPE_MAIL);
+ iPc->additem(sd, item, item->amount, LOG_TYPE_MAIL);
clif->mail_getattachment(sd->fd, 0);
}
if( zeny > 0 )
{ //Zeny receive
- pc_getzeny(sd, zeny,LOG_TYPE_MAIL, NULL);
+ iPc->getzeny(sd, zeny,LOG_TYPE_MAIL, NULL);
}
}
@@ -161,12 +161,12 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
if( msg->item.amount > 0 )
{
// Item receive (due to failure)
- pc_additem(sd, &msg->item, msg->item.amount, LOG_TYPE_MAIL);
+ iPc->additem(sd, &msg->item, msg->item.amount, LOG_TYPE_MAIL);
}
if( msg->zeny > 0 )
{
- pc_getzeny(sd,msg->zeny,LOG_TYPE_MAIL, NULL); //Zeny receive (due to failure)
+ iPc->getzeny(sd,msg->zeny,LOG_TYPE_MAIL, NULL); //Zeny receive (due to failure)
}
clif->mail_send(sd->fd, true);
@@ -175,7 +175,7 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
// This function only check if the mail operations are valid
bool mail_invalid_operation(struct map_session_data *sd)
{
- if( !map[sd->bl.m].flag.town && !pc_can_use_command(sd, "@mail") )
+ if( !map[sd->bl.m].flag.town && !iPc->can_use_command(sd, "@mail") )
{
ShowWarning("clif->parse_Mail: char '%s' trying to do invalid mail operations.\n", sd->status.name);
return true;
diff --git a/src/map/map.c b/src/map/map.c
index 6f61375fe..496802d28 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -70,14 +70,7 @@ char map_server_pw[32] = "ragnarok";
char map_server_db[32] = "ragnarok";
Sql* mmysql_handle;
-int db_use_sqldbs = 0;
-char item_db_db[32] = "item_db";
-char item_db2_db[32] = "item_db2";
-char item_db_re_db[32] = "item_db_re";
-char mob_db_db[32] = "mob_db";
-char mob_db2_db[32] = "mob_db2";
-char mob_skill_db_db[32] = "mob_skill_db";
-char mob_skill_db2_db[32] = "mob_skill_db2";
+int map_port=0;
// log database
char log_db_ip[32] = "127.0.0.1";
@@ -87,21 +80,12 @@ char log_db_pw[32] = "ragnarok";
char log_db_db[32] = "log";
Sql* logmysql_handle;
-char *INTER_CONF_NAME;
-char *LOG_CONF_NAME;
-char *MAP_CONF_NAME;
-char *BATTLE_CONF_FILENAME;
-char *ATCOMMAND_CONF_FILENAME;
-char *SCRIPT_CONF_NAME;
-char *MSG_CONF_NAME;
-char *GRF_PATH_FILENAME;
-
// DBMap declaartion
static DBMap* id_db=NULL; // int id -> struct block_list*
static DBMap* pc_db=NULL; // int id -> struct map_session_data*
static DBMap* mobid_db=NULL; // int id -> struct mob_data*
static DBMap* bossid_db=NULL; // int id -> struct mob_data* (MVP db)
-static DBMap* map_db=NULL; // unsigned int mapindex -> struct map_data*
+static DBMap* map_db=NULL; // unsigned int mapindex -> struct map_data_other_server*
static DBMap* nick_db=NULL; // int char_id -> struct charid2nick* (requested names of offline characters)
static DBMap* charid_db=NULL; // int char_id -> struct map_session_data*
static DBMap* regen_db=NULL; // int id -> struct block_list* (status_natural_heal processing)
@@ -117,16 +101,6 @@ static int block_free_count = 0, block_free_lock = 0;
static struct block_list *bl_list[BL_LIST_MAX];
static int bl_list_count = 0;
-int map_num = 0;
-int map_port=0;
-
-int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
-int minsave_interval = 100;
-int save_settings = 0xFFFF;
-int agit_flag = 0;
-int agit2_flag = 0;
-int night_flag = 0; // 0=day, 1=night [Yor]
-
struct charid_request {
struct charid_request* next;
int charid;// who want to be notified of the nick
@@ -150,23 +124,17 @@ struct map_cache_map_info {
int32 len;
};
-char db_path[256] = "db";
-char motd_txt[256] = "conf/motd.txt";
-char help_txt[256] = "conf/help.txt";
-char help2_txt[256] = "conf/help2.txt";
-char charhelp_txt[256] = "conf/charhelp.txt";
-
-char wisp_server_name[NAME_LENGTH] = "Server"; // can be modified in char-server configuration file
+int16 index2mapid[MAX_MAPINDEX];
-int enable_spy = 0; //To enable/disable @spy commands, which consume too much cpu time when sending packets. [Skotlex]
int enable_grf = 0; //To enable/disable reading maps from GRF files, bypassing mapcache [blackhole89]
/* [Ind/Hercules] */
struct eri *map_iterator_ers;
+char *map_cache_buffer = NULL; // Has the uncompressed gat data of all maps, so just one allocation has to be made
/*==========================================
- * server player count (of all mapservers)
- *------------------------------------------*/
+* server player count (of all mapservers)
+*------------------------------------------*/
void map_setusers(int users)
{
map_users = users;
@@ -178,8 +146,8 @@ int map_getusers(void)
}
/*==========================================
- * server player count (this mapserver only)
- *------------------------------------------*/
+* server player count (this mapserver only)
+*------------------------------------------*/
int map_usercount(void)
{
return pc_db->size(pc_db);
@@ -187,8 +155,8 @@ int map_usercount(void)
/*==========================================
- * Attempt to free a map blocklist
- *------------------------------------------*/
+* Attempt to free a map blocklist
+*------------------------------------------*/
int map_freeblock (struct block_list *bl)
{
nullpo_retr(block_free_lock, bl);
@@ -204,16 +172,16 @@ int map_freeblock (struct block_list *bl)
return block_free_lock;
}
/*==========================================
- * Lock blocklist, (prevent map_freeblock usage)
- *------------------------------------------*/
+* Lock blocklist, (prevent iMap->freeblock usage)
+*------------------------------------------*/
int map_freeblock_lock (void)
{
return ++block_free_lock;
}
/*==========================================
- * Remove the lock on map_bl
- *------------------------------------------*/
+* Remove the lock on map_bl
+*------------------------------------------*/
int map_freeblock_unlock (void)
{
if ((--block_free_lock) == 0) {
@@ -239,7 +207,7 @@ int map_freeblock_timer(int tid, unsigned int tick, int id, intptr_t data)
if (block_free_lock > 0) {
ShowError("map_freeblock_timer: block_free_lock(%d) is invalid.\n", block_free_lock);
block_free_lock = 1;
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
}
return 0;
@@ -249,16 +217,16 @@ int map_freeblock_timer(int tid, unsigned int tick, int id, intptr_t data)
// blocklist
//
/*==========================================
- * Handling of map_bl[]
- * The adresse of bl_heal is set in bl->prev
- *------------------------------------------*/
+* Handling of map_bl[]
+* The adresse of bl_heal is set in bl->prev
+*------------------------------------------*/
static struct block_list bl_head;
#ifdef CELL_NOSTACK
/*==========================================
- * These pair of functions update the counter of how many objects
- * lie on a tile.
- *------------------------------------------*/
+* These pair of functions update the counter of how many objects
+* lie on a tile.
+*------------------------------------------*/
static void map_addblcell(struct block_list *bl)
{
if( bl->m<0 || bl->x<0 || bl->x>=map[bl->m].xs || bl->y<0 || bl->y>=map[bl->m].ys || !(bl->type&BL_CHAR) )
@@ -276,9 +244,9 @@ static void map_delblcell(struct block_list *bl)
#endif
/*==========================================
- * Adds a block to the map.
- * Returns 0 on success, 1 on failure (illegal coordinates).
- *------------------------------------------*/
+* Adds a block to the map.
+* Returns 0 on success, 1 on failure (illegal coordinates).
+*------------------------------------------*/
int map_addblock(struct block_list* bl)
{
int16 m, x, y;
@@ -294,9 +262,9 @@ int map_addblock(struct block_list* bl)
m = bl->m;
x = bl->x;
y = bl->y;
- if( m < 0 || m >= map_num )
+ if( m < 0 || m >= iMap->map_num )
{
- ShowError("map_addblock: invalid map id (%d), only %d are loaded.\n", m, map_num);
+ ShowError("map_addblock: invalid map id (%d), only %d are loaded.\n", m, iMap->map_num);
return 1;
}
if( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys )
@@ -327,14 +295,14 @@ int map_addblock(struct block_list* bl)
}
/*==========================================
- * Removes a block from the map.
- *------------------------------------------*/
+* Removes a block from the map.
+*------------------------------------------*/
int map_delblock(struct block_list* bl)
{
int pos;
nullpo_ret(bl);
- // blocklist (2ways chainlist)
+ // blocklist (2ways chainlist)
if (bl->prev == NULL) {
if (bl->next != NULL) {
// can't delete block (already at the begining of the chain)
@@ -352,7 +320,7 @@ int map_delblock(struct block_list* bl)
if (bl->next)
bl->next->prev = bl->prev;
if (bl->prev == &bl_head) {
- //Since the head of the list, update the block_list map of []
+ //Since the head of the list, update the block_list map of []
if (bl->type == BL_MOB) {
map[bl->m].block_mob[pos] = bl->next;
} else {
@@ -368,10 +336,10 @@ int map_delblock(struct block_list* bl)
}
/*==========================================
- * Moves a block a x/y target position. [Skotlex]
- * Pass flag as 1 to prevent doing skill->unit_move checks
- * (which are executed by default on BL_CHAR types)
- *------------------------------------------*/
+* Moves a block a x/y target position. [Skotlex]
+* Pass flag as 1 to prevent doing skill->unit_move checks
+* (which are executed by default on BL_CHAR types)
+*------------------------------------------*/
int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
{
int x0 = bl->x, y0 = bl->y;
@@ -392,23 +360,22 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
skill->unit_move(bl,tick,2);
status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER);
status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER);
-// status_change_end(bl, SC_BLADESTOP, INVALID_TIMER); //Won't stop when you are knocked away, go figure...
+ // status_change_end(bl, SC_BLADESTOP, INVALID_TIMER); //Won't stop when you are knocked away, go figure...
status_change_end(bl, SC_TATAMIGAESHI, INVALID_TIMER);
status_change_end(bl, SC_MAGICROD, INVALID_TIMER);
if (sc->data[SC_PROPERTYWALK] &&
sc->data[SC_PROPERTYWALK]->val3 >= skill->get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) )
status_change_end(bl,SC_PROPERTYWALK,INVALID_TIMER);
- } else
- if (bl->type == BL_NPC)
+ } else if (bl->type == BL_NPC)
npc_unsetcells((TBL_NPC*)bl);
- if (moveblock) map_delblock(bl);
+ if (moveblock) iMap->delblock(bl);
#ifdef CELL_NOSTACK
else map_delblcell(bl);
#endif
bl->x = x1;
bl->y = y1;
- if (moveblock) map_addblock(bl);
+ if (moveblock) iMap->addblock(bl);
#ifdef CELL_NOSTACK
else map_addblcell(bl);
#endif
@@ -419,7 +386,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
if( bl->type == BL_PC && ((TBL_PC*)bl)->shadowform_id ) {//Shadow Form Target Moving
struct block_list *d_bl;
- if( (d_bl = map_id2bl(((TBL_PC*)bl)->shadowform_id)) == NULL || !check_distance_bl(bl,d_bl,10) ) {
+ if( (d_bl = iMap->id2bl(((TBL_PC*)bl)->shadowform_id)) == NULL || !check_distance_bl(bl,d_bl,10) ) {
if( d_bl )
status_change_end(d_bl,SC__SHADOWFORM,INVALID_TIMER);
((TBL_PC*)bl)->shadowform_id = 0;
@@ -444,14 +411,14 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
if( sc->data[SC__SHADOWFORM] ) {//Shadow Form Caster Moving
struct block_list *d_bl;
- if( (d_bl = map_id2bl(sc->data[SC__SHADOWFORM]->val2)) == NULL || !check_distance_bl(bl,d_bl,10) )
+ if( (d_bl = iMap->id2bl(sc->data[SC__SHADOWFORM]->val2)) == NULL || !check_distance_bl(bl,d_bl,10) )
status_change_end(bl,SC__SHADOWFORM,INVALID_TIMER);
}
if (sc->data[SC_PROPERTYWALK]
- && sc->data[SC_PROPERTYWALK]->val3 < skill->get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2)
- && map_find_skill_unit_oncell(bl,bl->x,bl->y,SO_ELECTRICWALK,NULL,0) == NULL
- && map_find_skill_unit_oncell(bl,bl->x,bl->y,SO_FIREWALK,NULL,0) == NULL
+ && sc->data[SC_PROPERTYWALK]->val3 < skill->get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2)
+ && iMap->find_skill_unit_oncell(bl,bl->x,bl->y,SO_ELECTRICWALK,NULL,0) == NULL
+ && iMap->find_skill_unit_oncell(bl,bl->x,bl->y,SO_FIREWALK,NULL,0) == NULL
&& skill->unitsetting(bl,sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2,x0, y0,0)) {
sc->data[SC_PROPERTYWALK]->val3++;
}
@@ -470,16 +437,15 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
skill->unit_move_unit_group(skill->id2group(sc->data[SC_HAWKEYES]->val4), bl->m, x1-x0, y1-y0);
}
}
- } else
- if (bl->type == BL_NPC)
+ } else if (bl->type == BL_NPC)
npc_setcells((TBL_NPC*)bl);
return 0;
}
/*==========================================
- * Counts specified number of objects on given cell.
- *------------------------------------------*/
+* Counts specified number of objects on given cell.
+*------------------------------------------*/
int map_count_oncell(int16 m, int16 x, int16 y, int type)
{
int bx,by;
@@ -505,9 +471,9 @@ int map_count_oncell(int16 m, int16 x, int16 y, int type)
return count;
}
/*
- * Looks for a skill unit on a given cell
- * flag&1: runs battle_check_target check based on unit->group->target_flag
- */
+* Looks for a skill unit on a given cell
+* flag&1: runs battle_check_target check based on unit->group->target_flag
+*/
struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int16 x,int16 y,uint16 skill_id,struct skill_unit* out_unit, int flag) {
int16 m,bx,by;
struct block_list *bl;
@@ -535,8 +501,8 @@ struct skill_unit* map_find_skill_unit_oncell(struct block_list* target,int16 x,
}
/*==========================================
- * Adapted from foreachinarea for an easier invocation. [Skotlex]
- *------------------------------------------*/
+* Adapted from foreachinarea for an easier invocation. [Skotlex]
+*------------------------------------------*/
int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...)
{
int bx, by, m;
@@ -561,47 +527,47 @@ int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_lis
#ifdef CIRCULAR_AREA
&& check_distance_bl(center, bl, range)
#endif
- && bl_list_count < BL_LIST_MAX )
+ && bl_list_count < BL_LIST_MAX )
bl_list[ bl_list_count++ ] = bl;
}
}
}
- if( type&BL_MOB )
- for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) {
- for(bx=x0/BLOCK_SIZE;bx<=x1/BLOCK_SIZE;bx++) {
- for( bl = map[ m ].block_mob[ bx + by * map[ m ].bxs ]; bl != NULL; bl = bl->next ) {
- if( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1
+ if( type&BL_MOB )
+ for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) {
+ for(bx=x0/BLOCK_SIZE;bx<=x1/BLOCK_SIZE;bx++) {
+ for( bl = map[ m ].block_mob[ bx + by * map[ m ].bxs ]; bl != NULL; bl = bl->next ) {
+ if( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1
#ifdef CIRCULAR_AREA
- && check_distance_bl(center, bl, range)
+ && check_distance_bl(center, bl, range)
#endif
- && bl_list_count < BL_LIST_MAX )
- bl_list[ bl_list_count++ ] = bl;
+ && bl_list_count < BL_LIST_MAX )
+ bl_list[ bl_list_count++ ] = bl;
+ }
}
}
- }
- if( bl_list_count >= BL_LIST_MAX )
- ShowWarning("map_foreachinrange: block count too many!\n");
+ if( bl_list_count >= BL_LIST_MAX )
+ ShowWarning("iMap->foreachinrange: block count too many!\n");
- map_freeblock_lock();
+ iMap->freeblock_lock();
- for( i = blockcount; i < bl_list_count; i++ )
- if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
- va_start(ap, type);
- returnCount += func(bl_list[ i ], ap);
- va_end(ap);
- }
+ for( i = blockcount; i < bl_list_count; i++ )
+ if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
+ va_start(ap, type);
+ returnCount += func(bl_list[ i ], ap);
+ va_end(ap);
+ }
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
- bl_list_count = blockcount;
- return returnCount; //[Skotlex]
+ bl_list_count = blockcount;
+ return returnCount; //[Skotlex]
}
/*==========================================
- * Same as foreachinrange, but there must be a shoot-able range between center and target to be counted in. [Skotlex]
- *------------------------------------------*/
+* Same as foreachinrange, but there must be a shoot-able range between center and target to be counted in. [Skotlex]
+*------------------------------------------*/
int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block_list* center, int16 range, int type,...)
{
int bx, by, m;
@@ -630,49 +596,49 @@ int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block
&& check_distance_bl(center, bl, range)
#endif
&& path_search_long(NULL, center->m, center->x, center->y, bl->x, bl->y, CELL_CHKWALL)
- && bl_list_count < BL_LIST_MAX )
+ && bl_list_count < BL_LIST_MAX )
bl_list[ bl_list_count++ ] = bl;
}
}
}
- if( type&BL_MOB )
- for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) {
- for( bx=x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ) {
- for( bl = map[ m ].block_mob[ bx + by * map[ m ].bxs ]; bl != NULL; bl = bl->next ) {
- if( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1
+ if( type&BL_MOB )
+ for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) {
+ for( bx=x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ) {
+ for( bl = map[ m ].block_mob[ bx + by * map[ m ].bxs ]; bl != NULL; bl = bl->next ) {
+ if( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1
#ifdef CIRCULAR_AREA
- && check_distance_bl(center, bl, range)
+ && check_distance_bl(center, bl, range)
#endif
- && path_search_long(NULL, center->m, center->x, center->y, bl->x, bl->y, CELL_CHKWALL)
- && bl_list_count < BL_LIST_MAX )
- bl_list[ bl_list_count++ ] = bl;
+ && path_search_long(NULL, center->m, center->x, center->y, bl->x, bl->y, CELL_CHKWALL)
+ && bl_list_count < BL_LIST_MAX )
+ bl_list[ bl_list_count++ ] = bl;
+ }
}
}
- }
- if( bl_list_count >= BL_LIST_MAX )
- ShowWarning("map_foreachinrange: block count too many!\n");
+ if( bl_list_count >= BL_LIST_MAX )
+ ShowWarning("iMap->foreachinrange: block count too many!\n");
- map_freeblock_lock();
+ iMap->freeblock_lock();
- for( i = blockcount; i < bl_list_count; i++ )
- if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
- va_start(ap, type);
- returnCount += func(bl_list[ i ], ap);
- va_end(ap);
- }
+ for( i = blockcount; i < bl_list_count; i++ )
+ if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
+ va_start(ap, type);
+ returnCount += func(bl_list[ i ], ap);
+ va_end(ap);
+ }
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
- bl_list_count = blockcount;
- return returnCount; //[Skotlex]
+ bl_list_count = blockcount;
+ return returnCount; //[Skotlex]
}
/*==========================================
- * range = map m (x0,y0)-(x1,y1)
- * Apply *func with ... arguments for the range.
- * @type = BL_PC/BL_MOB etc..
- *------------------------------------------*/
+* range = map m (x0,y0)-(x1,y1)
+* Apply *func with ... arguments for the range.
+* @type = BL_PC/BL_MOB etc..
+*------------------------------------------*/
int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, ...)
{
int bx, by;
@@ -710,7 +676,7 @@ int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0
if( bl_list_count >= BL_LIST_MAX )
ShowWarning("map_foreachinarea: block count too many!\n");
- map_freeblock_lock();
+ iMap->freeblock_lock();
for( i = blockcount; i < bl_list_count; i++ )
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
@@ -719,14 +685,14 @@ int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0
va_end(ap);
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
- bl_list_count = blockcount;
- return returnCount; //[Skotlex]
+ bl_list_count = blockcount;
+ return returnCount; //[Skotlex]
}
/*==========================================
- * Adapted from forcountinarea for an easier invocation. [pakpil]
- *------------------------------------------*/
+* Adapted from forcountinarea for an easier invocation. [pakpil]
+*------------------------------------------*/
int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int count, int type, ...)
{
int bx, by, m;
@@ -751,43 +717,43 @@ int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_li
#ifdef CIRCULAR_AREA
&& check_distance_bl(center, bl, range)
#endif
- && bl_list_count < BL_LIST_MAX )
+ && bl_list_count < BL_LIST_MAX )
bl_list[ bl_list_count++ ] = bl;
}
}
}
- if( type&BL_MOB )
- for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) {
- for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ){
- for( bl = map[ m ].block_mob[ bx + by * map[ m ].bxs ]; bl != NULL; bl = bl->next ) {
- if( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1
+ if( type&BL_MOB )
+ for( by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++ ) {
+ for( bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++ ){
+ for( bl = map[ m ].block_mob[ bx + by * map[ m ].bxs ]; bl != NULL; bl = bl->next ) {
+ if( bl->x >= x0 && bl->x <= x1 && bl->y >= y0 && bl->y <= y1
#ifdef CIRCULAR_AREA
- && check_distance_bl(center, bl, range)
+ && check_distance_bl(center, bl, range)
#endif
- && bl_list_count < BL_LIST_MAX )
- bl_list[ bl_list_count++ ] = bl;
+ && bl_list_count < BL_LIST_MAX )
+ bl_list[ bl_list_count++ ] = bl;
+ }
}
}
- }
- if( bl_list_count >= BL_LIST_MAX )
- ShowWarning("map_forcountinrange: block count too many!\n");
+ if( bl_list_count >= BL_LIST_MAX )
+ ShowWarning("map_forcountinrange: block count too many!\n");
- map_freeblock_lock();
+ iMap->freeblock_lock();
- for( i = blockcount; i < bl_list_count; i++ )
- if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
- va_start(ap, type);
- returnCount += func(bl_list[ i ], ap);
- va_end(ap);
- if( count && returnCount >= count )
- break;
- }
+ for( i = blockcount; i < bl_list_count; i++ )
+ if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
+ va_start(ap, type);
+ returnCount += func(bl_list[ i ], ap);
+ va_end(ap);
+ if( count && returnCount >= count )
+ break;
+ }
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
- bl_list_count = blockcount;
- return returnCount; //[Skotlex]
+ bl_list_count = blockcount;
+ return returnCount; //[Skotlex]
}
int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, ...)
{
@@ -827,7 +793,7 @@ int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x
if( bl_list_count >= BL_LIST_MAX )
ShowWarning("map_foreachinarea: block count too many!\n");
- map_freeblock_lock();
+ iMap->freeblock_lock();
for( i = blockcount; i < bl_list_count; i++ )
if(bl_list[ i ]->prev) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
@@ -838,17 +804,17 @@ int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x
break;
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
- bl_list_count = blockcount;
- return returnCount; //[Skotlex]
+ bl_list_count = blockcount;
+ return returnCount; //[Skotlex]
}
/*==========================================
- * For what I get
- * Move bl and do func* with va_list while moving.
- * Mouvement is set by dx dy wich are distance in x and y
- *------------------------------------------*/
+* For what I get
+* Move bl and do func* with va_list while moving.
+* Mouvement is set by dx dy wich are distance in x and y
+*------------------------------------------*/
int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, ...)
{
int bx, by, m;
@@ -928,11 +894,11 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_
bl->x >= x0 && bl->x <= x1 &&
bl->y >= y0 && bl->y <= y1 &&
bl_list_count < BL_LIST_MAX )
- if( ( dx > 0 && bl->x < x0 + dx) ||
- ( dx < 0 && bl->x > x1 + dx) ||
- ( dy > 0 && bl->y < y0 + dy) ||
- ( dy < 0 && bl->y > y1 + dy) )
- bl_list[ bl_list_count++ ] = bl;
+ if( ( dx > 0 && bl->x < x0 + dx) ||
+ ( dx < 0 && bl->x > x1 + dx) ||
+ ( dy > 0 && bl->y < y0 + dy) ||
+ ( dy < 0 && bl->y > y1 + dy) )
+ bl_list[ bl_list_count++ ] = bl;
}
}
if ( type&BL_MOB ) {
@@ -940,11 +906,11 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_
if( bl->x >= x0 && bl->x <= x1 &&
bl->y >= y0 && bl->y <= y1 &&
bl_list_count < BL_LIST_MAX)
- if( ( dx > 0 && bl->x < x0 + dx) ||
- ( dx < 0 && bl->x > x1 + dx) ||
- ( dy > 0 && bl->y < y0 + dy) ||
- ( dy < 0 && bl->y > y1 + dy) )
- bl_list[ bl_list_count++ ] = bl;
+ if( ( dx > 0 && bl->x < x0 + dx) ||
+ ( dx < 0 && bl->x > x1 + dx) ||
+ ( dy > 0 && bl->y < y0 + dy) ||
+ ( dy < 0 && bl->y > y1 + dy) )
+ bl_list[ bl_list_count++ ] = bl;
}
}
}
@@ -955,7 +921,7 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_
if( bl_list_count >= BL_LIST_MAX )
ShowWarning("map_foreachinmovearea: block count too many!\n");
- map_freeblock_lock(); // Prohibit the release from memory
+ iMap->freeblock_lock(); // Prohibit the release from memory
for( i = blockcount; i < bl_list_count; i++ )
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
@@ -964,10 +930,10 @@ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_
va_end(ap);
}
- map_freeblock_unlock(); // Allow Free
+ iMap->freeblock_unlock(); // Allow Free
- bl_list_count = blockcount;
- return returnCount;
+ bl_list_count = blockcount;
+ return returnCount;
}
// -- moonsoul (added map_foreachincell which is a rework of map_foreachinarea but
@@ -999,7 +965,7 @@ int map_foreachincell(int (*func)(struct block_list*,va_list), int16 m, int16 x,
if( bl_list_count >= BL_LIST_MAX )
ShowWarning("map_foreachincell: block count too many!\n");
- map_freeblock_lock();
+ iMap->freeblock_lock();
for( i = blockcount; i < bl_list_count; i++ )
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
@@ -1008,10 +974,10 @@ int map_foreachincell(int (*func)(struct block_list*,va_list), int16 m, int16 x,
va_end(ap);
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
- bl_list_count = blockcount;
- return returnCount;
+ bl_list_count = blockcount;
+ return returnCount;
}
/*============================================================
@@ -1020,38 +986,38 @@ int map_foreachincell(int (*func)(struct block_list*,va_list), int16 m, int16 x,
int map_foreachinpath(int (*func)(struct block_list*,va_list),int16 m,int16 x0,int16 y0,int16 x1,int16 y1,int16 range,int length, int type,...)
{
int returnCount = 0; //total sum of returned values of func() [Skotlex]
-//////////////////////////////////////////////////////////////
-//
-// sharp shooting 3 [Skotlex]
-//
-//////////////////////////////////////////////////////////////
-// problem:
-// Same as Sharp Shooting 1. Hits all targets within range of
-// the line.
-// (t1,t2 t3 and t4 get hit)
-//
-// target 1
-// x t4
-// t2
-// t3 x
-// x
-// S
-//////////////////////////////////////////////////////////////
-// Methodology:
-// My trigonometrics and math are a little rusty... so the approach I am writing
-// here is basicly do a double for to check for all targets in the square that
-// contains the initial and final positions (area range increased to match the
-// radius given), then for each object to test, calculate the distance to the
-// path and include it if the range fits and the target is in the line (0<k<1,
-// as they call it).
-// The implementation I took as reference is found at
-// http://astronomy.swin.edu.au/~pbourke/geometry/pointline/
-// (they have a link to a C implementation, too)
-// This approach is a lot like #2 commented on this function, which I have no
-// idea why it was commented. I won't use doubles/floats, but pure int math for
-// speed purposes. The range considered is always the same no matter how
-// close/far the target is because that's how SharpShooting works currently in
-// kRO.
+ //////////////////////////////////////////////////////////////
+ //
+ // sharp shooting 3 [Skotlex]
+ //
+ //////////////////////////////////////////////////////////////
+ // problem:
+ // Same as Sharp Shooting 1. Hits all targets within range of
+ // the line.
+ // (t1,t2 t3 and t4 get hit)
+ //
+ // target 1
+ // x t4
+ // t2
+ // t3 x
+ // x
+ // S
+ //////////////////////////////////////////////////////////////
+ // Methodology:
+ // My trigonometrics and math are a little rusty... so the approach I am writing
+ // here is basicly do a double for to check for all targets in the square that
+ // contains the initial and final positions (area range increased to match the
+ // radius given), then for each object to test, calculate the distance to the
+ // path and include it if the range fits and the target is in the line (0<k<1,
+ // as they call it).
+ // The implementation I took as reference is found at
+ // http://astronomy.swin.edu.au/~pbourke/geometry/pointline/
+ // (they have a link to a C implementation, too)
+ // This approach is a lot like #2 commented on this function, which I have no
+ // idea why it was commented. I won't use doubles/floats, but pure int math for
+ // speed purposes. The range considered is always the same no matter how
+ // close/far the target is because that's how SharpShooting works currently in
+ // kRO.
//Generic map_foreach* variables.
int i, blockcount = bl_list_count;
@@ -1064,7 +1030,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int16 m,int16 x0,i
va_list ap;
//Avoid needless calculations by not getting the sqrt right away.
- #define MAGNITUDE2(x0, y0, x1, y1) ( ( ( x1 ) - ( x0 ) ) * ( ( x1 ) - ( x0 ) ) + ( ( y1 ) - ( y0 ) ) * ( ( y1 ) - ( y0 ) ) )
+#define MAGNITUDE2(x0, y0, x1, y1) ( ( ( x1 ) - ( x0 ) ) * ( ( x1 ) - ( x0 ) ) + ( ( y1 ) - ( y0 ) ) * ( ( y1 ) - ( y0 ) ) )
if ( m < 0 )
return 0;
@@ -1143,60 +1109,59 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int16 m,int16 x0,i
}
}
}
- if( type&BL_MOB )
- for( by = my0 / BLOCK_SIZE; by <= my1 / BLOCK_SIZE; by++ ) {
- for( bx = mx0 / BLOCK_SIZE; bx <= mx1 / BLOCK_SIZE; bx++ ) {
- for( bl = map[ m ].block_mob[ bx + by * map[ m ].bxs ]; bl != NULL; bl = bl->next ) {
- if( bl->prev && bl_list_count < BL_LIST_MAX ) {
- xi = bl->x;
- yi = bl->y;
- k = ( xi - x0 ) * ( x1 - x0 ) + ( yi - y0 ) * ( y1 - y0 );
+ if( type&BL_MOB )
+ for( by = my0 / BLOCK_SIZE; by <= my1 / BLOCK_SIZE; by++ ) {
+ for( bx = mx0 / BLOCK_SIZE; bx <= mx1 / BLOCK_SIZE; bx++ ) {
+ for( bl = map[ m ].block_mob[ bx + by * map[ m ].bxs ]; bl != NULL; bl = bl->next ) {
+ if( bl->prev && bl_list_count < BL_LIST_MAX ) {
+ xi = bl->x;
+ yi = bl->y;
+ k = ( xi - x0 ) * ( x1 - x0 ) + ( yi - y0 ) * ( y1 - y0 );
- if ( k < 0 || k > len_limit )
- continue;
+ if ( k < 0 || k > len_limit )
+ continue;
- if ( k > magnitude2 && !path_search_long(NULL, m, x0, y0, xi, yi, CELL_CHKWALL) )
- continue; //Targets beyond the initial ending point need the wall check.
+ if ( k > magnitude2 && !path_search_long(NULL, m, x0, y0, xi, yi, CELL_CHKWALL) )
+ continue; //Targets beyond the initial ending point need the wall check.
- k = ( k << 4 ) / magnitude2; //k will be between 1~16 instead of 0~1
- xi <<= 4;
- yi <<= 4;
- xu = ( x0 << 4 ) + k * ( x1 - x0 );
- yu = ( y0 << 4 ) + k * ( y1 - y0 );
- k = MAGNITUDE2(xi, yi, xu, yu);
+ k = ( k << 4 ) / magnitude2; //k will be between 1~16 instead of 0~1
+ xi <<= 4;
+ yi <<= 4;
+ xu = ( x0 << 4 ) + k * ( x1 - x0 );
+ yu = ( y0 << 4 ) + k * ( y1 - y0 );
+ k = MAGNITUDE2(xi, yi, xu, yu);
- //If all dot coordinates were <<4 the square of the magnitude is <<8
- if ( k > range )
- continue;
+ //If all dot coordinates were <<4 the square of the magnitude is <<8
+ if ( k > range )
+ continue;
- bl_list[ bl_list_count++ ] = bl;
+ bl_list[ bl_list_count++ ] = bl;
+ }
}
}
}
- }
- if( bl_list_count >= BL_LIST_MAX )
- ShowWarning("map_foreachinpath: block count too many!\n");
+ if( bl_list_count >= BL_LIST_MAX )
+ ShowWarning("map_foreachinpath: block count too many!\n");
- map_freeblock_lock();
+ iMap->freeblock_lock();
- for( i = blockcount; i < bl_list_count; i++ )
- if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
- va_start(ap, type);
- returnCount += func(bl_list[ i ], ap);
- va_end(ap);
- }
+ for( i = blockcount; i < bl_list_count; i++ )
+ if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
+ va_start(ap, type);
+ returnCount += func(bl_list[ i ], ap);
+ va_end(ap);
+ }
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
- bl_list_count = blockcount;
- return returnCount; //[Skotlex]
+ bl_list_count = blockcount;
+ return returnCount; //[Skotlex]
}
// Copy of map_foreachincell, but applied to the whole map. [Skotlex]
-int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type,...)
-{
+int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type,...) {
int b, bsize;
int returnCount = 0; //total sum of returned values of func() [Skotlex]
struct block_list *bl;
@@ -1220,7 +1185,7 @@ int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type,
if( bl_list_count >= BL_LIST_MAX )
ShowWarning("map_foreachinmap: block count too many!\n");
- map_freeblock_lock();
+ iMap->freeblock_lock();
for( i = blockcount; i < bl_list_count ; i++ )
if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
@@ -1229,7 +1194,53 @@ int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type,
va_end(ap);
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
+
+ bl_list_count = blockcount;
+ return returnCount;
+}
+// Copy of map_foreachinmap, but applied to all maps in a instance id. [Ind/Hercules]
+int map_foreachininstance(int (*func)(struct block_list*,va_list), int16 instance_id, int type,...) {
+ int b, bsize;
+ int returnCount = 0; //total sum of returned values of func() [Skotlex]
+ struct block_list *bl;
+ int blockcount = bl_list_count, i, j;
+ int16 m;
+ va_list ap;
+
+ for( j = 0; j < instances[instance_id].num_map; j++ ) {
+
+ m = instances[instance_id].map[j];
+
+ bsize = map[ m ].bxs * map[ m ].bys;
+
+ if( type&~BL_MOB )
+ for( b = 0; b < bsize; b++ )
+ for( bl = map[ m ].block[ b ]; bl != NULL; bl = bl->next )
+ if( bl->type&type && bl_list_count < BL_LIST_MAX )
+ bl_list[ bl_list_count++ ] = bl;
+
+ if( type&BL_MOB )
+ for( b = 0; b < bsize; b++ )
+ for( bl = map[ m ].block_mob[ b ]; bl != NULL; bl = bl->next )
+ if( bl_list_count < BL_LIST_MAX )
+ bl_list[ bl_list_count++ ] = bl;
+
+ if( bl_list_count >= BL_LIST_MAX )
+ ShowWarning("map_foreachininstance: block count too many!\n");
+
+ iMap->freeblock_lock();
+
+ for( i = blockcount; i < bl_list_count ; i++ )
+ if( bl_list[ i ]->prev ) { //func() may delete this bl_list[] slot, checking for prev ensures it wasnt queued for deletion.
+ va_start(ap, type);
+ returnCount += func(bl_list[ i ], ap);
+ va_end(ap);
+ }
+
+ iMap->freeblock_unlock();
+
+ }
bl_list_count = blockcount;
return returnCount;
@@ -1268,9 +1279,9 @@ int map_get_new_object_id(void)
}
/*==========================================
- * Timered function to clear the floor (remove remaining item)
- * Called each flooritem_lifetime ms
- *------------------------------------------*/
+* Timered function to clear the floor (remove remaining item)
+* Called each flooritem_lifetime ms
+*------------------------------------------*/
int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data)
{
struct flooritem_data* fitem = (struct flooritem_data*)idb_get(id_db, id);
@@ -1285,32 +1296,32 @@ int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data)
intif_delete_petdata(MakeDWord(fitem->item_data.card[1], fitem->item_data.card[2]));
clif->clearflooritem(fitem, 0);
- map_deliddb(&fitem->bl);
- map_delblock(&fitem->bl);
- map_freeblock(&fitem->bl);
+ iMap->deliddb(&fitem->bl);
+ iMap->delblock(&fitem->bl);
+ iMap->freeblock(&fitem->bl);
return 0;
}
/*
- * clears a single bl item out of the bazooonga.
- */
+* clears a single bl item out of the bazooonga.
+*/
void map_clearflooritem(struct block_list *bl) {
struct flooritem_data* fitem = (struct flooritem_data*)bl;
if( fitem->cleartimer )
- delete_timer(fitem->cleartimer,map_clearflooritem_timer);
+ iTimer->delete_timer(fitem->cleartimer,iMap->clearflooritem_timer);
clif->clearflooritem(fitem, 0);
- map_deliddb(&fitem->bl);
- map_delblock(&fitem->bl);
- map_freeblock(&fitem->bl);
+ iMap->deliddb(&fitem->bl);
+ iMap->delblock(&fitem->bl);
+ iMap->freeblock(&fitem->bl);
}
/*==========================================
- * (m,x,y) locates a random available free cell around the given coordinates
- * to place an BL_ITEM object. Scan area is 9x9, returns 1 on success.
- * x and y are modified with the target cell when successful.
- *------------------------------------------*/
+* (m,x,y) locates a random available free cell around the given coordinates
+* to place an BL_ITEM object. Scan area is 9x9, returns 1 on success.
+* x and y are modified with the target cell when successful.
+*------------------------------------------*/
int map_searchrandfreecell(int16 m,int16 *x,int16 *y,int stack) {
int free_cell,i,j;
int free_cells[9][2];
@@ -1321,10 +1332,10 @@ int map_searchrandfreecell(int16 m,int16 *x,int16 *y,int stack) {
for(j=-1;j<=1;j++){
if(j+*x<0 || j+*x>=map[m].xs)
continue;
- if(map_getcell(m,j+*x,i+*y,CELL_CHKNOPASS) && !map_getcell(m,j+*x,i+*y,CELL_CHKICEWALL))
+ if(iMap->getcell(m,j+*x,i+*y,CELL_CHKNOPASS) && !iMap->getcell(m,j+*x,i+*y,CELL_CHKICEWALL))
continue;
//Avoid item stacking to prevent against exploits. [Skotlex]
- if(stack && map_count_oncell(m,j+*x,i+*y, BL_ITEM) > stack)
+ if(stack && iMap->count_oncell(m,j+*x,i+*y, BL_ITEM) > stack)
continue;
free_cells[free_cell][0] = j+*x;
free_cells[free_cell++][1] = i+*y;
@@ -1345,17 +1356,17 @@ static int map_count_sub(struct block_list *bl,va_list ap)
}
/*==========================================
- * Locates a random spare cell around the object given, using range as max
- * distance from that spot. Used for warping functions. Use range < 0 for
- * whole map range.
- * Returns 1 on success. when it fails and src is available, x/y are set to src's
- * src can be null as long as flag&1
- * when ~flag&1, m is not needed.
- * Flag values:
- * &1 = random cell must be around given m,x,y, not around src
- * &2 = the target should be able to walk to the target tile.
- * &4 = there shouldn't be any players around the target tile (use the no_spawn_on_player setting)
- *------------------------------------------*/
+* Locates a random spare cell around the object given, using range as max
+* distance from that spot. Used for warping functions. Use range < 0 for
+* whole map range.
+* Returns 1 on success. when it fails and src is available, x/y are set to src's
+* src can be null as long as flag&1
+* when ~flag&1, m is not needed.
+* Flag values:
+* &1 = random cell must be around given m,x,y, not around src
+* &2 = the target should be able to walk to the target tile.
+* &4 = there shouldn't be any players around the target tile (use the no_spawn_on_player setting)
+*------------------------------------------*/
int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int16 rx, int16 ry, int flag)
{
int tries, spawn=0;
@@ -1381,7 +1392,7 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1
//No range? Return the target cell then....
*x = bx;
*y = by;
- return map_getcell(m,*x,*y,CELL_CHKREACH);
+ return iMap->getcell(m,*x,*y,CELL_CHKREACH);
}
if (rx >= 0 && ry >= 0) {
@@ -1399,7 +1410,7 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1
if (*x == bx && *y == by)
continue; //Avoid picking the same target tile.
- if (map_getcell(m,*x,*y,CELL_CHKREACH))
+ if (iMap->getcell(m,*x,*y,CELL_CHKREACH))
{
if(flag&2 && !unit_can_reach_pos(src, *x, *y, 1))
continue;
@@ -1407,10 +1418,10 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1
if (spawn >= 100) return 0; //Limit of retries reached.
if (spawn++ < battle_config.no_spawn_on_player &&
map_foreachinarea(map_count_sub, m,
- *x-AREA_SIZE, *y-AREA_SIZE,
- *x+AREA_SIZE, *y+AREA_SIZE, BL_PC)
- )
- continue;
+ *x-AREA_SIZE, *y-AREA_SIZE,
+ *x+AREA_SIZE, *y+AREA_SIZE, BL_PC)
+ )
+ continue;
}
return 1;
}
@@ -1421,14 +1432,14 @@ int map_search_freecell(struct block_list *src, int16 m, int16 *x,int16 *y, int1
}
/*==========================================
- * Add an item to location (m,x,y)
- * Parameters
- * @item_data item attributes
- * @amount quantity
- * @m, @x, @y mapid,x,y
- * @first_charid, @second_charid, @third_charid, looting priority
- * @flag: &1 MVP item. &2 do stacking check.
- *------------------------------------------*/
+* Add an item to location (m,x,y)
+* Parameters
+* @item_data item attributes
+* @amount quantity
+* @m, @x, @y mapid,x,y
+* @first_charid, @second_charid, @third_charid, looting priority
+* @flag: &1 MVP item. &2 do stacking check.
+*------------------------------------------*/
int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags)
{
int r;
@@ -1446,14 +1457,14 @@ int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,i
fitem->bl.m=m;
fitem->bl.x=x;
fitem->bl.y=y;
- fitem->bl.id = map_get_new_object_id();
+ fitem->bl.id = iMap->get_new_object_id();
if(fitem->bl.id==0){
aFree(fitem);
return 0;
}
fitem->first_get_charid = first_charid;
- fitem->first_get_tick = gettick() + (flags&1 ? battle_config.mvp_item_first_get_time : battle_config.item_first_get_time);
+ fitem->first_get_tick = iTimer->gettick() + (flags&1 ? battle_config.mvp_item_first_get_time : battle_config.item_first_get_time);
fitem->second_get_charid = second_charid;
fitem->second_get_tick = fitem->first_get_tick + (flags&1 ? battle_config.mvp_item_second_get_time : battle_config.item_second_get_time);
fitem->third_get_charid = third_charid;
@@ -1463,23 +1474,23 @@ int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,i
fitem->item_data.amount=amount;
fitem->subx=(r&3)*3+3;
fitem->suby=((r>>2)&3)*3+3;
- fitem->cleartimer=add_timer(gettick()+battle_config.flooritem_lifetime,map_clearflooritem_timer,fitem->bl.id,0);
+ fitem->cleartimer=iTimer->add_timer(iTimer->gettick()+battle_config.flooritem_lifetime,iMap->clearflooritem_timer,fitem->bl.id,0);
- map_addiddb(&fitem->bl);
- map_addblock(&fitem->bl);
+ iMap->addiddb(&fitem->bl);
+ iMap->addblock(&fitem->bl);
clif->dropflooritem(fitem);
return fitem->bl.id;
}
/**
- * @see DBCreateData
- */
+* @see DBCreateData
+*/
static DBData create_charid2nick(DBKey key, va_list args)
{
struct charid2nick *p;
CREATE(p, struct charid2nick, 1);
- return DB->ptr2data(p);
+ return iDB->ptr2data(p);
}
/// Adds(or replaces) the nick of charid to nick_db and fullfils pending requests.
@@ -1490,7 +1501,7 @@ void map_addnickdb(int charid, const char* nick)
struct charid_request* req;
struct map_session_data* sd;
- if( map_charid2sd(charid) )
+ if( iMap->charid2sd(charid) )
return;// already online
p = idb_ensure(nick_db, charid, create_charid2nick);
@@ -1499,7 +1510,7 @@ void map_addnickdb(int charid, const char* nick)
while( p->requests ) {
req = p->requests;
p->requests = req->next;
- sd = map_charid2sd(req->charid);
+ sd = iMap->charid2sd(req->charid);
if( sd )
clif->solved_charname(sd->fd, charid, p->nick);
aFree(req);
@@ -1515,13 +1526,13 @@ void map_delnickdb(int charid, const char* name)
struct map_session_data* sd;
DBData data;
- if (!nick_db->remove(nick_db, DB->i2key(charid), &data) || (p = DB->data2ptr(&data)) == NULL)
+ if (!nick_db->remove(nick_db, iDB->i2key(charid), &data) || (p = iDB->data2ptr(&data)) == NULL)
return;
while( p->requests ) {
req = p->requests;
p->requests = req->next;
- sd = map_charid2sd(req->charid);
+ sd = iMap->charid2sd(req->charid);
if( sd )
clif->solved_charname(sd->fd, charid, name);
aFree(req);
@@ -1540,7 +1551,7 @@ void map_reqnickdb(struct map_session_data * sd, int charid)
nullpo_retv(sd);
- tsd = map_charid2sd(charid);
+ tsd = iMap->charid2sd(charid);
if( tsd ) {
clif->solved_charname(sd->fd, charid, tsd->status.name);
return;
@@ -1559,8 +1570,8 @@ void map_reqnickdb(struct map_session_data * sd, int charid)
}
/*==========================================
- * add bl to id_db
- *------------------------------------------*/
+* add bl to id_db
+*------------------------------------------*/
void map_addiddb(struct block_list *bl)
{
nullpo_retv(bl);
@@ -1587,8 +1598,8 @@ void map_addiddb(struct block_list *bl)
}
/*==========================================
- * remove bl from id_db
- *------------------------------------------*/
+* remove bl from id_db
+*------------------------------------------*/
void map_deliddb(struct block_list *bl)
{
nullpo_retv(bl);
@@ -1612,8 +1623,8 @@ void map_deliddb(struct block_list *bl)
}
/*==========================================
- * Standard call when a player connection is closed.
- *------------------------------------------*/
+* Standard call when a player connection is closed.
+*------------------------------------------*/
int map_quit(struct map_session_data *sd) {
int i;
@@ -1636,13 +1647,24 @@ int map_quit(struct map_session_data *sd) {
if( sd->bg_id )
bg_team_leave(sd,1);
- pc_itemcd_do(sd,false);
+ iPc->itemcd_do(sd,false);
+
+ for( i = 0; i < sd->queues_count; i++ ) {
+ struct hQueue *queue;
+ if( (queue = script->queue(sd->queues[i])) && queue->onLogOut[0] != '\0' ) {
+ npc_event(sd, queue->onLogOut, 0);
+ }
+ }
+ /* two times, the npc event above may assign a new one or delete others */
+ for( i = 0; i < sd->queues_count; i++ ) {
+ script->queue_remove(sd->queues[i],sd->status.account_id);
+ }
npc_script_event(sd, NPCE_LOGOUT);
//Unit_free handles clearing the player related data,
- //map_quit handles extra specific data which is related to quitting normally
- //(changing map-servers invokes unit_free but bypasses map_quit)
+ //iMap->quit handles extra specific data which is related to quitting normally
+ //(changing map-servers invokes unit_free but bypasses iMap->quit)
if( sd->sc.count ) {
//Status that are not saved...
status_change_end(&sd->bl, SC_BOSSMAPINFO, INVALID_TIMER);
@@ -1659,7 +1681,7 @@ int map_quit(struct map_session_data *sd) {
status_change_end(&sd->bl, SC_ENDURE, INVALID_TIMER); //No need to save infinite endure.
status_change_end(&sd->bl, SC_WEIGHT50, INVALID_TIMER);
status_change_end(&sd->bl, SC_WEIGHT90, INVALID_TIMER);
- status_change_end(&sd->bl, SC_SATURDAYNIGHTFEVER, INVALID_TIMER);
+ status_change_end(&sd->bl, SC_SATURDAYNIGHTFEVER, INVALID_TIMER);
status_change_end(&sd->bl, SC_KYOUGAKU, INVALID_TIMER);
if (battle_config.debuff_on_logout&1) {
status_change_end(&sd->bl, SC_ORCISH, INVALID_TIMER);
@@ -1689,8 +1711,8 @@ int map_quit(struct map_session_data *sd) {
for( i = 0; i < EQI_MAX; i++ ) {
if( sd->equip_index[ i ] >= 0 )
- if( !pc_isequip( sd , sd->equip_index[ i ] ) )
- pc_unequipitem( sd , sd->equip_index[ i ] , 2 );
+ if( !iPc->isequip( sd , sd->equip_index[ i ] ) )
+ iPc->unequipitem( sd , sd->equip_index[ i ] , 2 );
}
// Return loot to owner
@@ -1708,12 +1730,12 @@ int map_quit(struct map_session_data *sd) {
if( hChSys.local && map[sd->bl.m].channel && idb_exists(map[sd->bl.m].channel->users, sd->status.char_id) ) {
clif->chsys_left(map[sd->bl.m].channel,sd);
}
-
+
clif->chsys_quit(sd);
-
+
unit_remove_map_pc(sd,CLR_TELEPORT);
- if( map[sd->bl.m].instance_id ) { // Avoid map conflicts and warnings on next login
+ if( map[sd->bl.m].instance_id >= 0 ) { // Avoid map conflicts and warnings on next login
int16 m;
struct point *pt;
if( map[sd->bl.m].save.map )
@@ -1721,8 +1743,7 @@ int map_quit(struct map_session_data *sd) {
else
pt = &sd->status.save_point;
- if( (m=map_mapindex2mapid(pt->map)) >= 0 )
- {
+ if( (m=iMap->mapindex2mapid(pt->map)) >= 0 ) {
sd->bl.m = m;
sd->bl.x = pt->x;
sd->bl.y = pt->y;
@@ -1730,17 +1751,17 @@ int map_quit(struct map_session_data *sd) {
}
}
- party_booking_delete(sd); // Party Booking [Spiria]
- pc_makesavestatus(sd);
- pc_clean_skilltree(sd);
+ iParty->booking_delete(sd); // Party Booking [Spiria]
+ iPc->makesavestatus(sd);
+ iPc->clean_skilltree(sd);
chrif_save(sd,1);
unit_free_pc(sd);
return 0;
}
/*==========================================
- * Lookup, id to session (player,mob,npc,homon,merc..)
- *------------------------------------------*/
+* Lookup, id to session (player,mob,npc,homon,merc..)
+*------------------------------------------*/
struct map_session_data * map_id2sd(int id)
{
if (id <= 0) return NULL;
@@ -1755,28 +1776,28 @@ struct mob_data * map_id2md(int id)
struct npc_data * map_id2nd(int id)
{// just a id2bl lookup because there's no npc_db
- struct block_list* bl = map_id2bl(id);
+ struct block_list* bl = iMap->id2bl(id);
return BL_CAST(BL_NPC, bl);
}
struct homun_data* map_id2hd(int id)
{
- struct block_list* bl = map_id2bl(id);
+ struct block_list* bl = iMap->id2bl(id);
return BL_CAST(BL_HOM, bl);
}
struct mercenary_data* map_id2mc(int id)
{
- struct block_list* bl = map_id2bl(id);
+ struct block_list* bl = iMap->id2bl(id);
return BL_CAST(BL_MER, bl);
}
struct chat_data* map_id2cd(int id)
{
- struct block_list* bl = map_id2bl(id);
+ struct block_list* bl = iMap->id2bl(id);
return BL_CAST(BL_CHAT, bl);
}
@@ -1787,7 +1808,7 @@ const char* map_charid2nick(int charid)
struct charid2nick *p;
struct map_session_data* sd;
- sd = map_charid2sd(charid);
+ sd = iMap->charid2sd(charid);
if( sd )
return sd->status.name;// character is online, return it's name
@@ -1806,10 +1827,10 @@ struct map_session_data* map_charid2sd(int charid)
}
/*==========================================
- * Search session data from a nick name
- * (without sensitive case if necessary)
- * return map_session_data pointer or NULL
- *------------------------------------------*/
+* Search session data from a nick name
+* (without sensitive case if necessary)
+* return map_session_data pointer or NULL
+*------------------------------------------*/
struct map_session_data * map_nick2sd(const char *nick)
{
struct map_session_data* sd;
@@ -1857,22 +1878,22 @@ struct map_session_data * map_nick2sd(const char *nick)
}
/*==========================================
- * Looksup id_db DBMap and returns BL pointer of 'id' or NULL if not found
- *------------------------------------------*/
+* Looksup id_db DBMap and returns BL pointer of 'id' or NULL if not found
+*------------------------------------------*/
struct block_list * map_id2bl(int id) {
return (struct block_list*)idb_get(id_db,id);
}
/**
- * Same as map_id2bl except it only checks for its existence
- **/
+* Same as iMap->id2bl except it only checks for its existence
+**/
bool map_blid_exists( int id ) {
return (idb_exists(id_db,id));
}
/*==========================================
- * Convext Mirror
- *------------------------------------------*/
+* Convext Mirror
+*------------------------------------------*/
struct mob_data * map_getmob_boss(int16 m)
{
DBIterator* iter;
@@ -2028,7 +2049,7 @@ struct s_mapiterator
/// @return true if it matches
#define MAPIT_MATCHES(_mapit_,_bl_) \
( \
- ( (_bl_)->type & (_mapit_)->types /* type matches */ ) \
+ ( (_bl_)->type & (_mapit_)->types /* type matches */ ) \
)
/// Allocates a new iterator.
@@ -2159,13 +2180,12 @@ bool mapit_exists(struct s_mapiterator* mapit)
}
/*==========================================
- * Add npc-bl to id_db, basically register npc to map
- *------------------------------------------*/
-bool map_addnpc(int16 m,struct npc_data *nd)
-{
+* Add npc-bl to id_db, basically register npc to map
+*------------------------------------------*/
+bool map_addnpc(int16 m,struct npc_data *nd) {
nullpo_ret(nd);
- if( m < 0 || m >= map_num )
+ if( m < 0 || m >= iMap->map_num )
return false;
if( map[m].npc_num == MAX_NPC_PER_MAP )
@@ -2181,16 +2201,15 @@ bool map_addnpc(int16 m,struct npc_data *nd)
}
/*=========================================
- * Dynamic Mobs [Wizputer]
- *-----------------------------------------*/
+* Dynamic Mobs [Wizputer]
+*-----------------------------------------*/
// Stores the spawn data entry in the mob list.
// Returns the index of successful, or -1 if the list was full.
int map_addmobtolist(unsigned short m, struct spawn_data *spawn)
{
size_t i;
ARR_FIND( 0, MAX_MOB_LIST_PER_MAP, i, map[m].moblist[i] == NULL );
- if( i < MAX_MOB_LIST_PER_MAP )
- {
+ if( i < MAX_MOB_LIST_PER_MAP ) {
map[m].moblist[i] = spawn;
return i;
}
@@ -2202,7 +2221,7 @@ void map_spawnmobs(int16 m)
int i, k=0;
if (map[m].mob_delete_timer != INVALID_TIMER)
{ //Mobs have not been removed yet [Skotlex]
- delete_timer(map[m].mob_delete_timer, map_removemobs_timer);
+ iTimer->delete_timer(map[m].mob_delete_timer, iMap->removemobs_timer);
map[m].mob_delete_timer = INVALID_TIMER;
return;
}
@@ -2213,10 +2232,10 @@ void map_spawnmobs(int16 m)
npc_parse_mob2(map[m].moblist[i]);
}
- if (battle_config.etc_log && k > 0)
- {
- ShowStatus("Map %s: Spawned '"CL_WHITE"%d"CL_RESET"' mobs.\n",map[m].name, k);
- }
+ if (battle_config.etc_log && k > 0)
+ {
+ ShowStatus("Map %s: Spawned '"CL_WHITE"%d"CL_RESET"' mobs.\n",map[m].name, k);
+ }
}
int map_removemobs_sub(struct block_list *bl, va_list ap)
@@ -2251,13 +2270,11 @@ int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data)
int count;
const int16 m = id;
- if (m < 0 || m >= MAX_MAP_PER_SERVER)
- { //Incorrect map id!
+ if (m < 0 || m >= iMap->map_num) { //Incorrect map id!
ShowError("map_removemobs_timer error: timer %d points to invalid map %d\n",tid, m);
return 0;
}
- if (map[m].mob_delete_timer != tid)
- { //Incorrect timer call!
+ if (map[m].mob_delete_timer != tid) { //Incorrect timer call!
ShowError("map_removemobs_timer mismatch: %d != %d (map %s)\n",map[m].mob_delete_timer, tid, map[m].name);
return 0;
}
@@ -2278,42 +2295,35 @@ void map_removemobs(int16 m)
if (map[m].mob_delete_timer != INVALID_TIMER) // should never happen
return; //Mobs are already scheduled for removal
- map[m].mob_delete_timer = add_timer(gettick()+battle_config.mob_remove_delay, map_removemobs_timer, m, 0);
+ map[m].mob_delete_timer = iTimer->add_timer(iTimer->gettick()+battle_config.mob_remove_delay, iMap->removemobs_timer, m, 0);
}
/*==========================================
- * Hookup, get map_id from map_name
- *------------------------------------------*/
-int16 map_mapname2mapid(const char* name)
-{
+* Hookup, get map_id from map_name
+*------------------------------------------*/
+int16 map_mapname2mapid(const char* name) {
unsigned short map_index;
map_index = mapindex_name2id(name);
if (!map_index)
return -1;
- return map_mapindex2mapid(map_index);
+ return iMap->mapindex2mapid(map_index);
}
/*==========================================
- * Returns the map of the given mapindex. [Skotlex]
- *------------------------------------------*/
-int16 map_mapindex2mapid(unsigned short mapindex)
-{
- struct map_data *md=NULL;
+* Returns the map of the given mapindex. [Skotlex]
+*------------------------------------------*/
+int16 map_mapindex2mapid(unsigned short mapindex) {
- if (!mapindex)
+ if (!mapindex || mapindex > MAX_MAPINDEX)
return -1;
- md = (struct map_data*)uidb_get(map_db,(unsigned int)mapindex);
- if(md==NULL || md->cell==NULL)
- return -1;
- return md->m;
+ return index2mapid[mapindex];
}
/*==========================================
- * Switching Ip, port ? (like changing map_server) get ip/port from map_name
- *------------------------------------------*/
-int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port)
-{
+* Switching Ip, port ? (like changing map_server) get ip/port from map_name
+*------------------------------------------*/
+int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port) {
struct map_data_other_server *mdos;
mdos = (struct map_data_other_server*)uidb_get(map_db,(unsigned int)name);
@@ -2325,28 +2335,28 @@ int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port)
}
/*==========================================
- * Checks if both dirs point in the same direction.
- *------------------------------------------*/
+* Checks if both dirs point in the same direction.
+*------------------------------------------*/
int map_check_dir(int s_dir,int t_dir)
{
if(s_dir == t_dir)
return 0;
switch(s_dir) {
- case 0: if(t_dir == 7 || t_dir == 1 || t_dir == 0) return 0; break;
- case 1: if(t_dir == 0 || t_dir == 2 || t_dir == 1) return 0; break;
- case 2: if(t_dir == 1 || t_dir == 3 || t_dir == 2) return 0; break;
- case 3: if(t_dir == 2 || t_dir == 4 || t_dir == 3) return 0; break;
- case 4: if(t_dir == 3 || t_dir == 5 || t_dir == 4) return 0; break;
- case 5: if(t_dir == 4 || t_dir == 6 || t_dir == 5) return 0; break;
- case 6: if(t_dir == 5 || t_dir == 7 || t_dir == 6) return 0; break;
- case 7: if(t_dir == 6 || t_dir == 0 || t_dir == 7) return 0; break;
+ case 0: if(t_dir == 7 || t_dir == 1 || t_dir == 0) return 0; break;
+ case 1: if(t_dir == 0 || t_dir == 2 || t_dir == 1) return 0; break;
+ case 2: if(t_dir == 1 || t_dir == 3 || t_dir == 2) return 0; break;
+ case 3: if(t_dir == 2 || t_dir == 4 || t_dir == 3) return 0; break;
+ case 4: if(t_dir == 3 || t_dir == 5 || t_dir == 4) return 0; break;
+ case 5: if(t_dir == 4 || t_dir == 6 || t_dir == 5) return 0; break;
+ case 6: if(t_dir == 5 || t_dir == 7 || t_dir == 6) return 0; break;
+ case 7: if(t_dir == 6 || t_dir == 0 || t_dir == 7) return 0; break;
}
return 1;
}
/*==========================================
- * Returns the direction of the given cell, relative to 'src'
- *------------------------------------------*/
+* Returns the direction of the given cell, relative to 'src'
+*------------------------------------------*/
uint8 map_calc_dir(struct block_list* src, int16 x, int16 y)
{
uint8 dir = 0;
@@ -2390,9 +2400,9 @@ uint8 map_calc_dir(struct block_list* src, int16 x, int16 y)
}
/*==========================================
- * Randomizes target cell x,y to a random walkable cell that
- * has the same distance from object as given coordinates do. [Skotlex]
- *------------------------------------------*/
+* Randomizes target cell x,y to a random walkable cell that
+* has the same distance from object as given coordinates do. [Skotlex]
+*------------------------------------------*/
int map_random_dir(struct block_list *bl, int16 *x, int16 *y)
{
short xi = *x-bl->x;
@@ -2411,7 +2421,7 @@ int map_random_dir(struct block_list *bl, int16 *x, int16 *y)
segment = (short)sqrt((float)(dist2 - segment*segment)); //The complement of the previously picked segment
yi = bl->y + segment*diry[j];
} while (
- (map_getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path_search(NULL,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH))
+ (iMap->getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path_search(NULL,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH))
&& (++i)<100 );
if (i < 100) {
@@ -2429,23 +2439,22 @@ inline static struct mapcell map_gat2cell(int gat) {
memset(&cell,0,sizeof(struct mapcell));
switch( gat ) {
- case 0: cell.walkable = 1; cell.shootable = 1; cell.water = 0; break; // walkable ground
- case 1: cell.walkable = 0; cell.shootable = 0; cell.water = 0; break; // non-walkable ground
- case 2: cell.walkable = 1; cell.shootable = 1; cell.water = 0; break; // ???
- case 3: cell.walkable = 1; cell.shootable = 1; cell.water = 1; break; // walkable water
- case 4: cell.walkable = 1; cell.shootable = 1; cell.water = 0; break; // ???
- case 5: cell.walkable = 0; cell.shootable = 1; cell.water = 0; break; // gap (snipable)
- case 6: cell.walkable = 1; cell.shootable = 1; cell.water = 0; break; // ???
- default:
- ShowWarning("map_gat2cell: unrecognized gat type '%d'\n", gat);
- break;
+ case 0: cell.walkable = 1; cell.shootable = 1; cell.water = 0; break; // walkable ground
+ case 1: cell.walkable = 0; cell.shootable = 0; cell.water = 0; break; // non-walkable ground
+ case 2: cell.walkable = 1; cell.shootable = 1; cell.water = 0; break; // ???
+ case 3: cell.walkable = 1; cell.shootable = 1; cell.water = 1; break; // walkable water
+ case 4: cell.walkable = 1; cell.shootable = 1; cell.water = 0; break; // ???
+ case 5: cell.walkable = 0; cell.shootable = 1; cell.water = 0; break; // gap (snipable)
+ case 6: cell.walkable = 1; cell.shootable = 1; cell.water = 0; break; // ???
+ default:
+ ShowWarning("map_gat2cell: unrecognized gat type '%d'\n", gat);
+ break;
}
return cell;
}
-static int map_cell2gat(struct mapcell cell)
-{
+static int map_cell2gat(struct mapcell cell) {
if( cell.walkable == 1 && cell.shootable == 1 && cell.water == 0 ) return 0;
if( cell.walkable == 0 && cell.shootable == 0 && cell.water == 0 ) return 1;
if( cell.walkable == 1 && cell.shootable == 1 && cell.water == 1 ) return 3;
@@ -2454,17 +2463,42 @@ static int map_cell2gat(struct mapcell cell)
ShowWarning("map_cell2gat: cell has no matching gat type\n");
return 1; // default to 'wall'
}
+int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk);
+void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag);
+void map_cellfromcache(struct map_data *m) {
+ char decode_buffer[MAX_MAP_SIZE];
+ struct map_cache_map_info *info = NULL;
+
+ if( (info = (struct map_cache_map_info *)m->cellPos) ) {
+ unsigned long size, xy;
+ int i;
+
+ size = (unsigned long)info->xs*(unsigned long)info->ys;
+
+ // TO-DO: Maybe handle the scenario, if the decoded buffer isn't the same size as expected? [Shinryo]
+ decode_zip(decode_buffer, &size, m->cellPos+sizeof(struct map_cache_map_info), info->len);
+ CREATE(m->cell, struct mapcell, size);
+
+ for( xy = 0; xy < size; ++xy )
+ m->cell[xy] = map_gat2cell(decode_buffer[xy]);
+
+ m->getcellp = map_getcellp;
+ m->setcell = map_setcell;
+
+ for(i = 0; i < m->npc_num; i++) {
+ npc_setcells(m->npc[i]);
+ }
+ }
+}
/*==========================================
- * Confirm if celltype in (m,x,y) match the one given in cellchk
- *------------------------------------------*/
-int map_getcell(int16 m,int16 x,int16 y,cell_chk cellchk)
-{
- return (m < 0 || m >= MAX_MAP_PER_SERVER) ? 0 : map_getcellp(&map[m],x,y,cellchk);
+* Confirm if celltype in (m,x,y) match the one given in cellchk
+*------------------------------------------*/
+int map_getcell(int16 m,int16 x,int16 y,cell_chk cellchk) {
+ return (m < 0 || m >= iMap->map_num) ? 0 : map[m].getcellp(&map[m],x,y,cellchk);
}
-int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk)
-{
+int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk) {
struct mapcell cell;
nullpo_ret(m);
@@ -2475,104 +2509,118 @@ int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk)
cell = m->cell[x + y*m->xs];
- switch(cellchk)
- {
+ switch(cellchk) {
// gat type retrieval
- case CELL_GETTYPE:
- return map_cell2gat(cell);
+ case CELL_GETTYPE:
+ return map_cell2gat(cell);
// base gat type checks
- case CELL_CHKWALL:
- return (!cell.walkable && !cell.shootable);
+ case CELL_CHKWALL:
+ return (!cell.walkable && !cell.shootable);
- case CELL_CHKWATER:
- return (cell.water);
+ case CELL_CHKWATER:
+ return (cell.water);
- case CELL_CHKCLIFF:
- return (!cell.walkable && cell.shootable);
+ case CELL_CHKCLIFF:
+ return (!cell.walkable && cell.shootable);
// base cell type checks
- case CELL_CHKNPC:
- return (cell.npc);
- case CELL_CHKBASILICA:
- return (cell.basilica);
- case CELL_CHKLANDPROTECTOR:
- return (cell.landprotector);
- case CELL_CHKNOVENDING:
- return (cell.novending);
- case CELL_CHKNOCHAT:
- return (cell.nochat);
- case CELL_CHKMAELSTROM:
- return (cell.maelstrom);
- case CELL_CHKICEWALL:
- return (cell.icewall);
+ case CELL_CHKNPC:
+ return (cell.npc);
+ case CELL_CHKBASILICA:
+ return (cell.basilica);
+ case CELL_CHKLANDPROTECTOR:
+ return (cell.landprotector);
+ case CELL_CHKNOVENDING:
+ return (cell.novending);
+ case CELL_CHKNOCHAT:
+ return (cell.nochat);
+ case CELL_CHKMAELSTROM:
+ return (cell.maelstrom);
+ case CELL_CHKICEWALL:
+ return (cell.icewall);
// special checks
- case CELL_CHKPASS:
+ case CELL_CHKPASS:
#ifdef CELL_NOSTACK
- if (cell.cell_bl >= battle_config.cell_stack_limit) return 0;
+ if (cell.cell_bl >= battle_config.cell_stack_limit) return 0;
#endif
- case CELL_CHKREACH:
- return (cell.walkable);
+ case CELL_CHKREACH:
+ return (cell.walkable);
- case CELL_CHKNOPASS:
+ case CELL_CHKNOPASS:
#ifdef CELL_NOSTACK
- if (cell.cell_bl >= battle_config.cell_stack_limit) return 1;
+ if (cell.cell_bl >= battle_config.cell_stack_limit) return 1;
#endif
- case CELL_CHKNOREACH:
- return (!cell.walkable);
+ case CELL_CHKNOREACH:
+ return (!cell.walkable);
- case CELL_CHKSTACK:
+ case CELL_CHKSTACK:
#ifdef CELL_NOSTACK
- return (cell.cell_bl >= battle_config.cell_stack_limit);
+ return (cell.cell_bl >= battle_config.cell_stack_limit);
#else
- return 0;
+ return 0;
#endif
- default:
- return 0;
+ default:
+ return 0;
}
}
+/* [Ind/Hercules] */
+int map_sub_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk) {
+ iMap->cellfromcache(m);
+ m->getcellp = map_getcellp;
+ m->setcell = map_setcell;
+ return m->getcellp(m,x,y,cellchk);
+}
/*==========================================
- * Change the type/flags of a map cell
- * 'cell' - which flag to modify
- * 'flag' - true = on, false = off
- *------------------------------------------*/
-void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag)
-{
+* Change the type/flags of a map cell
+* 'cell' - which flag to modify
+* 'flag' - true = on, false = off
+*------------------------------------------*/
+void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) {
int j;
- if( m < 0 || m >= map_num || x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys )
+ if( m < 0 || m >= iMap->map_num || x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys )
return;
j = x + y*map[m].xs;
switch( cell ) {
- case CELL_WALKABLE: map[m].cell[j].walkable = flag; break;
- case CELL_SHOOTABLE: map[m].cell[j].shootable = flag; break;
- case CELL_WATER: map[m].cell[j].water = flag; break;
-
- case CELL_NPC: map[m].cell[j].npc = flag; break;
- case CELL_BASILICA: map[m].cell[j].basilica = flag; break;
- case CELL_LANDPROTECTOR: map[m].cell[j].landprotector = flag; break;
- case CELL_NOVENDING: map[m].cell[j].novending = flag; break;
- case CELL_NOCHAT: map[m].cell[j].nochat = flag; break;
- case CELL_MAELSTROM: map[m].cell[j].maelstrom = flag; break;
- case CELL_ICEWALL: map[m].cell[j].icewall = flag; break;
- default:
- ShowWarning("map_setcell: invalid cell type '%d'\n", (int)cell);
- break;
+ case CELL_WALKABLE: map[m].cell[j].walkable = flag; break;
+ case CELL_SHOOTABLE: map[m].cell[j].shootable = flag; break;
+ case CELL_WATER: map[m].cell[j].water = flag; break;
+
+ case CELL_NPC: map[m].cell[j].npc = flag; break;
+ case CELL_BASILICA: map[m].cell[j].basilica = flag; break;
+ case CELL_LANDPROTECTOR: map[m].cell[j].landprotector = flag; break;
+ case CELL_NOVENDING: map[m].cell[j].novending = flag; break;
+ case CELL_NOCHAT: map[m].cell[j].nochat = flag; break;
+ case CELL_MAELSTROM: map[m].cell[j].maelstrom = flag; break;
+ case CELL_ICEWALL: map[m].cell[j].icewall = flag; break;
+ default:
+ ShowWarning("map_setcell: invalid cell type '%d'\n", (int)cell);
+ break;
}
}
+void map_sub_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag) {
+ if( m < 0 || m >= iMap->map_num || x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys )
+ return;
+
+ iMap->cellfromcache(&map[m]);
+ map[m].setcell = map_setcell;
+ map[m].getcellp = map_getcellp;
+ map[m].setcell(m,x,y,cell,flag);
+}
void map_setgatcell(int16 m, int16 x, int16 y, int gat)
{
int j;
struct mapcell cell;
- if( m < 0 || m >= map_num || x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys )
+ if( m < 0 || m >= iMap->map_num || x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys )
return;
j = x + y*map[m].xs;
@@ -2584,8 +2632,8 @@ void map_setgatcell(int16 m, int16 x, int16 y, int gat)
}
/*==========================================
- * Invisible Walls
- *------------------------------------------*/
+* Invisible Walls
+*------------------------------------------*/
static DBMap* iwall_db;
void map_iwall_nextxy(int16 x, int16 y, int8 dir, int pos, int16 *x1, int16 *y1)
@@ -2617,7 +2665,7 @@ bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable
if( (iwall = (struct iwall_data *)strdb_get(iwall_db, wall_name)) != NULL )
return false; // Already Exists
- if( map_getcell(m, x, y, CELL_CHKNOREACH) )
+ if( iMap->getcell(m, x, y, CELL_CHKNOREACH) )
return false; // Starting cell problem
CREATE(iwall, struct iwall_data, 1);
@@ -2633,13 +2681,13 @@ bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable
{
map_iwall_nextxy(x, y, dir, i, &x1, &y1);
- if( map_getcell(m, x1, y1, CELL_CHKNOREACH) )
+ if( iMap->getcell(m, x1, y1, CELL_CHKNOREACH) )
break; // Collision
- map_setcell(m, x1, y1, CELL_WALKABLE, false);
- map_setcell(m, x1, y1, CELL_SHOOTABLE, shootable);
+ map[m].setcell(m, x1, y1, CELL_WALKABLE, false);
+ map[m].setcell(m, x1, y1, CELL_SHOOTABLE, shootable);
- clif->changemapcell(0, m, x1, y1, map_getcell(m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
+ clif->changemapcell(0, m, x1, y1, iMap->getcell(m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
}
iwall->size = i;
@@ -2666,7 +2714,7 @@ void map_iwall_get(struct map_session_data *sd) {
for( i = 0; i < iwall->size; i++ ) {
map_iwall_nextxy(iwall->x, iwall->y, iwall->dir, i, &x1, &y1);
- clif->changemapcell(sd->fd, iwall->m, x1, y1, map_getcell(iwall->m, x1, y1, CELL_GETTYPE), SELF);
+ clif->changemapcell(sd->fd, iwall->m, x1, y1, iMap->getcell(iwall->m, x1, y1, CELL_GETTYPE), SELF);
}
}
dbi_destroy(iter);
@@ -2683,10 +2731,10 @@ void map_iwall_remove(const char *wall_name)
for( i = 0; i < iwall->size; i++ ) {
map_iwall_nextxy(iwall->x, iwall->y, iwall->dir, i, &x1, &y1);
- map_setcell(iwall->m, x1, y1, CELL_SHOOTABLE, true);
- map_setcell(iwall->m, x1, y1, CELL_WALKABLE, true);
+ map[iwall->m].setcell(iwall->m, x1, y1, CELL_SHOOTABLE, true);
+ map[iwall->m].setcell(iwall->m, x1, y1, CELL_WALKABLE, true);
- clif->changemapcell(0, iwall->m, x1, y1, map_getcell(iwall->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
+ clif->changemapcell(0, iwall->m, x1, y1, iMap->getcell(iwall->m, x1, y1, CELL_GETTYPE), ALL_SAMEMAP);
}
map[iwall->m].iwall_num--;
@@ -2694,8 +2742,8 @@ void map_iwall_remove(const char *wall_name)
}
/**
- * @see DBCreateData
- */
+* @see DBCreateData
+*/
static DBData create_map_data_other_server(DBKey key, va_list args)
{
struct map_data_other_server *mdos;
@@ -2703,12 +2751,12 @@ static DBData create_map_data_other_server(DBKey key, va_list args)
mdos=(struct map_data_other_server *)aCalloc(1,sizeof(struct map_data_other_server));
mdos->index = mapindex;
memcpy(mdos->name, mapindex_id2name(mapindex), MAP_NAME_LENGTH);
- return DB->ptr2data(mdos);
+ return iDB->ptr2data(mdos);
}
/*==========================================
- * Add mapindex to db of another map server
- *------------------------------------------*/
+* Add mapindex to db of another map server
+*------------------------------------------*/
int map_setipport(unsigned short mapindex, uint32 ip, uint16 port)
{
struct map_data_other_server *mdos;
@@ -2728,12 +2776,12 @@ int map_setipport(unsigned short mapindex, uint32 ip, uint16 port)
}
/**
- * Delete all the other maps server management
- * @see DBApply
- */
+* Delete all the other maps server management
+* @see DBApply
+*/
int map_eraseallipport_sub(DBKey key, DBData *data, va_list va)
{
- struct map_data_other_server *mdos = DB->data2ptr(data);
+ struct map_data_other_server *mdos = iDB->data2ptr(data);
if(mdos->cell == NULL) {
db_remove(map_db,key);
aFree(mdos);
@@ -2741,17 +2789,15 @@ int map_eraseallipport_sub(DBKey key, DBData *data, va_list va)
return 0;
}
-int map_eraseallipport(void)
-{
+int map_eraseallipport(void) {
map_db->foreach(map_db,map_eraseallipport_sub);
return 1;
}
/*==========================================
- * Delete mapindex from db of another map server
- *------------------------------------------*/
-int map_eraseipport(unsigned short mapindex, uint32 ip, uint16 port)
-{
+* Delete mapindex from db of another map server
+*------------------------------------------*/
+int map_eraseipport(unsigned short mapindex, uint32 ip, uint16 port) {
struct map_data_other_server *mdos;
mdos = (struct map_data_other_server*)uidb_get(map_db,(unsigned int)mapindex);
@@ -2767,8 +2813,8 @@ int map_eraseipport(unsigned short mapindex, uint32 ip, uint16 port)
}
/*==========================================
- * [Shinryo]: Init the mapcache
- *------------------------------------------*/
+* [Shinryo]: Init the mapcache
+*------------------------------------------*/
static char *map_init_mapcache(FILE *fp)
{
size_t size = 0;
@@ -2798,11 +2844,10 @@ static char *map_init_mapcache(FILE *fp)
}
/*==========================================
- * Map cache reading
- * [Shinryo]: Optimized some behaviour to speed this up
- *==========================================*/
-int map_readfromcache(struct map_data *m, char *buffer, char *decode_buffer)
-{
+* Map cache reading
+* [Shinryo]: Optimized some behaviour to speed this up
+*==========================================*/
+int map_readfromcache(struct map_data *m, char *buffer) {
int i;
struct map_cache_main_header *header = (struct map_cache_main_header *)buffer;
struct map_cache_map_info *info = NULL;
@@ -2819,7 +2864,7 @@ int map_readfromcache(struct map_data *m, char *buffer, char *decode_buffer)
}
if( info && i < header->map_count ) {
- unsigned long size, xy;
+ unsigned long size;
if( info->xs <= 0 || info->ys <= 0 )
return 0;// Invalid
@@ -2833,14 +2878,8 @@ int map_readfromcache(struct map_data *m, char *buffer, char *decode_buffer)
return 0; // Say not found to remove it from list.. [Shinryo]
}
- // TO-DO: Maybe handle the scenario, if the decoded buffer isn't the same size as expected? [Shinryo]
- decode_zip(decode_buffer, &size, p+sizeof(struct map_cache_map_info), info->len);
-
- CREATE(m->cell, struct mapcell, size);
-
-
- for( xy = 0; xy < size; ++xy )
- m->cell[xy] = map_gat2cell(decode_buffer[xy]);
+ m->cellPos = p;
+ m->cell = (struct mapcell *)0xdeadbeaf;
return 1;
}
@@ -2848,45 +2887,30 @@ int map_readfromcache(struct map_data *m, char *buffer, char *decode_buffer)
return 0; // Not found
}
-int map_addmap(char* mapname)
-{
- if( strcmpi(mapname,"clear")==0 )
- {
- map_num = 0;
- instance_start = 0;
- return 0;
- }
- if( map_num >= MAX_MAP_PER_SERVER - 1 )
- {
- ShowError("Could not add map '"CL_WHITE"%s"CL_RESET"', the limit of maps has been reached.\n",mapname);
- return 1;
- }
-
- mapindex_getmapname(mapname, map[map_num].name);
- map_num++;
+int map_addmap(char* mapname) {
+ map[iMap->map_num].instance_id = -1;
+ mapindex_getmapname(mapname, map[iMap->map_num++].name);
return 0;
}
-static void map_delmapid(int id)
-{
+static void map_delmapid(int id) {
ShowNotice("Removing map [ %s ] from maplist"CL_CLL"\n",map[id].name);
- memmove(map+id, map+id+1, sizeof(map[0])*(map_num-id-1));
- map_num--;
+ memmove(map+id, map+id+1, sizeof(map[0])*(iMap->map_num-id-1));
+ iMap->map_num--;
}
-int map_delmap(char* mapname)
-{
+int map_delmap(char* mapname) {
int i;
char map_name[MAP_NAME_LENGTH];
if (strcmpi(mapname, "all") == 0) {
- map_num = 0;
+ iMap->map_num = 0;
return 0;
}
mapindex_getmapname(mapname, map_name);
- for(i = 0; i < map_num; i++) {
+ for(i = 0; i < iMap->map_num; i++) {
if (strcmp(map[i].name, map_name) == 0) {
map_delmapid(i);
return 1;
@@ -2897,7 +2921,7 @@ int map_delmap(char* mapname)
void map_zone_db_clear(void) {
struct map_zone_data *zone;
int i;
-
+
DBIterator *iter = db_iterator(zone_db);
for(zone = dbi_first(iter); dbi_exists(iter); zone = dbi_next(iter)) {
for(i = 0; i < zone->disabled_skills_count; i++) {
@@ -2919,9 +2943,9 @@ void map_zone_db_clear(void) {
aFree(zone->capped_skills);
}
dbi_destroy(iter);
-
+
db_destroy(zone_db);/* will aFree(zone) */
-
+
/* clear the pk zone stuff */
for(i = 0; i < map_zone_pk.disabled_skills_count; i++) {
aFree(map_zone_pk.disabled_skills[i]);
@@ -2959,20 +2983,69 @@ void map_zone_db_clear(void) {
}
aFree(map_zone_all.capped_skills);
}
+void map_clean(int i) {
+ int v;
+ if(map[i].cell && map[i].cell != (struct mapcell *)0xdeadbeaf) aFree(map[i].cell);
+ if(map[i].block) aFree(map[i].block);
+ if(map[i].block_mob) aFree(map[i].block_mob);
+
+ if(battle_config.dynamic_mobs) { //Dynamic mobs flag by [random]
+ int j;
+ if(map[i].mob_delete_timer != INVALID_TIMER)
+ iTimer->delete_timer(map[i].mob_delete_timer, iMap->removemobs_timer);
+ for (j=0; j<MAX_MOB_LIST_PER_MAP; j++)
+ if (map[i].moblist[j]) aFree(map[i].moblist[j]);
+ }
+
+ if( map[i].unit_count ) {
+ for(v = 0; v < map[i].unit_count; v++) {
+ aFree(map[i].units[v]);
+ }
+ if( map[i].units ) {
+ aFree(map[i].units);
+ map[i].units = NULL;
+ }
+ map[i].unit_count = 0;
+ }
+ if( map[i].skill_count ) {
+ for(v = 0; v < map[i].skill_count; v++) {
+ aFree(map[i].skills[v]);
+ }
+ if( map[i].skills ) {
+ aFree(map[i].skills);
+ map[i].skills = NULL;
+ }
+ map[i].skill_count = 0;
+ }
+
+ if( map[i].zone_mf_count ) {
+ for(v = 0; v < map[i].zone_mf_count; v++) {
+ aFree(map[i].zone_mf[v]);
+ }
+ if( map[i].zone_mf ) {
+ aFree(map[i].zone_mf);
+ map[i].zone_mf = NULL;
+ }
+ map[i].zone_mf_count = 0;
+ }
+
+ if( map[i].channel )
+ clif->chsys_delete(map[i].channel);
+}
void do_final_maps(void) {
int i, v = 0;
- for( i = 0; i < map_num; i++ ) {
-
- if(map[i].cell) aFree(map[i].cell);
+ for( i = 0; i < iMap->map_num; i++ ) {
+
+ if(map[i].cell && map[i].cell != (struct mapcell *)0xdeadbeaf ) aFree(map[i].cell);
if(map[i].block) aFree(map[i].block);
if(map[i].block_mob) aFree(map[i].block_mob);
-
+
if(battle_config.dynamic_mobs) { //Dynamic mobs flag by [random]
int j;
if(map[i].mob_delete_timer != INVALID_TIMER)
- delete_timer(map[i].mob_delete_timer, map_removemobs_timer);
+ iTimer->delete_timer(map[i].mob_delete_timer, iMap->removemobs_timer);
for (j=0; j<MAX_MOB_LIST_PER_MAP; j++)
if (map[i].moblist[j]) aFree(map[i].moblist[j]);
}
@@ -2987,7 +3060,7 @@ void do_final_maps(void) {
}
map[i].unit_count = 0;
}
-
+
if( map[i].skill_count ) {
for(v = 0; v < map[i].skill_count; v++) {
aFree(map[i].skills[v]);
@@ -2998,7 +3071,7 @@ void do_final_maps(void) {
}
map[i].skill_count = 0;
}
-
+
if( map[i].zone_mf_count ) {
for(v = 0; v < map[i].zone_mf_count; v++) {
aFree(map[i].zone_mf[v]);
@@ -3009,19 +3082,25 @@ void do_final_maps(void) {
}
map[i].zone_mf_count = 0;
}
-
+
+ if( map[i].drop_list_count ) {
+ map[i].drop_list_count = 0;
+ }
+ if( map[i].drop_list != NULL )
+ aFree(map[i].drop_list);
+
if( map[i].channel )
clif->chsys_delete(map[i].channel);
}
-
+
map_zone_db_clear();
-
+
}
/// Initializes map flags and adjusts them depending on configuration.
void map_flags_init(void) {
int i, v = 0;
- for( i = 0; i < map_num; i++ ) {
+ for( i = 0; i < iMap->map_num; i++ ) {
// mapflags
memset(&map[i].flag, 0, sizeof(map[i].flag));
@@ -3029,7 +3108,10 @@ void map_flags_init(void) {
map[i].nocommand = 0; // nocommand mapflag level
map[i].bexp = 100; // per map base exp multiplicator
map[i].jexp = 100; // per map job exp multiplicator
- memset(map[i].drop_list, 0, sizeof(map[i].drop_list)); // pvp nightmare drop list
+ if( map[i].drop_list != NULL )
+ aFree(map[i].drop_list);
+ map[i].drop_list = NULL;
+ map[i].drop_list_count = 0;
if( map[i].unit_count ) {
for(v = 0; v < map[i].unit_count; v++) {
@@ -3039,7 +3121,7 @@ void map_flags_init(void) {
}
map[i].units = NULL;
map[i].unit_count = 0;
-
+
if( map[i].skill_count ) {
for(v = 0; v < map[i].skill_count; v++) {
aFree(map[i].skills[v]);
@@ -3048,27 +3130,27 @@ void map_flags_init(void) {
}
map[i].skills = NULL;
map[i].skill_count = 0;
-
+
// adjustments
if( battle_config.pk_mode ) {
map[i].flag.pvp = 1; // make all maps pvp for pk_mode [Valaris]
map[i].zone = &map_zone_pk;
} else /* align with 'All' zone */
map[i].zone = &map_zone_all;
-
+
if( map[i].zone_mf_count ) {
for(v = 0; v < map[i].zone_mf_count; v++) {
aFree(map[i].zone_mf[v]);
}
aFree(map[i].zone_mf);
}
-
+
map[i].zone_mf = NULL;
map[i].zone_mf_count = 0;
map[i].prev_zone = map[i].zone;
-
+
map[i].invincible_time_inc = 0;
-
+
map[i].weapon_damage_rate = 100;
map[i].magic_damage_rate = 100;
map[i].misc_damage_rate = 100;
@@ -3080,15 +3162,15 @@ void map_flags_init(void) {
#define NO_WATER 1000000
/*
- * Reads from the .rsw for each map
- * Returns water height (or NO_WATER if file doesn't exist) or other error is encountered.
- * Assumed path for file is data/mapname.rsw
- * Credits to LittleWolf
- */
+* Reads from the .rsw for each map
+* Returns water height (or NO_WATER if file doesn't exist) or other error is encountered.
+* Assumed path for file is data/mapname.rsw
+* Credits to LittleWolf
+*/
int map_waterheight(char* mapname)
{
char fn[256];
- char *rsw, *found;
+ char *rsw, *found;
//Look up for the rsw
sprintf(fn, "data\\%s.rsw", mapname);
@@ -3109,8 +3191,8 @@ int map_waterheight(char* mapname)
}
/*==================================
- * .GAT format
- *----------------------------------*/
+* .GAT format
+*----------------------------------*/
int map_readgat (struct map_data* m)
{
char filename[256];
@@ -3152,33 +3234,29 @@ int map_readgat (struct map_data* m)
}
/*======================================
- * Add/Remove map to the map_db
- *--------------------------------------*/
-void map_addmap2db(struct map_data *m)
-{
- uidb_put(map_db, (unsigned int)m->index, m);
+* Add/Remove map to the map_db
+*--------------------------------------*/
+void map_addmap2db(struct map_data *m) {
+ index2mapid[m->index] = m->m;
}
-void map_removemapdb(struct map_data *m)
-{
- uidb_remove(map_db, (unsigned int)m->index);
+void map_removemapdb(struct map_data *m) {
+ index2mapid[m->index] = -1;
}
/*======================================
- * Initiate maps loading stage
- *--------------------------------------*/
+* Initiate maps loading stage
+*--------------------------------------*/
int map_readallmaps (void) {
int i;
FILE* fp=NULL;
int maps_removed = 0;
- char *map_cache_buffer = NULL; // Has the uncompressed gat data of all maps, so just one allocation has to be made
- char map_cache_decode_buffer[MAX_MAP_SIZE];
-
+
if( enable_grf )
ShowStatus("Loading maps (using GRF files)...\n");
else {
char mapcachefilepath[254];
- sprintf(mapcachefilepath,"%s/%s%s",db_path,DBPATH,"map_cache.dat");
+ sprintf(mapcachefilepath,"%s/%s%s",iMap->db_path,DBPATH,"map_cache.dat");
ShowStatus("Loading maps (using %s as map cache)...\n", mapcachefilepath);
if( (fp = fopen(mapcachefilepath, "rb")) == NULL ) {
ShowFatalError("Unable to open map cache file "CL_WHITE"%s"CL_RESET"\n", mapcachefilepath);
@@ -3193,31 +3271,30 @@ int map_readallmaps (void) {
}
}
- for(i = 0; i < map_num; i++) {
+ for(i = 0; i < iMap->map_num; i++) {
size_t size;
// show progress
if(enable_grf)
- ShowStatus("Loading maps [%i/%i]: %s"CL_CLL"\r", i, map_num, map[i].name);
+ ShowStatus("Loading maps [%i/%i]: %s"CL_CLL"\r", i, iMap->map_num, map[i].name);
// try to load the map
if( !
(enable_grf?
- map_readgat(&map[i])
- :map_readfromcache(&map[i], map_cache_buffer, map_cache_decode_buffer))
+ map_readgat(&map[i])
+ :map_readfromcache(&map[i], map_cache_buffer))
) {
- map_delmapid(i);
- maps_removed++;
- i--;
- continue;
+ map_delmapid(i);
+ maps_removed++;
+ i--;
+ continue;
}
map[i].index = mapindex_name2id(map[i].name);
- if (uidb_get(map_db,(unsigned int)map[i].index) != NULL)
- {
+ if ( index2mapid[map[i].index] != -1 ) {
ShowWarning("Map %s already loaded!"CL_CLL"\n", map[i].name);
- if (map[i].cell) {
+ if (map[i].cell && map[i].cell != (struct mapcell *)0xdeadbeaf) {
aFree(map[i].cell);
map[i].cell = NULL;
}
@@ -3227,9 +3304,9 @@ int map_readallmaps (void) {
continue;
}
- map_addmap2db(&map[i]);
-
map[i].m = i;
+ iMap->addmap2db(&map[i]);
+
memset(map[i].moblist, 0, sizeof(map[i].moblist)); //Initialize moblist [Skotlex]
map[i].mob_delete_timer = INVALID_TIMER; //Initialize timer [Skotlex]
@@ -3239,21 +3316,21 @@ int map_readallmaps (void) {
size = map[i].bxs * map[i].bys * sizeof(struct block_list*);
map[i].block = (struct block_list**)aCalloc(size, 1);
map[i].block_mob = (struct block_list**)aCalloc(size, 1);
+
+ map[i].getcellp = map_sub_getcellp;
+ map[i].setcell = map_sub_setcell;
}
// intialization and configuration-dependent adjustments of mapflags
- map_flags_init();
+ iMap->flags_init();
if( !enable_grf ) {
fclose(fp);
-
- // The cache isn't needed anymore, so free it.. [Shinryo]
- aFree(map_cache_buffer);
}
// finished map loading
- ShowInfo("Successfully loaded '"CL_WHITE"%d"CL_RESET"' maps."CL_CLL"\n",map_num);
- instance_start = map_num; // Next Map Index will be instances
+ ShowInfo("Successfully loaded '"CL_WHITE"%d"CL_RESET"' maps."CL_CLL"\n",iMap->map_num);
+ instance->start_id = iMap->map_num; // Next Map Index will be instances
if (maps_removed)
ShowNotice("Maps removed: '"CL_WHITE"%d"CL_RESET"'\n",maps_removed);
@@ -3266,22 +3343,19 @@ static int map_ip_set = 0;
static int char_ip_set = 0;
/*==========================================
- * Read map server configuration files (conf/map_server.conf...)
- *------------------------------------------*/
-int map_config_read(char *cfgName)
-{
+* Read map server configuration files (conf/map_server.conf...)
+*------------------------------------------*/
+int map_config_read(char *cfgName) {
char line[1024], w1[1024], w2[1024];
FILE *fp;
fp = fopen(cfgName,"r");
- if( fp == NULL )
- {
+ if( fp == NULL ) {
ShowError("Map configuration file not found at: %s\n", cfgName);
return 1;
}
- while( fgets(line, sizeof(line), fp) )
- {
+ while( fgets(line, sizeof(line), fp) ) {
char* ptr;
if( line[0] == '/' && line[1] == '/' )
@@ -3321,37 +3395,35 @@ int map_config_read(char *cfgName)
clif->setport(atoi(w2));
map_port = (atoi(w2));
} else if (strcmpi(w1, "map") == 0)
- map_addmap(w2);
+ iMap->map_num++;
else if (strcmpi(w1, "delmap") == 0)
- map_delmap(w2);
+ iMap->map_num--;
else if (strcmpi(w1, "npc") == 0)
npc_addsrcfile(w2);
else if (strcmpi(w1, "delnpc") == 0)
npc_delsrcfile(w2);
else if (strcmpi(w1, "autosave_time") == 0) {
- autosave_interval = atoi(w2);
- if (autosave_interval < 1) //Revert to default saving.
- autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
+ iMap->autosave_interval = atoi(w2);
+ if (iMap->autosave_interval < 1) //Revert to default saving.
+ iMap->autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
else
- autosave_interval *= 1000; //Pass from sec to ms
+ iMap->autosave_interval *= 1000; //Pass from sec to ms
} else if (strcmpi(w1, "minsave_time") == 0) {
- minsave_interval= atoi(w2);
- if (minsave_interval < 1)
- minsave_interval = 1;
+ iMap->minsave_interval= atoi(w2);
+ if (iMap->minsave_interval < 1)
+ iMap->minsave_interval = 1;
} else if (strcmpi(w1, "save_settings") == 0)
- save_settings = atoi(w2);
- else if (strcmpi(w1, "motd_txt") == 0)
- strcpy(motd_txt, w2);
+ iMap->save_settings = atoi(w2);
else if (strcmpi(w1, "help_txt") == 0)
- strcpy(help_txt, w2);
+ strcpy(iMap->help_txt, w2);
else if (strcmpi(w1, "help2_txt") == 0)
- strcpy(help2_txt, w2);
+ strcpy(iMap->help2_txt, w2);
else if (strcmpi(w1, "charhelp_txt") == 0)
- strcpy(charhelp_txt, w2);
+ strcpy(iMap->charhelp_txt, w2);
else if(strcmpi(w1,"db_path") == 0)
- safestrncpy(db_path,w2,255);
+ safestrncpy(iMap->db_path,w2,255);
else if (strcmpi(w1, "enable_spy") == 0)
- enable_spy = config_switch(w2);
+ iMap->enable_spy = config_switch(w2);
else if (strcmpi(w1, "use_grf") == 0)
enable_grf = config_switch(w2);
else if (strcmpi(w1, "console_msg_log") == 0)
@@ -3365,7 +3437,43 @@ int map_config_read(char *cfgName)
fclose(fp);
return 0;
}
+int map_config_read_sub(char *cfgName) {
+ char line[1024], w1[1024], w2[1024];
+ FILE *fp;
+
+ fp = fopen(cfgName,"r");
+ if( fp == NULL ) {
+ ShowError("Map configuration file not found at: %s\n", cfgName);
+ return 1;
+ }
+ while( fgets(line, sizeof(line), fp) ) {
+ char* ptr;
+
+ if( line[0] == '/' && line[1] == '/' )
+ continue;
+ if( (ptr = strstr(line, "//")) != NULL )
+ *ptr = '\n'; //Strip comments
+ if( sscanf(line, "%[^:]: %[^\t\r\n]", w1, w2) < 2 )
+ continue;
+
+ //Strip trailing spaces
+ ptr = w2 + strlen(w2);
+ while (--ptr >= w2 && *ptr == ' ');
+ ptr++;
+ *ptr = '\0';
+
+ if (strcmpi(w1, "map") == 0)
+ map_addmap(w2);
+ else if (strcmpi(w1, "delmap") == 0)
+ iMap->delmap(w2);
+ else if (strcmpi(w1, "import") == 0)
+ map_config_read_sub(w2);
+ }
+
+ fclose(fp);
+ return 0;
+}
void map_reloadnpc_sub(char *cfgName)
{
char line[1024], w1[1024], w2[1024];
@@ -3436,64 +3544,64 @@ int inter_config_read(char *cfgName)
continue;
if(strcmpi(w1,"item_db_db")==0)
- strcpy(item_db_db,w2);
- else
- if(strcmpi(w1,"mob_db_db")==0)
- strcpy(mob_db_db,w2);
- else
- if(strcmpi(w1,"item_db2_db")==0)
- strcpy(item_db2_db,w2);
- else
- if(strcmpi(w1,"item_db_re_db")==0)
- strcpy(item_db_re_db,w2);
- else
- if(strcmpi(w1,"mob_db2_db")==0)
- strcpy(mob_db2_db,w2);
- else
- //Map Server SQL DB
- if(strcmpi(w1,"map_server_ip")==0)
- strcpy(map_server_ip, w2);
- else
- if(strcmpi(w1,"map_server_port")==0)
- map_server_port=atoi(w2);
- else
- if(strcmpi(w1,"map_server_id")==0)
- strcpy(map_server_id, w2);
- else
- if(strcmpi(w1,"map_server_pw")==0)
- strcpy(map_server_pw, w2);
- else
- if(strcmpi(w1,"map_server_db")==0)
- strcpy(map_server_db, w2);
- else
- if(strcmpi(w1,"default_codepage")==0)
- strcpy(default_codepage, w2);
- else
- if(strcmpi(w1,"use_sql_db")==0) {
- db_use_sqldbs = config_switch(w2);
- ShowStatus ("Using SQL dbs: %s\n",w2);
- } else
- if(strcmpi(w1,"log_db_ip")==0)
- strcpy(log_db_ip, w2);
- else
- if(strcmpi(w1,"log_db_id")==0)
- strcpy(log_db_id, w2);
- else
- if(strcmpi(w1,"log_db_pw")==0)
- strcpy(log_db_pw, w2);
- else
- if(strcmpi(w1,"log_db_port")==0)
- log_db_port = atoi(w2);
- else
- if(strcmpi(w1,"log_db_db")==0)
- strcpy(log_db_db, w2);
+ strcpy(iMap->item_db_db,w2);
else
- if( mapreg_config_read(w1,w2) )
- continue;
- //support the import command, just like any other config
- else
- if(strcmpi(w1,"import")==0)
- inter_config_read(w2);
+ if(strcmpi(w1,"mob_db_db")==0)
+ strcpy(iMap->mob_db_db,w2);
+ else
+ if(strcmpi(w1,"item_db2_db")==0)
+ strcpy(iMap->item_db2_db,w2);
+ else
+ if(strcmpi(w1,"item_db_re_db")==0)
+ strcpy(iMap->item_db_re_db,w2);
+ else
+ if(strcmpi(w1,"mob_db2_db")==0)
+ strcpy(iMap->mob_db2_db,w2);
+ else
+ //Map Server SQL DB
+ if(strcmpi(w1,"map_server_ip")==0)
+ strcpy(map_server_ip, w2);
+ else
+ if(strcmpi(w1,"map_server_port")==0)
+ map_server_port=atoi(w2);
+ else
+ if(strcmpi(w1,"map_server_id")==0)
+ strcpy(map_server_id, w2);
+ else
+ if(strcmpi(w1,"map_server_pw")==0)
+ strcpy(map_server_pw, w2);
+ else
+ if(strcmpi(w1,"map_server_db")==0)
+ strcpy(map_server_db, w2);
+ else
+ if(strcmpi(w1,"default_codepage")==0)
+ strcpy(default_codepage, w2);
+ else
+ if(strcmpi(w1,"use_sql_db")==0) {
+ iMap->db_use_sqldbs = config_switch(w2);
+ ShowStatus ("Using SQL dbs: %s\n",w2);
+ } else
+ if(strcmpi(w1,"log_db_ip")==0)
+ strcpy(log_db_ip, w2);
+ else
+ if(strcmpi(w1,"log_db_id")==0)
+ strcpy(log_db_id, w2);
+ else
+ if(strcmpi(w1,"log_db_pw")==0)
+ strcpy(log_db_pw, w2);
+ else
+ if(strcmpi(w1,"log_db_port")==0)
+ log_db_port = atoi(w2);
+ else
+ if(strcmpi(w1,"log_db_db")==0)
+ strcpy(log_db_db, w2);
+ else
+ if( mapreg_config_read(w1,w2) )
+ continue;
+ //support the import command, just like any other config
+ else
+ if(strcmpi(w1,"import")==0)
+ inter_config_read(w2);
}
fclose(fp);
@@ -3501,8 +3609,8 @@ int inter_config_read(char *cfgName)
}
/*=======================================
- * MySQL Init
- *---------------------------------------*/
+* MySQL Init
+*---------------------------------------*/
int map_sql_init(void)
{
// main db connection
@@ -3550,21 +3658,21 @@ int log_sql_init(void)
}
void map_zone_change2(int m, struct map_zone_data *zone) {
char empty[1] = "\0";
-
+
map[m].prev_zone = map[m].zone;
if( map[m].zone_mf_count )
- map_zone_remove(m);
-
- map_zone_apply(m,zone,empty,empty,empty);
+ iMap->zone_remove(m);
+
+ iMap->zone_apply(m,zone,empty,empty,empty);
}
/* when changing from a mapflag to another during runtime */
void map_zone_change(int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath) {
map[m].prev_zone = map[m].zone;
-
+
if( map[m].zone_mf_count )
- map_zone_remove(m);
- map_zone_apply(m,zone,start,buffer,filepath);
+ iMap->zone_remove(m);
+ iMap->zone_apply(m,zone,start,buffer,filepath);
}
/* removes previous mapflags from this map */
void map_zone_remove(int m) {
@@ -3582,12 +3690,12 @@ void map_zone_remove(int m) {
break;
}
}
-
+
npc_parse_mapflag(map[m].name,empty,flag,params,empty,empty,empty);
aFree(map[m].zone_mf[k]);
map[m].zone_mf[k] = NULL;
}
-
+
aFree(map[m].zone_mf);
map[m].zone_mf = NULL;
map[m].zone_mf_count = 0;
@@ -3602,31 +3710,31 @@ static inline void map_zone_mf_cache_add(int m, char *rflag) {
bool map_zone_mf_cache(int m, char *flag, char *params) {
char rflag[MAP_ZONE_MAPFLAG_LENGTH];
int state = 1;
-
+
if (params[0] != '\0' && !strcmpi(params, "off"))
state = 0;
-
+
if (!strcmpi(flag, "nosave")) {
;/* not yet supported to be reversed */
/*
char savemap[32];
int savex, savey;
if (state == 0) {
- if( map[m].flag.nosave ) {
- sprintf(rflag, "nosave SavePoint");
- map_zone_mf_cache_add(m,nosave);
- }
+ if( map[m].flag.nosave ) {
+ sprintf(rflag, "nosave SavePoint");
+ map_zone_mf_cache_add(m,nosave);
+ }
} else if (!strcmpi(params, "SavePoint")) {
- if( map[m].save.map ) {
- sprintf(rflag, "nosave %s,%d,%d",mapindex_id2name(map[m].save.map),map[m].save.x,map[m].save.y);
- } else
- sprintf(rflag, "nosave %s,%d,%d",mapindex_id2name(map[m].save.map),map[m].save.x,map[m].save.y);
- map_zone_mf_cache_add(m,nosave);
+ if( map[m].save.map ) {
+ sprintf(rflag, "nosave %s,%d,%d",mapindex_id2name(map[m].save.map),map[m].save.x,map[m].save.y);
+ } else
+ sprintf(rflag, "nosave %s,%d,%d",mapindex_id2name(map[m].save.map),map[m].save.x,map[m].save.y);
+ map_zone_mf_cache_add(m,nosave);
} else if (sscanf(params, "%31[^,],%d,%d", savemap, &savex, &savey) == 3) {
- if( map[m].save.map ) {
- sprintf(rflag, "nosave %s,%d,%d",mapindex_id2name(map[m].save.map),map[m].save.x,map[m].save.y);
- map_zone_mf_cache_add(m,nosave);
- }
+ if( map[m].save.map ) {
+ sprintf(rflag, "nosave %s,%d,%d",mapindex_id2name(map[m].save.map),map[m].save.x,map[m].save.y);
+ map_zone_mf_cache_add(m,nosave);
+ }
}*/
} else if (!strcmpi(flag,"autotrade")) {
if( state && map[m].flag.autotrade )
@@ -3768,33 +3876,33 @@ bool map_zone_mf_cache(int m, char *flag, char *params) {
/*char drop_arg1[16], drop_arg2[16];
int drop_per = 0;
if (sscanf(w4, "%[^,],%[^,],%d", drop_arg1, drop_arg2, &drop_per) == 3) {
- int drop_id = 0, drop_type = 0;
- if (!strcmpi(drop_arg1, "random"))
- drop_id = -1;
- else if (itemdb_exists((drop_id = atoi(drop_arg1))) == NULL)
- drop_id = 0;
- if (!strcmpi(drop_arg2, "inventory"))
- drop_type = 1;
- else if (!strcmpi(drop_arg2,"equip"))
- drop_type = 2;
- else if (!strcmpi(drop_arg2,"all"))
- drop_type = 3;
-
- if (drop_id != 0){
- int i;
- for (i = 0; i < MAX_DROP_PER_MAP; i++) {
- if (map[m].drop_list[i].drop_id == 0){
- map[m].drop_list[i].drop_id = drop_id;
- map[m].drop_list[i].drop_type = drop_type;
- map[m].drop_list[i].drop_per = drop_per;
- break;
- }
- }
- map[m].flag.pvp_nightmaredrop = 1;
- }
+ int drop_id = 0, drop_type = 0;
+ if (!strcmpi(drop_arg1, "random"))
+ drop_id = -1;
+ else if (itemdb_exists((drop_id = atoi(drop_arg1))) == NULL)
+ drop_id = 0;
+ if (!strcmpi(drop_arg2, "inventory"))
+ drop_type = 1;
+ else if (!strcmpi(drop_arg2,"equip"))
+ drop_type = 2;
+ else if (!strcmpi(drop_arg2,"all"))
+ drop_type = 3;
+
+ if (drop_id != 0){
+ int i;
+ for (i = 0; i < MAX_DROP_PER_MAP; i++) {
+ if (map[m].drop_list[i].drop_id == 0){
+ map[m].drop_list[i].drop_id = drop_id;
+ map[m].drop_list[i].drop_type = drop_type;
+ map[m].drop_list[i].drop_per = drop_per;
+ break;
+ }
+ }
+ map[m].flag.pvp_nightmaredrop = 1;
+ }
} else if (!state) //Disable
- map[m].flag.pvp_nightmaredrop = 0;
- */
+ map[m].flag.pvp_nightmaredrop = 0;
+ */
} else if (!strcmpi(flag,"pvp_nocalcrank")) {
if( state && map[m].flag.pvp_nocalcrank )
;/* nothing to do */
@@ -4125,10 +4233,10 @@ bool map_zone_mf_cache(int m, char *flag, char *params) {
int skill_id, k;
char skill_name[MAP_ZONE_MAPFLAG_LENGTH], modifier[MAP_ZONE_MAPFLAG_LENGTH];
int len = strlen(params);
-
+
modifier[0] = '\0';
memcpy(skill_name, params, MAP_ZONE_MAPFLAG_LENGTH);
-
+
for(k = 0; k < len; k++) {
if( skill_name[k] == '\t' ) {
memcpy(modifier, &skill_name[k+1], len - k);
@@ -4136,15 +4244,15 @@ bool map_zone_mf_cache(int m, char *flag, char *params) {
break;
}
}
-
+
if( modifier[0] == '\0' || !( skill_id = skill->name2id(skill_name) ) || !skill->get_unit_id( skill->name2id(skill_name), 0) || atoi(modifier) < 1 || atoi(modifier) > USHRT_MAX ) {
;/* we dont mind it, the server will take care of it next. */
} else {
int idx = map[m].unit_count;
-
+
k = 0;
ARR_FIND(0, idx, k, map[m].units[k]->skill_id == skill_id);
-
+
if( k < idx ) {
if( atoi(modifier) != map[m].units[k]->modifier ) {
sprintf(rflag,"adjust_unit_duration %s %d",skill_name,map[m].units[k]->modifier);
@@ -4159,10 +4267,10 @@ bool map_zone_mf_cache(int m, char *flag, char *params) {
int skill_id, k;
char skill_name[MAP_ZONE_MAPFLAG_LENGTH], modifier[MAP_ZONE_MAPFLAG_LENGTH];
int len = strlen(params);
-
+
modifier[0] = '\0';
memcpy(skill_name, params, MAP_ZONE_MAPFLAG_LENGTH);
-
+
for(k = 0; k < len; k++) {
if( skill_name[k] == '\t' ) {
memcpy(modifier, &skill_name[k+1], len - k);
@@ -4170,15 +4278,15 @@ bool map_zone_mf_cache(int m, char *flag, char *params) {
break;
}
}
-
+
if( modifier[0] == '\0' || !( skill_id = skill->name2id(skill_name) ) || atoi(modifier) < 1 || atoi(modifier) > USHRT_MAX ) {
;/* we dont mind it, the server will take care of it next. */
} else {
int idx = map[m].skill_count;
-
+
k = 0;
ARR_FIND(0, idx, k, map[m].skills[k]->skill_id == skill_id);
-
+
if( k < idx ) {
if( atoi(modifier) != map[m].skills[k]->modifier ) {
sprintf(rflag,"adjust_skill_damage %s %d",skill_name,map[m].skills[k]->modifier);
@@ -4188,7 +4296,7 @@ bool map_zone_mf_cache(int m, char *flag, char *params) {
sprintf(rflag,"adjust_skill_damage %s 100",skill_name);
map_zone_mf_cache_add(m,rflag);
}
-
+
}
} else if (!strcmpi(flag,"zone")) {
ShowWarning("You can't add a zone through a zone! ERROR, skipping for '%s'...\n",map[m].name);
@@ -4303,10 +4411,10 @@ void map_zone_apply(int m, struct map_zone_data *zone, const char* start, const
break;
}
}
-
+
if( map_zone_mf_cache(m,flag,params) )
continue;
-
+
npc_parse_mapflag(map[m].name,empty,flag,params,start,buffer,filepath);
}
}
@@ -4316,9 +4424,9 @@ void map_zone_init(void) {
struct map_zone_data *zone;
char empty[1] = "\0";
int i,k,j;
-
+
zone = &map_zone_all;
-
+
for(i = 0; i < zone->mapflags_count; i++) {
int len = strlen(zone->mapflags[i]);
params[0] = '\0';
@@ -4330,8 +4438,8 @@ void map_zone_init(void) {
break;
}
}
-
- for(j = 0; j < map_num; j++) {
+
+ for(j = 0; j < iMap->map_num; j++) {
if( map[j].zone == zone ) {
if( map_zone_mf_cache(j,flag,params) )
break;
@@ -4339,7 +4447,7 @@ void map_zone_init(void) {
}
}
}
-
+
if( battle_config.pk_mode ) {
zone = &map_zone_pk;
for(i = 0; i < zone->mapflags_count; i++) {
@@ -4353,7 +4461,7 @@ void map_zone_init(void) {
break;
}
}
- for(j = 0; j < map_num; j++) {
+ for(j = 0; j < iMap->map_num; j++) {
if( map[j].zone == zone ) {
if( map_zone_mf_cache(j,flag,params) )
break;
@@ -4362,11 +4470,11 @@ void map_zone_init(void) {
}
}
}
-
+
}
unsigned short map_zone_str2itemid(const char *name) {
struct item_data *data;
-
+
if( !name )
return 0;
if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) {
@@ -4382,10 +4490,10 @@ unsigned short map_zone_str2itemid(const char *name) {
}
unsigned short map_zone_str2skillid(const char *name) {
unsigned short nameid = 0;
-
+
if( !name )
return 0;
-
+
if( name[0] == 'I' && name[1] == 'D' && strlen(name) <= 7 ) {
if( !skill->get_index((nameid = atoi(name+2))) )
return 0;
@@ -4403,11 +4511,11 @@ enum bl_type map_zone_bl_type(const char *entry, enum map_zone_skill_subtype *su
if( !entry )
return BL_NUL;
-
+
safestrncpy(temp, entry, 200);
-
+
parse = strtok(temp,"|");
-
+
while (parse != NULL) {
normalize_name(parse," ");
if( strcmpi(parse,"player") == 0 )
@@ -4452,9 +4560,9 @@ void read_map_zone_db(void) {
#endif
if (conf_read_file(&map_zone_db, config_filename))
return;
-
+
zones = config_lookup(&map_zone_db, "zones");
-
+
if (zones != NULL) {
struct map_zone_data *zone;
config_setting_t *zone_e;
@@ -4469,22 +4577,22 @@ void read_map_zone_db(void) {
int zone_count = 0, disabled_skills_count = 0, disabled_items_count = 0, mapflags_count = 0,
disabled_commands_count = 0, capped_skills_count = 0;
enum map_zone_skill_subtype subtype;
-
+
zone_count = config_setting_length(zones);
for (i = 0; i < zone_count; ++i) {
bool is_all = false;
-
+
zone_e = config_setting_get_elem(zones, i);
-
+
if (!config_setting_lookup_string(zone_e, "name", &zonename)) {
ShowError("map_zone_db: missing zone name, skipping... (%s:%d)\n",
- config_setting_source_file(zone_e), config_setting_source_line(zone_e));
+ config_setting_source_file(zone_e), config_setting_source_line(zone_e));
config_setting_remove_elem(zones,i);/* remove from the tree */
--zone_count;
--i;
continue;
}
-
+
if( strdb_exists(zone_db, zonename) ) {
ShowError("map_zone_db: duplicate zone name '%s', skipping...\n",zonename);
config_setting_remove_elem(zones,i);/* remove from the tree */
@@ -4492,7 +4600,7 @@ void read_map_zone_db(void) {
--i;
continue;
}
-
+
/* is this the global template? */
if( strncmpi(zonename,MAP_ZONE_NORMAL_NAME,MAP_ZONE_NAME_LENGTH) == 0 ) {
zone = &map_zone_all;
@@ -4506,7 +4614,7 @@ void read_map_zone_db(void) {
zone->disabled_items_count = 0;
}
safestrncpy(zone->name, zonename, MAP_ZONE_NAME_LENGTH);
-
+
if( (skills = config_setting_get_member(zone_e, "disabled_skills")) != NULL ) {
disabled_skills_count = config_setting_length(skills);
/* validate */
@@ -4530,21 +4638,21 @@ void read_map_zone_db(void) {
struct map_zone_disabled_skill_entry * entry;
enum bl_type type;
name = config_setting_name(skill);
-
+
if( (type = map_zone_bl_type(config_setting_get_string_elem(skills,h),&subtype)) ) { /* only add if enabled */
CREATE( entry, struct map_zone_disabled_skill_entry, 1 );
-
+
entry->nameid = map_zone_str2skillid(name);
entry->type = type;
entry->subtype = subtype;
-
+
zone->disabled_skills[v++] = entry;
}
-
+
}
zone->disabled_skills_count = disabled_skills_count;
}
-
+
if( (items = config_setting_get_member(zone_e, "disabled_items")) != NULL ) {
disabled_items_count = config_setting_length(items);
/* validate */
@@ -4565,31 +4673,31 @@ void read_map_zone_db(void) {
CREATE( zone->disabled_items, int, disabled_items_count );
for(h = 0, v = 0; h < config_setting_length(items); h++) {
config_setting_t *item = config_setting_get_elem(items, h);
-
+
if( config_setting_get_bool(item) ) { /* only add if enabled */
name = config_setting_name(item);
zone->disabled_items[v++] = map_zone_str2itemid(name);
}
-
+
}
zone->disabled_items_count = disabled_items_count;
}
-
+
if( (mapflags = config_setting_get_member(zone_e, "mapflags")) != NULL ) {
mapflags_count = config_setting_length(mapflags);
/* mapflags are not validated here, so we save all anyway */
CREATE( zone->mapflags, char *, mapflags_count );
for(h = 0; h < mapflags_count; h++) {
CREATE( zone->mapflags[h], char, MAP_ZONE_MAPFLAG_LENGTH );
-
+
name = config_setting_get_string_elem(mapflags, h);
-
+
safestrncpy(zone->mapflags[h], name, MAP_ZONE_MAPFLAG_LENGTH);
-
+
}
zone->mapflags_count = mapflags_count;
}
-
+
if( (commands = config_setting_get_member(zone_e, "disabled_commands")) != NULL ) {
disabled_commands_count = config_setting_length(commands);
/* validate */
@@ -4613,19 +4721,19 @@ void read_map_zone_db(void) {
struct map_zone_disabled_command_entry * entry;
int group_lv;
name = config_setting_name(command);
-
+
if( (group_lv = config_setting_get_int(command)) ) { /* only add if enabled */
CREATE( entry, struct map_zone_disabled_command_entry, 1 );
-
+
entry->cmd = atcommand->exists(name)->func;
entry->group_lv = group_lv;
-
+
zone->disabled_commands[v++] = entry;
}
}
zone->disabled_commands_count = disabled_commands_count;
}
-
+
if( (caps = config_setting_get_member(zone_e, "skill_damage_cap")) != NULL ) {
capped_skills_count = config_setting_length(caps);
/* validate */
@@ -4649,10 +4757,10 @@ void read_map_zone_db(void) {
struct map_zone_skill_damage_cap_entry * entry;
enum bl_type type;
name = config_setting_name(cap);
-
+
if( (type = map_zone_bl_type(config_setting_get_string_elem(cap,1),&subtype)) ) { /* only add if enabled */
CREATE( entry, struct map_zone_skill_damage_cap_entry, 1 );
-
+
entry->nameid = map_zone_str2skillid(name);
entry->cap = config_setting_get_int_elem(cap,0);
entry->type = type;
@@ -4662,25 +4770,25 @@ void read_map_zone_db(void) {
}
zone->capped_skills_count = capped_skills_count;
}
-
+
if( !is_all ) /* global template doesn't go into db -- since it isn't a alloc'd piece of data */
strdb_put(zone_db, zonename, zone);
-
+
}
-
+
/* process inheritance, aka loop through the whole thing again :P */
for (i = 0; i < zone_count; ++i) {
config_setting_t *inherit_tree = NULL;
config_setting_t *new_entry = NULL;
int inherit_count;
-
+
zone_e = config_setting_get_elem(zones, i);
config_setting_lookup_string(zone_e, "name", &zonename);
if( strncmpi(zonename,MAP_ZONE_ALL_NAME,MAP_ZONE_NAME_LENGTH) == 0 ) {
continue;/* all zone doesn't inherit anything (if it did, everything would link to each other and boom endless loop) */
}
-
+
if( (inherit_tree = config_setting_get_member(zone_e, "inherit")) != NULL ) {
/* append global zone to this */
new_entry = config_setting_add(inherit_tree,MAP_ZONE_ALL_NAME,CONFIG_TYPE_STRING);
@@ -4700,7 +4808,7 @@ void read_map_zone_db(void) {
int disabled_commands_count_i = 0; /* commands count from inherit zone */
int capped_skills_count_i = 0; /* skill capped count from inherit zone */
int j;
-
+
name = config_setting_get_string_elem(inherit_tree, h);
config_setting_lookup_string(zone_e, "name", &zonename);/* will succeed for we validated it earlier */
@@ -4708,20 +4816,20 @@ void read_map_zone_db(void) {
ShowError("map_zone_db: Unknown zone '%s' being inherit by zone '%s', skipping...\n",name,zonename);
continue;
}
-
+
if( strncmpi(zonename,MAP_ZONE_NORMAL_NAME,MAP_ZONE_NAME_LENGTH) == 0 ) {
zone = &map_zone_all;
} else if( strncmpi(zonename,MAP_ZONE_PK_NAME,MAP_ZONE_NAME_LENGTH) == 0 ) {
zone = &map_zone_pk;
} else
zone = strdb_get(zone_db, zonename);/* will succeed for we just put it in here */
-
+
disabled_skills_count_i = izone->disabled_skills_count;
disabled_items_count_i = izone->disabled_items_count;
mapflags_count_i = izone->mapflags_count;
disabled_commands_count_i = izone->disabled_commands_count;
capped_skills_count_i = izone->capped_skills_count;
-
+
/* process everything to override, paying attention to config_setting_get_bool */
if( disabled_skills_count_i ) {
if( (skills = config_setting_get_member(zone_e, "disabled_skills")) == NULL )
@@ -4745,7 +4853,7 @@ void read_map_zone_db(void) {
}
}
}
-
+
if( disabled_items_count_i ) {
if( (items = config_setting_get_member(zone_e, "disabled_items")) == NULL )
items = config_setting_add(zone_e, "disabled_items",CONFIG_TYPE_GROUP);
@@ -4754,9 +4862,9 @@ void read_map_zone_db(void) {
int k;
for(k = 0; k < disabled_items_count; k++) {
config_setting_t *item = config_setting_get_elem(items, k);
-
+
name = config_setting_name(item);
-
+
if( map_zone_str2itemid(name) == izone->disabled_items[j] ) {
if( config_setting_get_bool(item) )
continue;
@@ -4769,7 +4877,7 @@ void read_map_zone_db(void) {
}
}
}
-
+
if( mapflags_count_i ) {
if( (mapflags = config_setting_get_member(zone_e, "mapflags")) == NULL )
mapflags = config_setting_add(zone_e, "mapflags",CONFIG_TYPE_ARRAY);
@@ -4778,7 +4886,7 @@ void read_map_zone_db(void) {
int k;
for(k = 0; k < mapflags_count; k++) {
name = config_setting_get_string_elem(mapflags, k);
-
+
if( strcmpi(name,izone->mapflags[j]) == 0 ) {
break;
}
@@ -4790,7 +4898,7 @@ void read_map_zone_db(void) {
}
}
}
-
+
if( disabled_commands_count_i ) {
if( (commands = config_setting_get_member(zone_e, "disabled_commands")) == NULL )
commands = config_setting_add(zone_e, "disabled_commands",CONFIG_TYPE_GROUP);
@@ -4814,11 +4922,11 @@ void read_map_zone_db(void) {
}
}
}
-
+
if( capped_skills_count_i ) {
if( (caps = config_setting_get_member(zone_e, "skill_damage_cap")) == NULL )
caps = config_setting_add(zone_e, "skill_damage_cap",CONFIG_TYPE_GROUP);
-
+
capped_skills_count = config_setting_length(caps);
for(j = 0; j < capped_skills_count_i; j++) {
int k;
@@ -4842,7 +4950,7 @@ void read_map_zone_db(void) {
}
}
-
+
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' zones in '"CL_WHITE"%s"CL_RESET"'.\n", zone_count, config_filename);
/* not supposed to go in here but in skill_final whatever */
config_destroy(&map_zone_db);
@@ -4850,22 +4958,23 @@ void read_map_zone_db(void) {
}
/**
- * @see DBApply
- */
-int map_db_final(DBKey key, DBData *data, va_list ap)
-{
- struct map_data_other_server *mdos = DB->data2ptr(data);
- if(mdos && mdos->cell == NULL)
+* @see DBApply
+*/
+int map_db_final(DBKey key, DBData *data, va_list ap) {
+ struct map_data_other_server *mdos = iDB->data2ptr(data);
+
+ if(mdos && iMalloc->verify_ptr(mdos) && mdos->cell == NULL)
aFree(mdos);
+
return 0;
}
/**
- * @see DBApply
- */
+* @see DBApply
+*/
int nick_db_final(DBKey key, DBData *data, va_list args)
{
- struct charid2nick* p = DB->data2ptr(data);
+ struct charid2nick* p = iDB->data2ptr(data);
struct charid_request* req;
if( p == NULL )
@@ -4880,45 +4989,44 @@ int nick_db_final(DBKey key, DBData *data, va_list args)
return 0;
}
-int cleanup_sub(struct block_list *bl, va_list ap)
-{
+int cleanup_sub(struct block_list *bl, va_list ap) {
nullpo_ret(bl);
switch(bl->type) {
- case BL_PC:
- map_quit((struct map_session_data *) bl);
- break;
- case BL_NPC:
- npc_unload((struct npc_data *)bl,false);
- break;
- case BL_MOB:
- unit_free(bl,CLR_OUTSIGHT);
- break;
- case BL_PET:
+ case BL_PC:
+ iMap->quit((struct map_session_data *) bl);
+ break;
+ case BL_NPC:
+ npc_unload((struct npc_data *)bl,false);
+ break;
+ case BL_MOB:
+ unit_free(bl,CLR_OUTSIGHT);
+ break;
+ case BL_PET:
//There is no need for this, the pet is removed together with the player. [Skotlex]
- break;
- case BL_ITEM:
- map_clearflooritem(bl);
- break;
- case BL_SKILL:
- skill->delunit((struct skill_unit *) bl);
- break;
+ break;
+ case BL_ITEM:
+ iMap->clearflooritem(bl);
+ break;
+ case BL_SKILL:
+ skill->delunit((struct skill_unit *) bl);
+ break;
}
return 1;
}
/**
- * @see DBApply
- */
+* @see DBApply
+*/
static int cleanup_db_sub(DBKey key, DBData *data, va_list va)
{
- return cleanup_sub(DB->data2ptr(data), va);
+ return iMap->cleanup_sub(iDB->data2ptr(data), va);
}
/*==========================================
- * map destructor
- *------------------------------------------*/
+* map destructor
+*------------------------------------------*/
void do_final(void)
{
int i;
@@ -4932,24 +5040,26 @@ void do_final(void)
//Ladies and babies first.
iter = mapit_getallusers();
for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) )
- map_quit(sd);
+ iMap->quit(sd);
mapit->free(iter);
+ instance->final();
+
/* prepares npcs for a faster shutdown process */
do_clear_npc();
// remove all objects on maps
- for (i = 0; i < map_num; i++) {
- ShowStatus("Cleaning up maps [%d/%d]: %s..."CL_CLL"\r", i+1, map_num, map[i].name);
+ for (i = 0; i < iMap->map_num; i++) {
+ ShowStatus("Cleaning up maps [%d/%d]: %s..."CL_CLL"\r", i+1, iMap->map_num, map[i].name);
if (map[i].m >= 0)
- map_foreachinmap(cleanup_sub, i, BL_ALL);
+ map_foreachinmap(iMap->cleanup_sub, i, BL_ALL);
}
- ShowStatus("Cleaned up %d maps."CL_CLL"\n", map_num);
+ ShowStatus("Cleaned up %d maps."CL_CLL"\n", iMap->map_num);
id_db->foreach(id_db,cleanup_db_sub);
chrif_char_reset_offline();
chrif_flush_fifo();
-
+
atcommand->final();
battle->final();
do_final_chrif();
@@ -4957,12 +5067,11 @@ void do_final(void)
clif->final();
do_final_npc();
script->final();
- do_final_instance();
do_final_itemdb();
do_final_storage();
guild->final();
- do_final_party();
- do_final_pc();
+ iParty->do_final_party();
+ iPc->do_final_pc();
do_final_pet();
do_final_mob();
homun->final();
@@ -4975,9 +5084,9 @@ void do_final(void)
do_final_elemental();
do_final_maps();
vending->final();
-
+
map_db->destroy(map_db, map_db_final);
-
+
mapindex_final();
if(enable_grf)
grfio_final();
@@ -4991,11 +5100,14 @@ void do_final(void)
iwall_db->destroy(iwall_db, NULL);
regen_db->destroy(regen_db, NULL);
- map_sql_close();
+ map_sql_close();
ers_destroy(map_iterator_ers);
-
+
aFree(map);
+ if( !enable_grf )
+ aFree(map_cache_buffer);
+
ShowStatus("Finished.\n");
}
@@ -5026,13 +5138,13 @@ void do_abort(void)
return;
}
ShowError("Server received crash signal! Attempting to save all online characters!\n");
- map_foreachpc(map_abort_sub);
+ iMap->map_foreachpc(map_abort_sub);
chrif_flush_fifo();
}
/*======================================================
- * Map-Server Version Screen [MC Cameri]
- *------------------------------------------------------*/
+* Map-Server Version Screen [MC Cameri]
+*------------------------------------------------------*/
static void map_helpscreen(bool do_exit)
{
ShowInfo("Usage: %s [options]\n", SERVER_NAME);
@@ -5054,8 +5166,8 @@ static void map_helpscreen(bool do_exit)
}
/*======================================================
- * Map-Server Version Screen [MC Cameri]
- *------------------------------------------------------*/
+* Map-Server Version Screen [MC Cameri]
+*------------------------------------------------------*/
static void map_versionscreen(bool do_exit) {
const char *svn = get_svn_revision();
const char *git = get_git_hash();
@@ -5110,23 +5222,23 @@ CPCMD(gm_position) {
return;
}
- if ( (m = map_mapname2mapid(map_name) <= 0 ) ) {
+ if ( (m = iMap->mapname2mapid(map_name) <= 0 ) ) {
ShowError("gm:info '"CL_WHITE"%s"CL_RESET"' is not a known map\n",map_name);
return;
}
-
+
if( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys ) {
ShowError("gm:info '"CL_WHITE"%d %d"CL_RESET"' is out of '"CL_WHITE"%s"CL_RESET"' map bounds!\n",x,y,map_name);
return;
}
-
+
ShowInfo("HCP: updated console's game position to '"CL_WHITE"%d %d %s"CL_RESET"'\n",x,y,map_name);
cpsd.bl.x = x;
cpsd.bl.y = y;
cpsd.bl.m = m;
}
CPCMD(gm_use) {
-
+
if( line == NULL ) {
ShowError("gm:use invalid syntax. use '"CL_WHITE"gm:use @command <optional params>"CL_RESET"'\n");
return;
@@ -5137,7 +5249,7 @@ CPCMD(gm_use) {
else
ShowInfo("HCP: '"CL_WHITE"%s"CL_RESET"' was used\n",line);
cpsd.fd = 0;
-
+
}
/* Hercules Console Parser */
void map_cp_defaults(void) {
@@ -5146,7 +5258,7 @@ void map_cp_defaults(void) {
strcpy(cpsd.status.name, "Hercules Console");
cpsd.bl.x = 150;
cpsd.bl.y = 150;
- cpsd.bl.m = map_mapname2mapid("prontera");
+ cpsd.bl.m = iMap->mapname2mapid("prontera");
console->addCommand("gm:info",CPCMD_A(gm_position));
console->addCommand("gm:use",CPCMD_A(gm_use));
@@ -5157,19 +5269,18 @@ void map_hp_symbols(void) {
HPM->share(atcommand,"atcommand");
HPM->share(buyingstore,"buyingstore");
HPM->share(clif,"clif");
+ HPM->share(guild,"guild");
HPM->share(ircbot,"ircbot");
HPM->share(logs,"logs");
HPM->share(script,"script");
HPM->share(searchstore,"searchstore");
HPM->share(skill,"skill");
HPM->share(vending,"vending");
+ HPM->share(iPc,"iPc");
+ HPM->share(iParty,"iParty");
+ HPM->share(iMap,"iMap");
/* partial */
HPM->share(mapit,"mapit");
- HPM->share(map_foreachpc,"map_foreachpc");
- HPM->share(map_foreachmob,"map_foreachmob");
- HPM->share(map_foreachnpc,"map_foreachnpc");
- HPM->share(map_foreachregen,"map_foreachregen");
- HPM->share(map_foreachiddb,"map_foreachiddb");
/* sql link */
HPM->share(mmysql_handle,"sql_handle");
/* specific */
@@ -5178,38 +5289,25 @@ void map_hp_symbols(void) {
/* vars */
HPM->share(map,"map");
}
-/* temporary until the map.c "Hercules Renewal Phase One" design is complete. */
-void map_defaults(void) {
- mapit = &mapit_s;
-
- mapit->alloc = mapit_alloc;
- mapit->free = mapit_free;
- mapit->first = mapit_first;
- mapit->last = mapit_last;
- mapit->next = mapit_next;
- mapit->prev = mapit_prev;
- mapit->exists = mapit_exists;
- map_foreachpc = map_map_foreachpc;
- map_foreachmob = map_map_foreachmob;
- map_foreachnpc = map_map_foreachnpc;
- map_foreachregen = map_map_foreachregen;
- map_foreachiddb = map_map_foreachiddb;
-}
void load_defaults(void) {
atcommand_defaults();
battle_defaults();
+ battleground_defaults();
buyingstore_defaults();
clif_defaults();
guild_defaults();
homunculus_defaults();
+ instance_defaults();
ircbot_defaults();
log_defaults();
- map_defaults();
+ npc_defaults();
script_defaults();
searchstore_defaults();
skill_defaults();
vending_defaults();
+ pc_defaults();
+ party_defaults();
}
int do_init(int argc, char *argv[])
{
@@ -5219,113 +5317,113 @@ int do_init(int argc, char *argv[])
GC_enable_incremental();
#endif
- INTER_CONF_NAME="conf/inter-server.conf";
- LOG_CONF_NAME="conf/logs.conf";
- MAP_CONF_NAME = "conf/map-server.conf";
- BATTLE_CONF_FILENAME = "conf/battle.conf";
- ATCOMMAND_CONF_FILENAME = "conf/atcommand.conf";
- SCRIPT_CONF_NAME = "conf/script.conf";
- MSG_CONF_NAME = "conf/messages.conf";
- GRF_PATH_FILENAME = "conf/grf-files.txt";
+ map_defaults();
+ iMap->map_num = 0;
+
+ sprintf(iMap->db_path ,"db");
+ sprintf(iMap->help_txt ,"conf/help.txt");
+ sprintf(iMap->help2_txt ,"conf/help2.txt");
+ sprintf(iMap->charhelp_txt ,"conf/charhelp.txt");
+
+ sprintf(iMap->wisp_server_name ,"Server"); // can be modified in char-server configuration file
+
+ iMap->autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
+ iMap->minsave_interval = 100;
+ iMap->save_settings = 0xFFFF;
+ iMap->agit_flag = 0;
+ iMap->agit2_flag = 0;
+ iMap->night_flag = 0; // 0=day, 1=night [Yor]
+ iMap->enable_spy = 0; //To enable/disable @spy commands, which consume too much cpu time when sending packets. [Skotlex]
+
+ iMap->db_use_sqldbs = 0;
+
+ sprintf(iMap->item_db_db, "item_db");
+ sprintf(iMap->item_db2_db, "item_db2");
+ sprintf(iMap->item_db_re_db, "item_db_re");
+ sprintf(iMap->mob_db_db, "mob_db");
+ sprintf(iMap->mob_db2_db, "mob_db2");
+ sprintf(iMap->mob_skill_db_db, "mob_skill_db");
+ sprintf(iMap->mob_skill_db2_db, "mob_skill_db2");
+
+ iMap->INTER_CONF_NAME="conf/inter-server.conf";
+ iMap->LOG_CONF_NAME="conf/logs.conf";
+ iMap->MAP_CONF_NAME = "conf/map-server.conf";
+ iMap->BATTLE_CONF_FILENAME = "conf/battle.conf";
+ iMap->ATCOMMAND_CONF_FILENAME = "conf/atcommand.conf";
+ iMap->SCRIPT_CONF_NAME = "conf/script.conf";
+ iMap->MSG_CONF_NAME = "conf/messages.conf";
+ iMap->GRF_PATH_FILENAME = "conf/grf-files.txt";
rnd_init();
- for( i = 1; i < argc ; i++ )
- {
+ for( i = 1; i < argc ; i++ ) {
const char* arg = argv[i];
- if( arg[0] != '-' && ( arg[0] != '/' || arg[1] == '-' ) )
- {// -, -- and /
+ if( arg[0] != '-' && ( arg[0] != '/' || arg[1] == '-' ) ) {// -, -- and /
ShowError("Unknown option '%s'.\n", argv[i]);
exit(EXIT_FAILURE);
- }
- else if( (++arg)[0] == '-' )
- {// long option
+ } else if( (++arg)[0] == '-' ) {// long option
arg++;
- if( strcmp(arg, "help") == 0 )
- {
+ if( strcmp(arg, "help") == 0 ) {
map_helpscreen(true);
- }
- else if( strcmp(arg, "version") == 0 )
- {
+ } else if( strcmp(arg, "version") == 0 ) {
map_versionscreen(true);
- }
- else if( strcmp(arg, "map-config") == 0 )
- {
+ } else if( strcmp(arg, "map-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- MAP_CONF_NAME = argv[++i];
- }
- else if( strcmp(arg, "battle-config") == 0 )
- {
+ iMap->MAP_CONF_NAME = argv[++i];
+ } else if( strcmp(arg, "battle-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- BATTLE_CONF_FILENAME = argv[++i];
- }
- else if( strcmp(arg, "atcommand-config") == 0 )
- {
+ iMap->BATTLE_CONF_FILENAME = argv[++i];
+ } else if( strcmp(arg, "atcommand-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- ATCOMMAND_CONF_FILENAME = argv[++i];
- }
- else if( strcmp(arg, "script-config") == 0 )
- {
+ iMap->ATCOMMAND_CONF_FILENAME = argv[++i];
+ } else if( strcmp(arg, "script-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- SCRIPT_CONF_NAME = argv[++i];
- }
- else if( strcmp(arg, "msg-config") == 0 )
- {
+ iMap->SCRIPT_CONF_NAME = argv[++i];
+ } else if( strcmp(arg, "msg-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- MSG_CONF_NAME = argv[++i];
- }
- else if( strcmp(arg, "grf-path-file") == 0 )
- {
+ iMap->MSG_CONF_NAME = argv[++i];
+ } else if( strcmp(arg, "grf-path-file") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- GRF_PATH_FILENAME = argv[++i];
- }
- else if( strcmp(arg, "inter-config") == 0 )
- {
+ iMap->GRF_PATH_FILENAME = argv[++i];
+ } else if( strcmp(arg, "inter-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- INTER_CONF_NAME = argv[++i];
- }
- else if( strcmp(arg, "log-config") == 0 )
- {
+ iMap->INTER_CONF_NAME = argv[++i];
+ } else if( strcmp(arg, "log-config") == 0 ) {
if( map_arg_next_value(arg, i, argc) )
- LOG_CONF_NAME = argv[++i];
- }
- else if( strcmp(arg, "run-once") == 0 ) // close the map-server as soon as its done.. for testing [Celest]
- {
+ iMap->LOG_CONF_NAME = argv[++i];
+ } else if( strcmp(arg, "run-once") == 0 ) { // close the map-server as soon as its done.. for testing [Celest]
runflag = CORE_ST_STOP;
- }
- else
- {
+ } else {
ShowError("Unknown option '%s'.\n", argv[i]);
exit(EXIT_FAILURE);
}
- }
- else switch( arg[0] )
- {// short option
- case '?':
- case 'h':
- map_helpscreen(true);
- break;
- case 'v':
- map_versionscreen(true);
- break;
- default:
- ShowError("Unknown option '%s'.\n", argv[i]);
- exit(EXIT_FAILURE);
+ } else switch( arg[0] ) {// short option
+ case '?':
+ case 'h':
+ map_helpscreen(true);
+ break;
+ case 'v':
+ map_versionscreen(true);
+ break;
+ default:
+ ShowError("Unknown option '%s'.\n", argv[i]);
+ exit(EXIT_FAILURE);
}
}
-
- CREATE(map,struct map_data,MAX_MAP_PER_SERVER);
-
+ memset(&index2mapid, -1, sizeof(index2mapid));
+
load_defaults();
-
- map_config_read(MAP_CONF_NAME);
+ map_config_read(iMap->MAP_CONF_NAME);
+ CREATE(map,struct map_data,iMap->map_num);
+ iMap->map_num = 0;
+ map_config_read_sub(iMap->MAP_CONF_NAME);
// loads npcs
- map_reloadnpc(false);
+ iMap->reloadnpc(false);
chrif_checkdefaultlogin();
-
+
if (!map_ip_set || !char_ip_set) {
char ip_str[16];
ip2str(addr_[0], ip_str);
@@ -5344,15 +5442,15 @@ int do_init(int argc, char *argv[])
if (!char_ip_set)
chrif_setip(ip_str);
}
-
- battle->config_read(BATTLE_CONF_FILENAME);
- atcommand->msg_read(MSG_CONF_NAME);
- script_config_read(SCRIPT_CONF_NAME);
- inter_config_read(INTER_CONF_NAME);
- logs->config_read(LOG_CONF_NAME);
+
+ battle->config_read(iMap->BATTLE_CONF_FILENAME);
+ atcommand->msg_read(iMap->MSG_CONF_NAME);
+ script_config_read(iMap->SCRIPT_CONF_NAME);
+ inter_config_read(iMap->INTER_CONF_NAME);
+ logs->config_read(iMap->LOG_CONF_NAME);
id_db = idb_alloc(DB_OPT_BASE);
- pc_db = idb_alloc(DB_OPT_BASE); //Added for reliable map_id2sd() use. [Skotlex]
+ pc_db = idb_alloc(DB_OPT_BASE); //Added for reliable iMap->id2sd() use. [Skotlex]
mobid_db = idb_alloc(DB_OPT_BASE); //Added to lower the load of the lazy mob ai. [Skotlex]
bossid_db = idb_alloc(DB_OPT_BASE); // Used for Convex Mirror quick MVP search
map_db = uidb_alloc(DB_OPT_BASE);
@@ -5364,29 +5462,29 @@ int do_init(int argc, char *argv[])
zone_db = strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, MAP_ZONE_NAME_LENGTH);
map_iterator_ers = ers_new(sizeof(struct s_mapiterator),"map.c::map_iterator_ers",ERS_OPT_NONE);
-
+
map_sql_init();
if (logs->config.sql_logs)
log_sql_init();
mapindex_init();
if(enable_grf)
- grfio_init(GRF_PATH_FILENAME);
-
+ grfio_init(iMap->GRF_PATH_FILENAME);
+
map_readallmaps();
- add_timer_func_list(map_freeblock_timer, "map_freeblock_timer");
- add_timer_func_list(map_clearflooritem_timer, "map_clearflooritem_timer");
- add_timer_func_list(map_removemobs_timer, "map_removemobs_timer");
- add_timer_interval(gettick()+1000, map_freeblock_timer, 0, 0, 60*1000);
-
+ iTimer->add_timer_func_list(map_freeblock_timer, "map_freeblock_timer");
+ iTimer->add_timer_func_list(map_clearflooritem_timer, "map_clearflooritem_timer");
+ iTimer->add_timer_func_list(map_removemobs_timer, "map_removemobs_timer");
+ iTimer->add_timer_interval(iTimer->gettick()+1000, map_freeblock_timer, 0, 0, 60*1000);
+
HPM->symbol_defaults_sub = map_hp_symbols;
HPM->config_read();
HPM->event(HPET_INIT);
-
+
atcommand->init();
battle->init();
- do_init_instance();
+ instance->init();
do_init_chrif();
clif->init();
ircbot->init();
@@ -5395,9 +5493,9 @@ int do_init(int argc, char *argv[])
skill->init();
read_map_zone_db();/* read after item and skill initalization */
do_init_mob();
- do_init_pc();
+ iPc->do_init_pc();
do_init_status();
- do_init_party();
+ iParty->do_init_party();
guild->init();
do_init_storage();
do_init_pet();
@@ -5417,17 +5515,144 @@ int do_init(int argc, char *argv[])
ShowNotice("Server is running on '"CL_WHITE"PK Mode"CL_RESET"'.\n");
Sql_HerculesUpdateCheck(mmysql_handle);
-
+
ShowStatus("Server is '"CL_GREEN"ready"CL_RESET"' and listening on port '"CL_WHITE"%d"CL_RESET"'.\n\n", map_port);
-
+
if( runflag != CORE_ST_STOP ) {
- shutdown_callback = do_shutdown;
+ shutdown_callback = iMap->do_shutdown;
runflag = MAPSERVER_ST_RUNNING;
}
-
+
map_cp_defaults();
-
+
HPM->event(HPET_READY);
-
+
return 0;
}
+
+/*=====================================
+* Default Functions : map.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+void map_defaults(void) {
+ iMap = &iMap_s;
+
+ /* funcs */
+ iMap->zone_init = map_zone_init;
+ iMap->zone_remove = map_zone_remove;
+ iMap->zone_apply = map_zone_apply;
+ iMap->zone_change = map_zone_change;
+ iMap->zone_change2 = map_zone_change2;
+
+ iMap->getcell = map_getcell;
+ iMap->setgatcell = map_setgatcell;
+
+ iMap->cellfromcache = map_cellfromcache;
+ // users
+ iMap->setusers = map_setusers;
+ iMap->getusers = map_getusers;
+ iMap->usercount = map_usercount;
+ // blocklist lock
+ iMap->freeblock = map_freeblock;
+ iMap->freeblock_lock = map_freeblock_lock;
+ iMap->freeblock_unlock = map_freeblock_unlock;
+ // blocklist manipulation
+ iMap->addblock = map_addblock;
+ iMap->delblock = map_delblock;
+ iMap->moveblock = map_moveblock;
+ //blocklist nb in one cell
+ iMap->count_oncell = map_count_oncell;
+ iMap->find_skill_unit_oncell = map_find_skill_unit_oncell;
+ // search and creation
+ iMap->get_new_object_id = map_get_new_object_id;
+ iMap->search_freecell = map_search_freecell;
+ //
+ iMap->quit = map_quit;
+ // npc
+ iMap->addnpc = map_addnpc;
+ // map item
+ iMap->clearflooritem_timer = map_clearflooritem_timer;
+ iMap->removemobs_timer = map_removemobs_timer;
+ iMap->clearflooritem = map_clearflooritem;
+ iMap->addflooritem = map_addflooritem;
+ // player to map session
+ iMap->addnickdb = map_addnickdb;
+ iMap->delnickdb = map_delnickdb;
+ iMap->reqnickdb = map_reqnickdb;
+ iMap->charid2nick = map_charid2nick;
+ iMap->charid2sd = map_charid2sd;
+
+ iMap->id2sd = map_id2sd;
+ iMap->id2md = map_id2md;
+ iMap->id2nd = map_id2nd;
+ iMap->id2hd = map_id2hd;
+ iMap->id2mc = map_id2mc;
+ iMap->id2cd = map_id2cd;
+ iMap->id2bl = map_id2bl;
+ iMap->blid_exists = map_blid_exists;
+ iMap->mapindex2mapid = map_mapindex2mapid;
+ iMap->mapname2mapid = map_mapname2mapid;
+ iMap->mapname2ipport = map_mapname2ipport;
+ iMap->setipport = map_setipport;
+ iMap->eraseipport = map_eraseipport;
+ iMap->eraseallipport = map_eraseallipport;
+ iMap->addiddb = map_addiddb;
+ iMap->deliddb = map_deliddb;
+ /* */
+ iMap->nick2sd = map_nick2sd;
+ iMap->getmob_boss = map_getmob_boss;
+ iMap->id2boss = map_id2boss;
+ // reload config file looking only for npcs
+ iMap->reloadnpc = map_reloadnpc;
+
+ iMap->check_dir = map_check_dir;
+ iMap->calc_dir = map_calc_dir;
+ iMap->random_dir = map_random_dir; // [Skotlex]
+
+ iMap->cleanup_sub = cleanup_sub;
+
+ iMap->delmap = map_delmap;
+ iMap->flags_init = map_flags_init;
+
+ iMap->iwall_set = map_iwall_set;
+ iMap->iwall_get = map_iwall_get;
+ iMap->iwall_remove = map_iwall_remove;
+
+ iMap->addmobtolist = map_addmobtolist; // [Wizputer]
+ iMap->spawnmobs = map_spawnmobs; // [Wizputer]
+ iMap->removemobs = map_removemobs; // [Wizputer]
+ iMap->addmap2db = map_addmap2db;
+ iMap->removemapdb = map_removemapdb;
+ iMap->clean = map_clean;
+
+ iMap->do_shutdown = do_shutdown;
+
+ iMap->map_foreachpc = map_map_foreachpc;
+ iMap->map_foreachmob = map_map_foreachmob;
+ iMap->map_foreachnpc = map_map_foreachnpc;
+ iMap->map_foreachregen = map_map_foreachregen;
+ iMap->map_foreachiddb = map_map_foreachiddb;
+
+ iMap->foreachinrange = iMap->foreachinrange;
+ iMap->foreachinshootrange = map_foreachinshootrange;
+ iMap->foreachinarea=map_foreachinarea;
+ iMap->forcountinrange=map_forcountinrange;
+ iMap->forcountinarea=map_forcountinarea;
+ iMap->foreachinmovearea = map_foreachinmovearea;
+ iMap->foreachincell=map_foreachincell;
+ iMap->foreachinpath=map_foreachinpath;
+ iMap->foreachinmap=map_foreachinmap;
+ iMap->foreachininstance=map_foreachininstance;
+
+ /* temporary until the map.c "Hercules Renewal Phase One" design is complete. [Ind] */
+ mapit = &mapit_s;
+
+ mapit->alloc = mapit_alloc;
+ mapit->free = mapit_free;
+ mapit->first = mapit_first;
+ mapit->last = mapit_last;
+ mapit->next = mapit_next;
+ mapit->prev = mapit_prev;
+ mapit->exists = mapit_exists;
+}
diff --git a/src/map/map.h b/src/map/map.h
index a7bcb08db..9126f39a7 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1,89 +1,74 @@
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-
#ifndef _MAP_H_
#define _MAP_H_
-
#include "../common/cbasetypes.h"
#include "../common/core.h" // CORE_ST_LAST
#include "../common/mmo.h"
#include "../common/mapindex.h"
#include "../common/db.h"
-
#include "../config/core.h"
-
#include "atcommand.h"
-
#include <stdarg.h>
-
struct npc_data;
struct item_data;
struct hChSysCh;
-
enum E_MAPSERVER_ST {
MAPSERVER_ST_RUNNING = CORE_ST_LAST,
MAPSERVER_ST_SHUTDOWN,
MAPSERVER_ST_LAST
};
-
-
#define MAX_NPC_PER_MAP 512
#define AREA_SIZE battle_config.area_size
#define DAMAGELOG_SIZE 30
#define LOOTITEM_SIZE 10
-#define MAX_MOBSKILL 50 //Max 128, see mob skill_idx type if need this higher
-#define MAX_MOB_LIST_PER_MAP 128
+#define MAX_MOBSKILL 50
+#define MAX_MOB_LIST_PER_MAP 100
#define MAX_EVENTQUEUE 2
#define MAX_EVENTTIMER 32
#define NATURAL_HEAL_INTERVAL 500
#define MIN_FLOORITEM 2
#define MAX_FLOORITEM START_ACCOUNT_NUM
#define MAX_LEVEL 150
-#define MAX_DROP_PER_MAP 48
#define MAX_IGNORE_LIST 20 // official is 14
#define MAX_VENDING 12
#define MAX_MAP_SIZE 512*512 // Wasn't there something like this already? Can't find it.. [Shinryo]
-
// Added definitions for WoESE objects. [L0ne_W0lf]
enum MOBID {
- MOBID_EMPERIUM = 1288,
- MOBID_TREAS01 = 1324,
- MOBID_TREAS40 = 1363,
- MOBID_BARRICADE1 = 1905,
- MOBID_BARRICADE2,
- MOBID_GUARIDAN_STONE1,
- MOBID_GUARIDAN_STONE2,
- MOBID_FOOD_STOR,
- MOBID_BLUE_CRYST = 1914,
- MOBID_PINK_CRYST,
- MOBID_TREAS41 = 1938,
- MOBID_TREAS49 = 1946,
- MOBID_SILVERSNIPER = 2042,
- MOBID_MAGICDECOY_WIND = 2046,
+ MOBID_EMPERIUM = 1288,
+ MOBID_TREAS01 = 1324,
+ MOBID_TREAS40 = 1363,
+ MOBID_BARRICADE1 = 1905,
+ MOBID_BARRICADE2,
+ MOBID_GUARIDAN_STONE1,
+ MOBID_GUARIDAN_STONE2,
+ MOBID_FOOD_STOR,
+ MOBID_BLUE_CRYST = 1914,
+ MOBID_PINK_CRYST,
+ MOBID_TREAS41 = 1938,
+ MOBID_TREAS49 = 1946,
+ MOBID_SILVERSNIPER = 2042,
+ MOBID_MAGICDECOY_WIND = 2046,
};
-
-//The following system marks a different job ID system used by the map server,
-//which makes a lot more sense than the normal one. [Skotlex]
-//
-//These marks the "level" of the job.
+// The following system marks a different job ID system used by the map server,
+// which makes a lot more sense than the normal one. [Skotlex]
+// These marks the "level" of the job.
#define JOBL_2_1 0x100 //256
#define JOBL_2_2 0x200 //512
#define JOBL_2 0x300
-
#define JOBL_UPPER 0x1000 //4096
#define JOBL_BABY 0x2000 //8192
#define JOBL_THIRD 0x4000 //16384
-
-//for filtering and quick checking.
+// For filtering and quick checking.
#define MAPID_BASEMASK 0x00ff
#define MAPID_UPPERMASK 0x0fff
#define MAPID_THIRDMASK (JOBL_THIRD|MAPID_UPPERMASK)
//First Jobs
//Note the oddity of the novice:
-//Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type, too...
+//Super Novices are considered the 2-1 version of the novice! Novices are considered a first class type.
enum {
-//Novice And 1-1 Jobs
+ //Novice And 1-1 Jobs
MAPID_NOVICE = 0x0,
MAPID_SWORDMAN,
MAPID_MAGE,
@@ -98,7 +83,7 @@ enum {
MAPID_XMAS,
MAPID_SUMMER,
MAPID_GANGSI,
-//2-1 Jobs
+ //2-1 Jobs
MAPID_SUPER_NOVICE = JOBL_2_1|0x0,
MAPID_KNIGHT,
MAPID_WIZARD,
@@ -109,7 +94,7 @@ enum {
MAPID_STAR_GLADIATOR,
MAPID_KAGEROUOBORO = JOBL_2_1|0x0A,
MAPID_DEATH_KNIGHT = JOBL_2_1|0x0E,
-//2-2 Jobs
+ //2-2 Jobs
MAPID_CRUSADER = JOBL_2_2|0x1,
MAPID_SAGE,
MAPID_BARDDANCER,
@@ -118,7 +103,7 @@ enum {
MAPID_ROGUE,
MAPID_SOUL_LINKER,
MAPID_DARK_COLLECTOR = JOBL_2_2|0x0D,
-//Trans Novice And Trans 1-1 Jobs
+ //Trans Novice And Trans 1-1 Jobs
MAPID_NOVICE_HIGH = JOBL_UPPER|0x0,
MAPID_SWORDMAN_HIGH,
MAPID_MAGE_HIGH,
@@ -126,21 +111,21 @@ enum {
MAPID_ACOLYTE_HIGH,
MAPID_MERCHANT_HIGH,
MAPID_THIEF_HIGH,
-//Trans 2-1 Jobs
+ //Trans 2-1 Jobs
MAPID_LORD_KNIGHT = JOBL_UPPER|JOBL_2_1|0x1,
MAPID_HIGH_WIZARD,
MAPID_SNIPER,
MAPID_HIGH_PRIEST,
MAPID_WHITESMITH,
MAPID_ASSASSIN_CROSS,
-//Trans 2-2 Jobs
+ //Trans 2-2 Jobs
MAPID_PALADIN = JOBL_UPPER|JOBL_2_2|0x1,
MAPID_PROFESSOR,
MAPID_CLOWNGYPSY,
MAPID_CHAMPION,
MAPID_CREATOR,
MAPID_STALKER,
-//Baby Novice And Baby 1-1 Jobs
+ //Baby Novice And Baby 1-1 Jobs
MAPID_BABY = JOBL_BABY|0x0,
MAPID_BABY_SWORDMAN,
MAPID_BABY_MAGE,
@@ -148,7 +133,7 @@ enum {
MAPID_BABY_ACOLYTE,
MAPID_BABY_MERCHANT,
MAPID_BABY_THIEF,
-//Baby 2-1 Jobs
+ //Baby 2-1 Jobs
MAPID_SUPER_BABY = JOBL_BABY|JOBL_2_1|0x0,
MAPID_BABY_KNIGHT,
MAPID_BABY_WIZARD,
@@ -156,14 +141,14 @@ enum {
MAPID_BABY_PRIEST,
MAPID_BABY_BLACKSMITH,
MAPID_BABY_ASSASSIN,
-//Baby 2-2 Jobs
+ //Baby 2-2 Jobs
MAPID_BABY_CRUSADER = JOBL_BABY|JOBL_2_2|0x1,
MAPID_BABY_SAGE,
MAPID_BABY_BARDDANCER,
MAPID_BABY_MONK,
MAPID_BABY_ALCHEMIST,
MAPID_BABY_ROGUE,
-//3-1 Jobs
+ //3-1 Jobs
MAPID_SUPER_NOVICE_E = JOBL_THIRD|JOBL_2_1|0x0,
MAPID_RUNE_KNIGHT,
MAPID_WARLOCK,
@@ -171,28 +156,28 @@ enum {
MAPID_ARCH_BISHOP,
MAPID_MECHANIC,
MAPID_GUILLOTINE_CROSS,
-//3-2 Jobs
+ //3-2 Jobs
MAPID_ROYAL_GUARD = JOBL_THIRD|JOBL_2_2|0x1,
MAPID_SORCERER,
MAPID_MINSTRELWANDERER,
MAPID_SURA,
MAPID_GENETIC,
MAPID_SHADOW_CHASER,
-//Trans 3-1 Jobs
+ //Trans 3-1 Jobs
MAPID_RUNE_KNIGHT_T = JOBL_THIRD|JOBL_UPPER|JOBL_2_1|0x1,
MAPID_WARLOCK_T,
MAPID_RANGER_T,
MAPID_ARCH_BISHOP_T,
MAPID_MECHANIC_T,
MAPID_GUILLOTINE_CROSS_T,
-//Trans 3-2 Jobs
+ //Trans 3-2 Jobs
MAPID_ROYAL_GUARD_T = JOBL_THIRD|JOBL_UPPER|JOBL_2_2|0x1,
MAPID_SORCERER_T,
MAPID_MINSTRELWANDERER_T,
MAPID_SURA_T,
MAPID_GENETIC_T,
MAPID_SHADOW_CHASER_T,
-//Baby 3-1 Jobs
+ //Baby 3-1 Jobs
MAPID_SUPER_BABY_E = JOBL_THIRD|JOBL_BABY|JOBL_2_1|0x0,
MAPID_BABY_RUNE,
MAPID_BABY_WARLOCK,
@@ -200,7 +185,7 @@ enum {
MAPID_BABY_BISHOP,
MAPID_BABY_MECHANIC,
MAPID_BABY_CROSS,
-//Baby 3-2 Jobs
+ //Baby 3-2 Jobs
MAPID_BABY_GUARD = JOBL_THIRD|JOBL_BABY|JOBL_2_2|0x1,
MAPID_BABY_SORCERER,
MAPID_BABY_MINSTRELWANDERER,
@@ -208,32 +193,29 @@ enum {
MAPID_BABY_GENETIC,
MAPID_BABY_CHASER,
};
-
-//Max size for inputs to Graffiti, Talkie Box and Vending text prompts
+// Max size for inputs to Graffiti, Talkie Box and Vending text prompts
#define MESSAGE_SIZE (79 + 1)
-//String length you can write in the 'talking box'
+// String length you can write in the 'talking box'
#define CHATBOX_SIZE (70 + 1)
-//Chatroom-related string sizes
+// Chatroom-related string sizes
#define CHATROOM_TITLE_SIZE (36 + 1)
#define CHATROOM_PASS_SIZE (8 + 1)
-//Max allowed chat text length
+// Max allowed chat text length
#define CHAT_SIZE_MAX (255 + 1)
-//24 for npc name + 24 for label + 2 for a "::" and 1 for EOS
+// 24 for npc name + 24 for label + 2 for a "::" and 1 for EOS
#define EVENT_NAME_LENGTH ( NAME_LENGTH * 2 + 3 )
-
#define DEFAULT_AUTOSAVE_INTERVAL 5*60*1000
-
-//Specifies maps where players may hit each other
-#define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || ((agit_flag || agit2_flag) && map[m].flag.gvg_castle) || map[m].flag.battleground)
-//Specifies maps that have special GvG/WoE restrictions
-#define map_flag_gvg(m) (map[m].flag.gvg || ((agit_flag || agit2_flag) && map[m].flag.gvg_castle))
-//Specifies if the map is tagged as GvG/WoE (regardless of agit_flag status)
+// Specifies maps where players may hit each other
+#define map_flag_vs(m) (map[m].flag.pvp || map[m].flag.gvg_dungeon || map[m].flag.gvg || ((iMap->agit_flag || iMap->agit2_flag) && map[m].flag.gvg_castle) || map[m].flag.battleground)
+// Specifies maps that have special GvG/WoE restrictions
+#define map_flag_gvg(m) (map[m].flag.gvg || ((iMap->agit_flag || iMap->agit2_flag) && map[m].flag.gvg_castle))
+// Specifies if the map is tagged as GvG/WoE (regardless of iMap->agit_flag status)
#define map_flag_gvg2(m) (map[m].flag.gvg || map[m].flag.gvg_castle)
// No Kill Steal Protection
#define map_flag_ks(m) (map[m].flag.town || map[m].flag.pvp || map[m].flag.gvg || map[m].flag.battleground)
//This stackable implementation does not means a BL can be more than one type at a time, but it's
-//meant to make it easier to check for multiple types at a time on invocations such as map_foreach* calls [Skotlex]
+// meant to make it easier to check for multiple types at a time on invocations such as map_foreach* calls [Skotlex]
enum bl_type {
BL_NUL = 0x000,
BL_PC = 0x001,
@@ -250,7 +232,7 @@ enum bl_type {
BL_ALL = 0xFFF,
};
-//For common mapforeach calls. Since pets cannot be affected, they aren't included here yet.
+// For common mapforeach calls. Since pets cannot be affected, they aren't included here yet.
#define BL_CHAR (BL_PC|BL_MOB|BL_HOM|BL_MER|BL_ELEM)
enum npc_subtype { WARP, SHOP, SCRIPT, CASHSHOP, TOMB };
@@ -328,8 +310,8 @@ struct spawn_data {
struct {
unsigned int size : 2; //Holds if mob has to be tiny/large
unsigned int ai : 4; //Special ai for summoned monsters.
- //0: Normal mob | 1: Standard summon, attacks mobs
- //2: Alchemist Marine Sphere | 3: Alchemist Summon Flora | 4: Summon Zanzou
+ //0: Normal mob | 1: Standard summon, attacks mobs
+ //2: Alchemist Marine Sphere | 3: Alchemist Summon Flora | 4: Summon Zanzou
unsigned int dynamic : 1; //Whether this data is indexed by a map's dynamic mob list
unsigned int boss : 1; //0: Non-boss monster | 1: Boss monster
} state;
@@ -443,7 +425,7 @@ typedef enum {
} cell_t;
-// used by map_getcell()
+// used by iMap->getcell()
typedef enum {
CELL_GETTYPE, // retrieves a cell's 'gat' type
@@ -471,19 +453,19 @@ struct mapcell
{
// terrain flags
unsigned char
- walkable : 1,
- shootable : 1,
- water : 1;
+walkable : 1,
+shootable : 1,
+water : 1;
// dynamic flags
unsigned char
- npc : 1,
- basilica : 1,
- landprotector : 1,
- novending : 1,
- nochat : 1,
- maelstrom : 1,
- icewall : 1;
+npc : 1,
+basilica : 1,
+landprotector : 1,
+novending : 1,
+nochat : 1,
+maelstrom : 1,
+icewall : 1;
#ifdef CELL_NOSTACK
unsigned char cell_bl; //Holds amount of bls in this cell.
@@ -506,7 +488,7 @@ enum map_zone_skill_subtype {
MZS_NONE = 0x0,
MZS_CLONE = 0x01,
MZS_BOSS = 0x02,
-
+
MZS_ALL = 0xFFF,
};
@@ -549,15 +531,16 @@ struct map_zone_data {
struct map_zone_skill_damage_cap_entry **capped_skills;
int capped_skills_count;
};
-void map_zone_init(void);
-void map_zone_remove(int m);
-void map_zone_apply(int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath);
-void map_zone_change(int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath);
-void map_zone_change2(int m, struct map_zone_data *zone);
struct map_zone_data map_zone_all;/* used as a base on all maps */
struct map_zone_data map_zone_pk;/* used for (pk_mode) */
+struct map_drop_list {
+ int drop_id;
+ int drop_type;
+ int drop_per;
+};
+
struct map_data {
char name[MAP_NAME_LENGTH];
@@ -625,11 +608,8 @@ struct map_data {
} flag;
struct point save;
struct npc_data *npc[MAX_NPC_PER_MAP];
- struct {
- int drop_id;
- int drop_type;
- int drop_per;
- } drop_list[MAX_DROP_PER_MAP];
+ struct map_drop_list *drop_list;
+ unsigned short drop_list_count;
struct spawn_data *moblist[MAX_MOB_LIST_PER_MAP]; // [Wizputer]
int mob_delete_timer; // [Skotlex]
@@ -637,35 +617,35 @@ struct map_data {
int bexp; // map experience multiplicator
int nocommand; //Blocks @/# commands for non-gms. [Skotlex]
/**
- * Ice wall reference counter for bugreport:3574
- * - since there are a thounsand mobs out there in a lot of maps checking on,
- * - every targetting for icewall on attack path would just be a waste, so,
- * - this counter allows icewall checking be only run when there is a actual ice wall on the map
- **/
+ * Ice wall reference counter for bugreport:3574
+ * - since there are a thounsand mobs out there in a lot of maps checking on,
+ * - every targetting for icewall on attack path would just be a waste, so,
+ * - this counter allows icewall checking be only run when there is a actual ice wall on the map
+ **/
int icewall_num;
// Instance Variables
int instance_id;
int instance_src_map;
-
+
/* adjust_unit_duration mapflag */
struct mapflag_skill_adjust **units;
unsigned short unit_count;
/* adjust_skill_damage mapflag */
struct mapflag_skill_adjust **skills;
unsigned short skill_count;
-
+
/* Hercules nocast db overhaul */
struct map_zone_data *zone;
char **zone_mf;/* used to store this map's zone mapflags that should be re-applied once zone is removed */
unsigned short zone_mf_count;
struct map_zone_data *prev_zone;
-
+
/* Hercules Local Chat */
struct hChSysCh *channel;
-
+
/* invincible_time_inc mapflag */
unsigned int invincible_time_inc;
-
+
/* weapon_damage_rate mapflag */
unsigned short weapon_damage_rate;
/* magic_damage_rate mapflag */
@@ -676,6 +656,14 @@ struct map_data {
unsigned short short_damage_rate;
/* long_damage_rate mapflag */
unsigned short long_damage_rate;
+
+ /* instance unique name */
+ char *cName;
+
+ /* */
+ int (*getcellp)(struct map_data* m,int16 x,int16 y,cell_chk cellchk);
+ void (*setcell) (int16 m, int16 x, int16 y, cell_t cell, bool flag);
+ char *cellPos;
};
/// Stores information about a remote map (for multi-mapserver setups).
@@ -688,112 +676,35 @@ struct map_data_other_server {
uint16 port;
};
-int map_getcell(int16 m,int16 x,int16 y,cell_chk cellchk);
-int map_getcellp(struct map_data* m,int16 x,int16 y,cell_chk cellchk);
-void map_setcell(int16 m, int16 x, int16 y, cell_t cell, bool flag);
-void map_setgatcell(int16 m, int16 x, int16 y, int gat);
struct map_data *map;
-extern int map_num;
-
-extern int autosave_interval;
-extern int minsave_interval;
-extern int save_settings;
-extern int agit_flag;
-extern int agit2_flag;
-extern int night_flag; // 0=day, 1=night [Yor]
-extern int enable_spy; //Determines if @spy commands are active.
-extern char db_path[256];
-
-extern char motd_txt[];
-extern char help_txt[];
-extern char help2_txt[];
-extern char charhelp_txt[];
-
-extern char wisp_server_name[];
-
-// users
-void map_setusers(int);
-int map_getusers(void);
-int map_usercount(void);
-
-// blocklist lock
-int map_freeblock(struct block_list *bl);
-int map_freeblock_lock(void);
-int map_freeblock_unlock(void);
-// blocklist manipulation
-int map_addblock(struct block_list* bl);
-int map_delblock(struct block_list* bl);
-int map_moveblock(struct block_list *, int, int, unsigned int);
-int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
-int map_foreachinshootrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
-int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, ...);
-int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int count, int type, ...);
-int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, ...);
-int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, ...);
-int map_foreachincell(int (*func)(struct block_list*,va_list), int16 m, int16 x, int16 y, int type, ...);
-int map_foreachinpath(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int16 range, int length, int type, ...);
-int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type, ...);
-//blocklist nb in one cell
-int map_count_oncell(int16 m,int16 x,int16 y,int type);
-struct skill_unit *map_find_skill_unit_oncell(struct block_list *,int16 x,int16 y,uint16 skill_id,struct skill_unit *, int flag);
-// search and creation
-int map_get_new_object_id(void);
-int map_search_freecell(struct block_list *src, int16 m, int16 *x, int16 *y, int16 rx, int16 ry, int flag);
+
+
+
+
+
+
+//int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
+//int map_foreachinshootrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
+//int map_foreachinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, ...);
+//int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int count, int type, ...);
+//int map_forcountinarea(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, ...);
+//int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, ...);
+//int map_foreachincell(int (*func)(struct block_list*,va_list), int16 m, int16 x, int16 y, int type, ...);
+//int map_foreachinpath(int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int16 range, int length, int type, ...);
+//int map_foreachinmap(int (*func)(struct block_list*,va_list), int16 m, int type, ...);
+//int map_foreachininstance(int (*func)(struct block_list*,va_list), int16 instance_id, int type,...);
//
-int map_quit(struct map_session_data *);
-// npc
-bool map_addnpc(int16 m,struct npc_data *);
-
-// map item
-int map_clearflooritem_timer(int tid, unsigned int tick, int id, intptr_t data);
-int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data);
-void map_clearflooritem(struct block_list* bl);
-int map_addflooritem(struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags);
-
-// player to map session
-void map_addnickdb(int charid, const char* nick);
-void map_delnickdb(int charid, const char* nick);
-void map_reqnickdb(struct map_session_data* sd,int charid);
-const char* map_charid2nick(int charid);
-struct map_session_data* map_charid2sd(int charid);
-
-struct map_session_data * map_id2sd(int id);
-struct mob_data * map_id2md(int id);
-struct npc_data * map_id2nd(int id);
-struct homun_data* map_id2hd(int id);
-struct mercenary_data* map_id2mc(int id);
-struct chat_data* map_id2cd(int id);
-struct block_list * map_id2bl(int id);
-bool map_blid_exists( int id );
+
+
+
#define map_id2index(id) map[(id)].index
-int16 map_mapindex2mapid(unsigned short mapindex);
-int16 map_mapname2mapid(const char* name);
-int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port);
-int map_setipport(unsigned short map, uint32 ip, uint16 port);
-int map_eraseipport(unsigned short map, uint32 ip, uint16 port);
-int map_eraseallipport(void);
-void map_addiddb(struct block_list *);
-void map_deliddb(struct block_list *bl);
-/* temporary until the map.c "Hercules Renewal Phase One" design is complete. */
-void (*map_foreachpc) (int (*func)(struct map_session_data* sd, va_list args), ...);
-void (*map_foreachmob) (int (*func)(struct mob_data* md, va_list args), ...);
-void (*map_foreachnpc) (int (*func)(struct npc_data* nd, va_list args), ...);
-void (*map_foreachregen) (int (*func)(struct block_list* bl, va_list args), ...);
-void (*map_foreachiddb) (int (*func)(struct block_list* bl, va_list args), ...);
-/* */
-struct map_session_data * map_nick2sd(const char*);
-struct mob_data * map_getmob_boss(int16 m);
-struct mob_data * map_id2boss(int id);
-
-// reload config file looking only for npcs
-void map_reloadnpc(bool clear);
/// Bitfield of flags for the iterator.
enum e_mapitflags {
MAPIT_NORMAL = 0,
-// MAPIT_PCISPLAYING = 1,// Unneeded as pc_db/id_db will only hold auth'ed, active players.
+ // MAPIT_PCISPLAYING = 1,// Unneeded as pc_db/id_db will only hold auth'ed, active players.
};
struct s_mapiterator;
/* temporary until the map.c "Hercules Renewal Phase One" design is complete. */
@@ -813,34 +724,11 @@ struct mapit_interface *mapit;
#define mapit_geteachnpc() mapit->alloc(MAPIT_NORMAL,BL_NPC)
#define mapit_geteachiddb() mapit->alloc(MAPIT_NORMAL,BL_ALL)
-int map_check_dir(int s_dir,int t_dir);
-uint8 map_calc_dir( struct block_list *src,int16 x,int16 y);
-int map_random_dir(struct block_list *bl, short *x, short *y); // [Skotlex]
-int cleanup_sub(struct block_list *bl, va_list ap);
-int map_delmap(char* mapname);
-void map_flags_init(void);
-bool map_iwall_set(int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char* wall_name);
-void map_iwall_get(struct map_session_data *sd);
-void map_iwall_remove(const char *wall_name);
-int map_addmobtolist(unsigned short m, struct spawn_data *spawn); // [Wizputer]
-void map_spawnmobs(int16 m); // [Wizputer]
-void map_removemobs(int16 m); // [Wizputer]
-void do_reconnect_map(void); //Invoked on map-char reconnection [Skotlex]
-void map_addmap2db(struct map_data *m);
-void map_removemapdb(struct map_data *m);
-extern char *INTER_CONF_NAME;
-extern char *LOG_CONF_NAME;
-extern char *MAP_CONF_NAME;
-extern char *BATTLE_CONF_FILENAME;
-extern char *ATCOMMAND_CONF_FILENAME;
-extern char *SCRIPT_CONF_NAME;
-extern char *MSG_CONF_NAME;
-extern char *GRF_PATH_FILENAME;
//Useful typedefs from jA [Skotlex]
typedef struct map_session_data TBL_PC;
@@ -859,19 +747,167 @@ typedef struct elemental_data TBL_ELEM;
#include "../common/sql.h"
-extern int db_use_sqldbs;
extern Sql* mmysql_handle;
extern Sql* logmysql_handle;
-extern char item_db_db[32];
-extern char item_db2_db[32];
-extern char item_db_re_db[32];
-extern char mob_db_db[32];
-extern char mob_db2_db[32];
-extern char mob_skill_db_db[32];
-extern char mob_skill_db2_db[32];
-void do_shutdown(void);
+
+/*=====================================
+* Interface : map.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+struct map_interface {
+
+ /* vars */
+ int map_num;
+
+ int autosave_interval;
+ int minsave_interval;
+ int save_settings;
+ int agit_flag;
+ int agit2_flag;
+ int night_flag; // 0=day, 1=night [Yor]
+ int enable_spy; //Determines if @spy commands are active.
+ char db_path[256];
+
+ char help_txt[256];
+ char help2_txt[256];
+ char charhelp_txt[256];
+
+ char wisp_server_name[NAME_LENGTH];
+
+ char *INTER_CONF_NAME;
+ char *LOG_CONF_NAME;
+ char *MAP_CONF_NAME;
+ char *BATTLE_CONF_FILENAME;
+ char *ATCOMMAND_CONF_FILENAME;
+ char *SCRIPT_CONF_NAME;
+ char *MSG_CONF_NAME;
+ char *GRF_PATH_FILENAME;
+
+ int db_use_sqldbs;
+
+ char item_db_db[32];
+ char item_db2_db[32];
+ char item_db_re_db[32];
+ char mob_db_db[32];
+ char mob_db2_db[32];
+ char mob_skill_db_db[32];
+ char mob_skill_db2_db[32];
+
+ /* funcs */
+ void (*zone_init) (void);
+ void (*zone_remove) (int m);
+ void (*zone_apply) (int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath);
+ void (*zone_change) (int m, struct map_zone_data *zone, const char* start, const char* buffer, const char* filepath);
+ void (*zone_change2) (int m, struct map_zone_data *zone);
+
+ int (*getcell) (int16 m,int16 x,int16 y,cell_chk cellchk);
+ void (*setgatcell) (int16 m, int16 x, int16 y, int gat);
+
+ void (*cellfromcache) (struct map_data *m);
+ // users
+ void (*setusers) (int);
+ int (*getusers) (void);
+ int (*usercount) (void);
+ // blocklist lock
+ int (*freeblock) (struct block_list *bl);
+ int (*freeblock_lock) (void);
+ int (*freeblock_unlock) (void);
+ // blocklist manipulation
+ int (*addblock) (struct block_list* bl);
+ int (*delblock) (struct block_list* bl);
+ int (*moveblock) (struct block_list *, int, int, unsigned int);
+ //blocklist nb in one cell
+ int (*count_oncell) (int16 m,int16 x,int16 y,int type);
+ struct skill_unit * (*find_skill_unit_oncell) (struct block_list *,int16 x,int16 y,uint16 skill_id,struct skill_unit *, int flag);
+ // search and creation
+ int (*get_new_object_id) (void);
+ int (*search_freecell) (struct block_list *src, int16 m, int16 *x, int16 *y, int16 rx, int16 ry, int flag);
+ //
+ int (*quit) (struct map_session_data *);
+ // npc
+ bool (*addnpc) (int16 m,struct npc_data *);
+ // map item
+ int (*clearflooritem_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*removemobs_timer) (int tid, unsigned int tick, int id, intptr_t data);
+ void (*clearflooritem) (struct block_list* bl);
+ int (*addflooritem) (struct item *item_data,int amount,int16 m,int16 x,int16 y,int first_charid,int second_charid,int third_charid,int flags);
+ // player to map session
+ void (*addnickdb) (int charid, const char* nick);
+ void (*delnickdb) (int charid, const char* nick);
+ void (*reqnickdb) (struct map_session_data* sd,int charid);
+ const char* (*charid2nick) (int charid);
+ struct map_session_data* (*charid2sd) (int charid);
+
+ void (*map_foreachpc) (int (*func)(struct map_session_data* sd, va_list args), ...);
+ void (*map_foreachmob) (int (*func)(struct mob_data* md, va_list args), ...);
+ void (*map_foreachnpc) (int (*func)(struct npc_data* nd, va_list args), ...);
+ void (*map_foreachregen) (int (*func)(struct block_list* bl, va_list args), ...);
+ void (*map_foreachiddb) (int (*func)(struct block_list* bl, va_list args), ...);
+
+ int (*foreachinrange) (int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
+ int (*foreachinshootrange) (int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int type, ...);
+ int (*foreachinarea) (int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int type, ...);
+ int (*forcountinrange) (int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int count, int type, ...);
+ int (*forcountinarea) (int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int count, int type, ...);
+ int (*foreachinmovearea) (int (*func)(struct block_list*,va_list), struct block_list* center, int16 range, int16 dx, int16 dy, int type, ...);
+ int (*foreachincell) (int (*func)(struct block_list*,va_list), int16 m, int16 x, int16 y, int type, ...);
+ int (*foreachinpath) (int (*func)(struct block_list*,va_list), int16 m, int16 x0, int16 y0, int16 x1, int16 y1, int16 range, int length, int type, ...);
+ int (*foreachinmap) (int (*func)(struct block_list*,va_list), int16 m, int type, ...);
+ int (*foreachininstance)(int (*func)(struct block_list*,va_list), int16 instance_id, int type,...);
+
+ struct map_session_data * (*id2sd) (int id);
+ struct mob_data * (*id2md) (int id);
+ struct npc_data * (*id2nd) (int id);
+ struct homun_data* (*id2hd) (int id);
+ struct mercenary_data* (*id2mc) (int id);
+ struct chat_data* (*id2cd) (int id);
+ struct block_list * (*id2bl) (int id);
+ bool (*blid_exists) (int id);
+ int16 (*mapindex2mapid) (unsigned short mapindex);
+ int16 (*mapname2mapid) (const char* name);
+ int (*mapname2ipport) (unsigned short name, uint32* ip, uint16* port);
+ int (*setipport) (unsigned short map, uint32 ip, uint16 port);
+ int (*eraseipport) (unsigned short map, uint32 ip, uint16 port);
+ int (*eraseallipport) (void);
+ void (*addiddb) (struct block_list *);
+ void (*deliddb) (struct block_list *bl);
+ /* */
+ struct map_session_data * (*nick2sd) (const char*);
+ struct mob_data * (*getmob_boss) (int16 m);
+ struct mob_data * (*id2boss) (int id);
+ // reload config file looking only for npcs
+ void (*reloadnpc) (bool clear);
+
+ int (*check_dir) (int s_dir,int t_dir);
+ uint8 (*calc_dir) (struct block_list *src,int16 x,int16 y);
+ int (*random_dir) (struct block_list *bl, short *x, short *y); // [Skotlex]
+
+ int (*cleanup_sub) (struct block_list *bl, va_list ap);
+
+ int (*delmap) (char* mapname);
+ void (*flags_init) (void);
+
+ bool (*iwall_set) (int16 m, int16 x, int16 y, int size, int8 dir, bool shootable, const char* wall_name);
+ void (*iwall_get) (struct map_session_data *sd);
+ void (*iwall_remove) (const char *wall_name);
+
+ int (*addmobtolist) (unsigned short m, struct spawn_data *spawn); // [Wizputer]
+ void (*spawnmobs) (int16 m); // [Wizputer]
+ void (*removemobs) (int16 m); // [Wizputer]
+ void (*do_reconnect_map) (void); //Invoked on map-char reconnection [Skotlex] Note used but still keeping it, just in case
+ void (*addmap2db) (struct map_data *m);
+ void (*removemapdb) (struct map_data *m);
+ void (*clean) (int i);
+
+ void (*do_shutdown) (void);
+} iMap_s;
+
+struct map_interface *iMap;
+
+void map_defaults(void);
#endif /* _MAP_H_ */
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c
index 484da5641..a42ec04f2 100644
--- a/src/map/mapreg_sql.c
+++ b/src/map/mapreg_sql.c
@@ -302,8 +302,8 @@ void mapreg_init(void) {
script_load_mapreg();
- add_timer_func_list(script_autosave_mapreg, "script_autosave_mapreg");
- add_timer_interval(gettick() + MAPREG_AUTOSAVE_INTERVAL, script_autosave_mapreg, 0, 0, MAPREG_AUTOSAVE_INTERVAL);
+ iTimer->add_timer_func_list(script_autosave_mapreg, "script_autosave_mapreg");
+ iTimer->add_timer_interval(iTimer->gettick() + MAPREG_AUTOSAVE_INTERVAL, script_autosave_mapreg, 0, 0, MAPREG_AUTOSAVE_INTERVAL);
}
bool mapreg_config_read(const char* w1, const char* w2) {
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 02fcea891..91d685a49 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -93,8 +93,8 @@ int mercenary_get_lifetime(struct mercenary_data *md)
if( md == NULL || md->contract_timer == INVALID_TIMER )
return 0;
- td = get_timer(md->contract_timer);
- return (td != NULL) ? DIFF_TICK(td->tick, gettick()) : 0;
+ td = iTimer->get_timer(md->contract_timer);
+ return (td != NULL) ? DIFF_TICK(td->tick, iTimer->gettick()) : 0;
}
int mercenary_get_guild(struct mercenary_data *md)
@@ -222,7 +222,7 @@ static int merc_contract_end(int tid, unsigned int tick, int id, intptr_t data)
struct map_session_data *sd;
struct mercenary_data *md;
- if( (sd = map_id2sd(id)) == NULL )
+ if( (sd = iMap->id2sd(id)) == NULL )
return 1;
if( (md = sd->md) == NULL )
return 1;
@@ -269,14 +269,14 @@ void merc_contract_stop(struct mercenary_data *md)
{
nullpo_retv(md);
if( md->contract_timer != INVALID_TIMER )
- delete_timer(md->contract_timer, merc_contract_end);
+ iTimer->delete_timer(md->contract_timer, merc_contract_end);
md->contract_timer = INVALID_TIMER;
}
void merc_contract_init(struct mercenary_data *md)
{
if( md->contract_timer == INVALID_TIMER )
- md->contract_timer = add_timer(gettick() + md->mercenary.life_time, merc_contract_end, md->master->bl.id, 0);
+ md->contract_timer = iTimer->add_timer(iTimer->gettick() + md->mercenary.life_time, merc_contract_end, md->master->bl.id, 0);
md->regen.state.block = 0;
}
@@ -288,7 +288,7 @@ int merc_data_received(struct s_mercenary *merc, bool flag)
struct s_mercenary_db *db;
int i = merc_search_index(merc->class_);
- if( (sd = map_charid2sd(merc->char_id)) == NULL )
+ if( (sd = iMap->charid2sd(merc->char_id)) == NULL )
return 0;
if( !flag || i < 0 )
{ // Not created - loaded - DB info
@@ -319,7 +319,7 @@ int merc_data_received(struct s_mercenary *merc, bool flag)
md->bl.x = md->ud.to_x;
md->bl.y = md->ud.to_y;
- map_addiddb(&md->bl);
+ iMap->addiddb(&md->bl);
status_calc_mercenary(md,1);
md->contract_timer = INVALID_TIMER;
merc_contract_init(md);
@@ -336,7 +336,7 @@ int merc_data_received(struct s_mercenary *merc, bool flag)
if( md && md->bl.prev == NULL && sd->bl.prev != NULL )
{
- map_addblock(&md->bl);
+ iMap->addblock(&md->bl);
clif->spawn(&md->bl);
clif->mercenary_info(sd);
clif->mercenary_skillblock(sd);
@@ -456,7 +456,7 @@ static bool read_mercenarydb_sub(char* str[], int columns, int current)
int read_mercenarydb(void)
{
memset(mercenary_db,0,sizeof(mercenary_db));
- sv->readdb(db_path, "mercenary_db.txt", ',', 26, 26, MAX_MERCENARY_CLASS, &read_mercenarydb_sub);
+ sv->readdb(iMap->db_path, "mercenary_db.txt", ',', 26, 26, MAX_MERCENARY_CLASS, &read_mercenarydb_sub);
return 0;
}
@@ -494,7 +494,7 @@ static bool read_mercenary_skilldb_sub(char* str[], int columns, int current)
int read_mercenary_skilldb(void)
{
- sv->readdb(db_path, "mercenary_skill_db.txt", ',', 3, 3, -1, &read_mercenary_skilldb_sub);
+ sv->readdb(iMap->db_path, "mercenary_skill_db.txt", ',', 3, 3, -1, &read_mercenary_skilldb_sub);
return 0;
}
diff --git a/src/map/mob.c b/src/map/mob.c
index 57325ba1c..629a79e7f 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -137,7 +137,7 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
nd->bl.id = md->tomb_nid = npc_get_new_npc_id();
- nd->ud.dir = md->ud.dir;
+ nd->dir = md->ud.dir;
nd->bl.m = md->bl.m;
nd->bl.x = md->bl.x;
nd->bl.y = md->bl.y;
@@ -157,11 +157,9 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
else
nd->u.tomb.killer_name[0] = '\0';
- map_addnpc(nd->bl.m, nd);
- map_addblock(&nd->bl);
+ iMap->addnpc(nd->bl.m, nd);
+ iMap->addblock(&nd->bl);
status_set_viewdata(&nd->bl, nd->class_);
- status_change_init(&nd->bl);
- unit_dataset(&nd->bl);
clif->spawn(&nd->bl);
}
@@ -169,14 +167,14 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time)
void mvptomb_destroy(struct mob_data *md) {
struct npc_data *nd;
- if ( (nd = map_id2nd(md->tomb_nid)) ) {
+ if ( (nd = iMap->id2nd(md->tomb_nid)) ) {
int16 m, i;
m = nd->bl.m;
clif->clearunit_area(&nd->bl,CLR_OUTSIGHT);
- map_delblock(&nd->bl);
+ iMap->delblock(&nd->bl);
ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == nd );
if( !(i == map[m].npc_num) ) {
@@ -185,7 +183,7 @@ void mvptomb_destroy(struct mob_data *md) {
map[m].npc[map[m].npc_num] = NULL;
}
- map_deliddb(&nd->bl);
+ iMap->deliddb(&nd->bl);
aFree(nd);
}
@@ -262,8 +260,7 @@ int mob_parse_dataset(struct spawn_data *data)
/*==========================================
* Generates the basic mob data using the spawn_data provided.
*------------------------------------------*/
-struct mob_data* mob_spawn_dataset(struct spawn_data *data)
-{
+struct mob_data* mob_spawn_dataset(struct spawn_data *data) {
struct mob_data *md = (struct mob_data*)aCalloc(1, sizeof(struct mob_data));
md->bl.id= npc_get_new_npc_id();
md->bl.type = BL_MOB;
@@ -290,8 +287,8 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data)
status_set_viewdata(&md->bl, md->class_);
status_change_init(&md->bl);
unit_dataset(&md->bl);
-
- map_addiddb(&md->bl);
+
+ iMap->addiddb(&md->bl);
return md;
}
@@ -347,7 +344,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
*t_sd; // Mob Target
struct status_change_entry *sce;
struct mob_data *md;
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
char output[128];
if( !battle_config.ksprotection )
@@ -362,7 +359,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
if( !(sd = BL_CAST(BL_PC,s_bl)) )
return false; // Master is not PC
- t_bl = map_id2bl(md->target_id);
+ t_bl = iMap->id2bl(md->target_id);
if( !t_bl || (s_bl = battle->get_master(t_bl)) == NULL )
s_bl = t_bl;
@@ -389,7 +386,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target)
(sce->val2 == 3 && sce->val4 && sce->val4 != t_sd->status.guild_id)) )
break;
- if( (pl_sd = map_id2sd(sce->val1)) == NULL || pl_sd->bl.m != md->bl.m )
+ if( (pl_sd = iMap->id2sd(sce->val1)) == NULL || pl_sd->bl.m != md->bl.m )
break;
if( !pl_sd->state.noks )
@@ -445,11 +442,11 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int16 m, int16 x, int
// Locate spot next to player.
if (bl && (x < 0 || y < 0))
- map_search_freecell(bl, m, &x, &y, 1, 1, 0);
+ iMap->search_freecell(bl, m, &x, &y, 1, 1, 0);
// if none found, pick random position on map
- if (x <= 0 || y <= 0 || map_getcell(m,x,y,CELL_CHKNOREACH))
- map_search_freecell(NULL, m, &x, &y, -1, -1, 1);
+ if (x <= 0 || y <= 0 || iMap->getcell(m,x,y,CELL_CHKNOREACH))
+ iMap->search_freecell(NULL, m, &x, &y, -1, -1, 1);
data.x = x;
data.y = y;
@@ -497,7 +494,7 @@ int mob_once_spawn(struct map_session_data* sd, int16 m, int16 x, int16 y, const
memcpy(md->guardian_data->guild_name, g->name, NAME_LENGTH);
}
else if (gc->guild_id) //Guild not yet available, retry in 5.
- add_timer(gettick()+5000,mob_spawn_guardian_sub,md->bl.id,md->guardian_data->guild_id);
+ iTimer->add_timer(iTimer->gettick()+5000,mob_spawn_guardian_sub,md->bl.id,md->guardian_data->guild_id);
}
} // end addition [Valaris]
@@ -545,7 +542,7 @@ int mob_once_spawn_area(struct map_session_data* sd, int16 m, int16 x0, int16 y0
x = rnd()%(x1-x0+1)+x0;
y = rnd()%(y1-y0+1)+y0;
j++;
- } while (map_getcell(m,x,y,CELL_CHKNOPASS) && j < max);
+ } while (iMap->getcell(m,x,y,CELL_CHKNOPASS) && j < max);
if (j == max)
{// attempt to find an available cell failed
@@ -571,7 +568,7 @@ int mob_once_spawn_area(struct map_session_data* sd, int16 m, int16 x0, int16 y0
*------------------------------------------*/
static int mob_spawn_guardian_sub(int tid, unsigned int tick, int id, intptr_t data)
{ //Needed because the guild_data may not be available at guardian spawn time.
- struct block_list* bl = map_id2bl(id);
+ struct block_list* bl = iMap->id2bl(id);
struct mob_data* md;
struct guild* g;
int guardup_lv;
@@ -629,7 +626,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
memset(&data, 0, sizeof(struct spawn_data));
data.num = 1;
- m=map_mapname2mapid(mapname);
+ m=iMap->mapname2mapid(mapname);
if(m<0)
{
@@ -655,7 +652,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
return 0;
}
- if((x<=0 || y<=0) && !map_search_freecell(NULL, m, &x, &y, -1,-1, 1))
+ if((x<=0 || y<=0) && !iMap->search_freecell(NULL, m, &x, &y, -1,-1, 1))
{
ShowWarning("mob_spawn_guardian: Couldn't locate a spawn cell for guardian class %d (index %d) at castle map %s\n",class_, guardian, map[m].name);
return 0;
@@ -680,7 +677,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
if( has_index && gc->guardian[guardian].id )
{ //Check if guardian already exists, refuse to spawn if so.
- struct mob_data *md2 = (TBL_MOB*)map_id2bl(gc->guardian[guardian].id);
+ struct mob_data *md2 = (TBL_MOB*)iMap->id2bl(gc->guardian[guardian].id);
if (md2 && md2->bl.type == BL_MOB &&
md2->guardian_data && md2->guardian_data->number == guardian)
{
@@ -715,7 +712,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam
memcpy (md->guardian_data->guild_name, g->name, NAME_LENGTH);
md->guardian_data->guardup_lv = guild->checkskill(g,GD_GUARDUP);
} else if (md->guardian_data->guild_id)
- add_timer(gettick()+5000,mob_spawn_guardian_sub,md->bl.id,md->guardian_data->guild_id);
+ iTimer->add_timer(iTimer->gettick()+5000,mob_spawn_guardian_sub,md->bl.id,md->guardian_data->guild_id);
mob_spawn(md);
return md->bl.id;
@@ -730,7 +727,7 @@ int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int
struct spawn_data data;
int16 m;
- if( (m = map_mapname2mapid(mapname)) < 0 )
+ if( (m = iMap->mapname2mapid(mapname)) < 0 )
{
ShowWarning("mob_spawn_bg: Map [%s] not found.\n", mapname);
return 0;
@@ -746,7 +743,7 @@ int mob_spawn_bg(const char* mapname, short x, short y, const char* mobname, int
}
data.class_ = class_;
- if( (x <= 0 || y <= 0) && !map_search_freecell(NULL, m, &x, &y, -1,-1, 1) )
+ if( (x <= 0 || y <= 0) && !iMap->search_freecell(NULL, m, &x, &y, -1,-1, 1) )
{
ShowWarning("mob_spawn_bg: Couldn't locate a spawn cell for guardian class %d (bg_id %d) at map %s\n",class_, bg_id, map[m].name);
return 0;
@@ -827,7 +824,7 @@ int mob_linksearch(struct block_list *bl,va_list ap)
*------------------------------------------*/
int mob_delayspawn(int tid, unsigned int tick, int id, intptr_t data)
{
- struct block_list* bl = map_id2bl(id);
+ struct block_list* bl = iMap->id2bl(id);
struct mob_data* md = BL_CAST(BL_MOB, bl);
if( md )
@@ -879,8 +876,8 @@ int mob_setdelayspawn(struct mob_data *md)
spawntime = 5000;
if( md->spawn_timer != INVALID_TIMER )
- delete_timer(md->spawn_timer, mob_delayspawn);
- md->spawn_timer = add_timer(gettick()+spawntime, mob_delayspawn, md->bl.id, 0);
+ iTimer->delete_timer(md->spawn_timer, mob_delayspawn);
+ md->spawn_timer = iTimer->add_timer(iTimer->gettick()+spawntime, mob_delayspawn, md->bl.id, 0);
return 0;
}
@@ -901,7 +898,7 @@ int mob_count_sub(struct block_list *bl, va_list ap) {
int mob_spawn (struct mob_data *md)
{
int i=0;
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
int c =0;
md->last_thinktime = tick;
@@ -923,19 +920,19 @@ int mob_spawn (struct mob_data *md)
if( (md->bl.x == 0 && md->bl.y == 0) || md->spawn->xs || md->spawn->ys )
{ //Monster can be spawned on an area.
- if( !map_search_freecell(&md->bl, -1, &md->bl.x, &md->bl.y, md->spawn->xs, md->spawn->ys, battle_config.no_spawn_on_player?4:0) )
+ if( !iMap->search_freecell(&md->bl, -1, &md->bl.x, &md->bl.y, md->spawn->xs, md->spawn->ys, battle_config.no_spawn_on_player?4:0) )
{ // retry again later
if( md->spawn_timer != INVALID_TIMER )
- delete_timer(md->spawn_timer, mob_delayspawn);
- md->spawn_timer = add_timer(tick+5000,mob_delayspawn,md->bl.id,0);
+ iTimer->delete_timer(md->spawn_timer, mob_delayspawn);
+ md->spawn_timer = iTimer->add_timer(tick+5000,mob_delayspawn,md->bl.id,0);
return 1;
}
}
- else if( battle_config.no_spawn_on_player > 99 && map_foreachinrange(mob_count_sub, &md->bl, AREA_SIZE, BL_PC) )
+ else if( battle_config.no_spawn_on_player > 99 && iMap->foreachinrange(mob_count_sub, &md->bl, AREA_SIZE, BL_PC) )
{ // retry again later (players on sight)
if( md->spawn_timer != INVALID_TIMER )
- delete_timer(md->spawn_timer, mob_delayspawn);
- md->spawn_timer = add_timer(tick+5000,mob_delayspawn,md->bl.id,0);
+ iTimer->delete_timer(md->spawn_timer, mob_delayspawn);
+ md->spawn_timer = iTimer->add_timer(tick+5000,mob_delayspawn,md->bl.id,0);
return 1;
}
}
@@ -949,7 +946,7 @@ int mob_spawn (struct mob_data *md)
md->ud.target_to = 0;
if( md->spawn_timer != INVALID_TIMER )
{
- delete_timer(md->spawn_timer, mob_delayspawn);
+ iTimer->delete_timer(md->spawn_timer, mob_delayspawn);
md->spawn_timer = INVALID_TIMER;
}
@@ -982,7 +979,7 @@ int mob_spawn (struct mob_data *md)
if ( md->tomb_nid )
mvptomb_destroy(md);
- map_addblock(&md->bl);
+ iMap->addblock(&md->bl);
if( map[md->bl.m].users )
clif->spawn(&md->bl);
skill->unit_move(&md->bl,tick,1);
@@ -1209,7 +1206,7 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
{
struct block_list *bl;
- bl=map_id2bl(md->master_id);
+ bl=iMap->id2bl(md->master_id);
if (!bl || status_isdead(bl)) {
status_kill(&md->bl);
@@ -1245,7 +1242,7 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
{
short x = bl->x, y = bl->y;
mob_stop_attack(md);
- if(map_search_freecell(&md->bl, bl->m, &x, &y, MOB_SLAVEDISTANCE, MOB_SLAVEDISTANCE, 1)
+ if(iMap->search_freecell(&md->bl, bl->m, &x, &y, MOB_SLAVEDISTANCE, MOB_SLAVEDISTANCE, 1)
&& unit_walktoxy(&md->bl, x, y, 0))
return 1;
}
@@ -1264,9 +1261,9 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
if (ud) {
struct block_list *tbl=NULL;
if (ud->target && ud->state.attack_continue)
- tbl=map_id2bl(ud->target);
+ tbl=iMap->id2bl(ud->target);
else if (ud->skilltarget) {
- tbl = map_id2bl(ud->skilltarget);
+ tbl = iMap->id2bl(ud->skilltarget);
//Required check as skilltarget is not always an enemy. [Skotlex]
if (tbl && battle->check_target(&md->bl, tbl, BCT_ENEMY) <= 0)
tbl = NULL;
@@ -1351,7 +1348,7 @@ int mob_randomwalk(struct mob_data *md,unsigned int tick)
x+=md->bl.x;
y+=md->bl.y;
- if((map_getcell(md->bl.m,x,y,CELL_CHKPASS)) && unit_walktoxy(&md->bl,x,y,1)){
+ if((iMap->getcell(md->bl.m,x,y,CELL_CHKPASS)) && unit_walktoxy(&md->bl,x,y,1)){
break;
}
}
@@ -1388,11 +1385,11 @@ int mob_warpchase(struct mob_data *md, struct block_list *target)
return 0; //No need to do a warp chase.
if (md->ud.walktimer != INVALID_TIMER &&
- map_getcell(md->bl.m,md->ud.to_x,md->ud.to_y,CELL_CHKNPC))
+ iMap->getcell(md->bl.m,md->ud.to_x,md->ud.to_y,CELL_CHKNPC))
return 1; //Already walking to a warp.
//Search for warps within mob's viewing range.
- map_foreachinrange (mob_warpchase_sub, &md->bl,
+ iMap->foreachinrange (mob_warpchase_sub, &md->bl,
md->db->range2, BL_NPC, target, &warp, &distance);
if (warp && unit_walktobl(&md->bl, &warp->bl, 1, 1))
@@ -1440,7 +1437,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
if (md->target_id)
{ //Check validity of current target. [Skotlex]
- tbl = map_id2bl(md->target_id);
+ tbl = iMap->id2bl(md->target_id);
if (!tbl || tbl->m != md->bl.m ||
(md->ud.attacktimer == INVALID_TIMER && !status_check_skilluse(&md->bl, tbl, 0, 0)) ||
(md->ud.walktimer != INVALID_TIMER && !(battle_config.mob_ai&0x1) && !check_distance_bl(&md->bl, tbl, md->min_chase)) ||
@@ -1477,7 +1474,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
}
}
else
- if( (abl = map_id2bl(md->attacked_id)) && (!tbl || mob_can_changetarget(md, abl, mode)) )
+ if( (abl = iMap->id2bl(md->attacked_id)) && (!tbl || mob_can_changetarget(md, abl, mode)) )
{
int dist;
if( md->bl.m != abl->m || abl->prev == NULL
@@ -1536,19 +1533,19 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
if (!tbl && mode&MD_LOOTER && md->lootitem && DIFF_TICK(tick, md->ud.canact_tick) > 0 &&
(md->lootitem_count < LOOTITEM_SIZE || battle_config.monster_loot_type != 1))
{ // Scan area for items to loot, avoid trying to loot if the mob is full and can't consume the items.
- map_foreachinrange (mob_ai_sub_hard_lootsearch, &md->bl, view_range, BL_ITEM, md, &tbl);
+ iMap->foreachinrange (mob_ai_sub_hard_lootsearch, &md->bl, view_range, BL_ITEM, md, &tbl);
}
if ((!tbl && mode&MD_AGGRESSIVE) || md->state.skillstate == MSS_FOLLOW)
{
- map_foreachinrange (mob_ai_sub_hard_activesearch, &md->bl, view_range, DEFAULT_ENEMY_TYPE(md), md, &tbl, mode);
+ iMap->foreachinrange (mob_ai_sub_hard_activesearch, &md->bl, view_range, DEFAULT_ENEMY_TYPE(md), md, &tbl, mode);
}
else
if (mode&MD_CHANGECHASE && (md->state.skillstate == MSS_RUSH || md->state.skillstate == MSS_FOLLOW))
{
int search_size;
search_size = view_range<md->status.rhw.range ? view_range:md->status.rhw.range;
- map_foreachinrange (mob_ai_sub_hard_changechase, &md->bl, search_size, DEFAULT_ENEMY_TYPE(md), md, &tbl);
+ iMap->foreachinrange (mob_ai_sub_hard_changechase, &md->bl, search_size, DEFAULT_ENEMY_TYPE(md), md, &tbl);
}
if (!tbl) { //No targets available.
@@ -1559,7 +1556,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
if( md->bg_id && mode&MD_CANATTACK ) {
if( md->ud.walktimer != INVALID_TIMER )
return true;/* we are already moving */
- map_foreachinrange (mob_ai_sub_hard_bg_ally, &md->bl, view_range, BL_PC, md, &tbl, mode);
+ iMap->foreachinrange (mob_ai_sub_hard_bg_ally, &md->bl, view_range, BL_PC, md, &tbl, mode);
if( tbl ) {
if( distance_blxy(&md->bl, tbl->x, tbl->y) <= 3 || unit_walktobl(&md->bl, tbl, 1, 1) )
return true;/* we're moving or close enough don't unlock the target. */
@@ -1619,7 +1616,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick)
unit_set_walkdelay(&md->bl, tick, md->status.amotion, 1);
}
//Clear item.
- map_clearflooritem (tbl);
+ iMap->clearflooritem (tbl);
mob_unlocktarget (md,tick);
return true;
}
@@ -1689,7 +1686,7 @@ static int mob_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
{
unsigned int tick;
tick=va_arg(ap,unsigned int);
- map_foreachinrange(mob_ai_sub_hard_timer,&sd->bl, AREA_SIZE+ACTIVE_AI_RANGE, BL_MOB,tick);
+ iMap->foreachinrange(mob_ai_sub_hard_timer,&sd->bl, AREA_SIZE+ACTIVE_AI_RANGE, BL_MOB,tick);
return 0;
}
@@ -1768,7 +1765,7 @@ static int mob_ai_sub_lazy(struct mob_data *md, va_list args)
*------------------------------------------*/
static int mob_ai_lazy(int tid, unsigned int tick, int id, intptr_t data)
{
- map_foreachmob(mob_ai_sub_lazy,tick);
+ iMap->map_foreachmob(mob_ai_sub_lazy,tick);
return 0;
}
@@ -1779,9 +1776,9 @@ static int mob_ai_hard(int tid, unsigned int tick, int id, intptr_t data)
{
if (battle_config.mob_ai&0x20)
- map_foreachmob(mob_ai_sub_lazy,tick);
+ iMap->map_foreachmob(mob_ai_sub_lazy,tick);
else
- map_foreachpc(mob_ai_sub_foreachclient,tick);
+ iMap->map_foreachpc(mob_ai_sub_foreachclient,tick);
return 0;
}
@@ -1820,7 +1817,7 @@ static int mob_delay_item_drop(int tid, unsigned int tick, int id, intptr_t data
list=(struct item_drop_list *)data;
ditem = list->item;
while (ditem) {
- map_addflooritem(&ditem->item_data,ditem->item_data.amount,
+ iMap->addflooritem(&ditem->item_data,ditem->item_data.amount,
list->m,list->x,list->y,
list->first_charid,list->second_charid,list->third_charid,0);
ditem_prev = ditem;
@@ -1844,12 +1841,12 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
//Logs items, dropped by mobs [Lupus]
logs->pick_mob(md, loot?LOG_TYPE_LOOT:LOG_TYPE_PICKDROP_MONSTER, -ditem->item_data.amount, &ditem->item_data, NULL);
- sd = map_charid2sd(dlist->first_charid);
- if( sd == NULL ) sd = map_charid2sd(dlist->second_charid);
- if( sd == NULL ) sd = map_charid2sd(dlist->third_charid);
+ sd = iMap->charid2sd(dlist->first_charid);
+ if( sd == NULL ) sd = iMap->charid2sd(dlist->second_charid);
+ if( sd == NULL ) sd = iMap->charid2sd(dlist->third_charid);
if( sd
- && (drop_rate <= sd->state.autoloot || pc_isautolooting(sd, ditem->item_data.nameid))
+ && (drop_rate <= sd->state.autoloot || iPc->isautolooting(sd, ditem->item_data.nameid))
&& (battle_config.idle_no_autoloot == 0 || DIFF_TICK(last_tick, sd->idletime) < battle_config.idle_no_autoloot)
&& (battle_config.homunculus_autoloot?1:!flag)
#ifdef AUTOLOOT_DISTANCE
@@ -1857,7 +1854,7 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
&& check_distance_blxy(&sd->bl, dlist->x, dlist->y, AUTOLOOT_DISTANCE)
#endif
) { //Autoloot.
- if (party_share_loot(party_search(sd->status.party_id),
+ if (iParty->share_loot(iParty->search(sd->status.party_id),
sd, &ditem->item_data, sd->status.char_id) == 0
) {
ers_free(item_drop_ers, ditem);
@@ -1870,7 +1867,7 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
int mob_timer_delete(int tid, unsigned int tick, int id, intptr_t data)
{
- struct block_list* bl = map_id2bl(id);
+ struct block_list* bl = iMap->id2bl(id);
struct mob_data* md = BL_CAST(BL_MOB, bl);
if( md )
@@ -1911,13 +1908,13 @@ int mob_deleteslave(struct mob_data *md)
{
nullpo_ret(md);
- map_foreachinmap(mob_deleteslave_sub, md->bl.m, BL_MOB,md->bl.id);
+ iMap->foreachinmap(mob_deleteslave_sub, md->bl.m, BL_MOB,md->bl.id);
return 0;
}
// Mob respawning through KAIZEL or NPC_REBIRTH [Skotlex]
int mob_respawn(int tid, unsigned int tick, int id, intptr_t data)
{
- struct block_list *bl = map_id2bl(id);
+ struct block_list *bl = iMap->id2bl(id);
if(!bl) return 0;
status_revive(bl, (uint8)data, 0);
@@ -1981,7 +1978,7 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage)
struct mob_data* md2 = (TBL_MOB*)src;
if( md2->special_state.ai && md2->master_id )
{
- struct map_session_data* msd = map_id2sd(md2->master_id);
+ struct map_session_data* msd = iMap->id2sd(md2->master_id);
if( msd )
char_id = msd->status.char_id;
}
@@ -2057,7 +2054,7 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) {
//Log damage
if (src)
mob_log_damage(md, src, damage);
- md->dmgtick = gettick();
+ md->dmgtick = iTimer->gettick();
}
if (battle_config.show_mob_info&3)
@@ -2071,7 +2068,7 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) {
int i;
for(i = 0; i < DAMAGELOG_SIZE; i++){ // must show hp bar to all char who already hit the mob.
if( md->dmglog[i].id ) {
- struct map_session_data *sd = map_charid2sd(md->dmglog[i].id);
+ struct map_session_data *sd = iMap->charid2sd(md->dmglog[i].id);
if( sd && check_distance_bl(&md->bl, &sd->bl, AREA_SIZE) ) // check if in range
clif->monster_hp_bar(md,sd);
}
@@ -2081,7 +2078,7 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) {
if( md->special_state.ai == 2 ) {//LOne WOlf explained that ANYONE can trigger the marine countdown skill. [Skotlex]
md->state.alchemist = 1;
- mobskill_use(md, gettick(), MSC_ALCHEMIST);
+ mobskill_use(md, iTimer->gettick(), MSC_ALCHEMIST);
}
}
@@ -2102,7 +2099,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
} pt[DAMAGELOG_SIZE];
int i, temp, count, m = md->bl.m, pnum = 0;
int dmgbltypes = 0; // bitfield of all bl types, that caused damage to the mob and are elligible for exp distribution
- unsigned int mvp_damage, tick = gettick();
+ unsigned int mvp_damage, tick = iTimer->gettick();
bool rebirth, homkillonly;
status = &md->status;
@@ -2122,7 +2119,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
mobskill_use(md,tick,-1);
}
- map_freeblock_lock();
+ iMap->freeblock_lock();
memset(pt,0,sizeof(pt));
@@ -2133,7 +2130,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
memset(tmpsd,0,sizeof(tmpsd));
for(i = 0, count = 0, mvp_damage = 0; i < DAMAGELOG_SIZE && md->dmglog[i].id; i++)
{
- struct map_session_data* tsd = map_charid2sd(md->dmglog[i].id);
+ struct map_session_data* tsd = iMap->charid2sd(md->dmglog[i].id);
if(tsd == NULL)
continue; // skip empty entries
@@ -2192,7 +2189,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
else
ARR_FIND(0, MAX_PC_FEELHATE, i, temp == sd->hate_mob[i] &&
(battle_config.allow_skill_without_day || sg_info[i].day_func()));
- if(i<MAX_PC_FEELHATE && (temp=pc_checkskill(sd,sg_info[i].bless_id)))
+ if(i<MAX_PC_FEELHATE && (temp=iPc->checkskill(sd,sg_info[i].bless_id)))
bonus += (i==2?20:10)*temp;
}
if(battle_config.mobs_level_up && md->level > md->db->lv) // [Valaris]
@@ -2258,7 +2255,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
for( j = 0; j < pnum && pt[j].id != temp; j++ ); //Locate party.
if( j == pnum ){ //Possibly add party.
- pt[pnum].p = party_search(temp);
+ pt[pnum].p = iParty->search(temp);
if(pt[pnum].p && pt[pnum].p->party.exp) {
pt[pnum].id = temp;
pt[pnum].base_exp = base_exp;
@@ -2288,20 +2285,20 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if(base_exp || job_exp) {
if( md->dmglog[i].flag != MDLF_PET || battle_config.pet_attack_exp_to_master ) {
#ifdef RENEWAL_EXP
- int rate = pc_level_penalty_mod(tmpsd[i], md, 1);
+ int rate = iPc->level_penalty_mod(tmpsd[i], md, 1);
base_exp = (unsigned int)cap_value(base_exp * rate / 100, 1, UINT_MAX);
job_exp = (unsigned int)cap_value(job_exp * rate / 100, 1, UINT_MAX);
#endif
- pc_gainexp(tmpsd[i], &md->bl, base_exp, job_exp, false);
+ iPc->gainexp(tmpsd[i], &md->bl, base_exp, job_exp, false);
}
}
if(zeny) // zeny from mobs [Valaris]
- pc_getzeny(tmpsd[i], zeny, LOG_TYPE_PICKDROP_MONSTER, NULL);
+ iPc->getzeny(tmpsd[i], zeny, LOG_TYPE_PICKDROP_MONSTER, NULL);
}
}
for( i = 0; i < pnum; i++ ) //Party share.
- party_exp_share(pt[i].p, &md->bl, pt[i].base_exp,pt[i].job_exp,pt[i].zeny);
+ iParty->exp_share(pt[i].p, &md->bl, pt[i].base_exp,pt[i].job_exp,pt[i].zeny);
} //End EXP giving.
@@ -2316,9 +2313,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
struct item_data* it = NULL;
int drop_rate;
#ifdef RENEWAL_DROP
- int drop_modifier = mvp_sd ? pc_level_penalty_mod(mvp_sd, md, 2) :
- second_sd ? pc_level_penalty_mod(second_sd, md, 2):
- third_sd ? pc_level_penalty_mod(third_sd, md, 2) :
+ int drop_modifier = mvp_sd ? iPc->level_penalty_mod(mvp_sd, md, 2) :
+ second_sd ? iPc->level_penalty_mod(second_sd, md, 2):
+ third_sd ? iPc->level_penalty_mod(third_sd, md, 2) :
100;/* no player was attached, we dont use any modifier (100 = rates are not touched) */
#endif
dlist->m = md->bl.m;
@@ -2397,7 +2394,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
}
// Ore Discovery [Celest]
- if (sd == mvp_sd && pc_checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/10 >= rnd()%10000) {
+ if (sd == mvp_sd && iPc->checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/10 >= rnd()%10000) {
ditem = mob_setdropitem(itemdb_searchrandomid(IG_FINDINGORE), 1, NULL);
mob_item_drop(md, dlist, ditem, 0, battle_config.finding_ore_rate/10, homkillonly);
}
@@ -2436,7 +2433,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if( sd->bonus.get_zeny_num && rnd()%100 < sd->bonus.get_zeny_rate ) {
i = sd->bonus.get_zeny_num > 0 ? sd->bonus.get_zeny_num : -md->level * sd->bonus.get_zeny_num;
if (!i) i = 1;
- pc_getzeny(sd, 1+rnd()%i, LOG_TYPE_PICKDROP_MONSTER, NULL);
+ iPc->getzeny(sd, 1+rnd()%i, LOG_TYPE_PICKDROP_MONSTER, NULL);
}
}
@@ -2446,7 +2443,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
mob_item_drop(md, dlist, mob_setlootitem(&md->lootitem[i]), 1, 10000, homkillonly);
}
if (dlist->item) //There are drop items.
- add_timer(tick + (!battle_config.delay_battle_damage?500:0), mob_delay_item_drop, 0, (intptr_t)dlist);
+ iTimer->add_timer(tick + (!battle_config.delay_battle_damage?500:0), mob_delay_item_drop, 0, (intptr_t)dlist);
else //No drops
ers_free(item_drop_list_ers, dlist);
} else if (md->lootitem && md->lootitem_count) { //Loot MUST drop!
@@ -2460,7 +2457,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
dlist->item = NULL;
for(i = 0; i < md->lootitem_count; i++)
mob_item_drop(md, dlist, mob_setlootitem(&md->lootitem[i]), 1, 10000, homkillonly);
- add_timer(tick + (!battle_config.delay_battle_damage?500:0), mob_delay_item_drop, 0, (intptr_t)dlist);
+ iTimer->add_timer(tick + (!battle_config.delay_battle_damage?500:0), mob_delay_item_drop, 0, (intptr_t)dlist);
}
if(mvp_sd && md->db->mexp > 0 && !md->special_state.ai) {
@@ -2482,7 +2479,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
clif->mvp_effect(mvp_sd);
clif->mvp_exp(mvp_sd,mexp);
- pc_gainexp(mvp_sd, &md->bl, mexp,0, false);
+ iPc->gainexp(mvp_sd, &md->bl, mexp,0, false);
log_mvp[1] = mexp;
if( !(map[m].flag.nomvploot || type&1) ) {
@@ -2530,9 +2527,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
intif_broadcast(message,strlen(message)+1,0);
}
- if((temp = pc_additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) {
+ if((temp = iPc->additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) {
clif->additem(mvp_sd,0,0,temp);
- map_addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1);
+ iMap->addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1);
}
//Logs items, MVP prizes [Lupus]
@@ -2563,7 +2560,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if( sd ) {
if( sd->mission_mobid == md->class_) { //TK_MISSION [Skotlex]
if( ++sd->mission_count >= 100 && (temp = mob_get_random_id(0, 0xE, sd->status.base_level)) ) {
- pc_addfame(sd, 1);
+ iPc->addfame(sd, 1);
sd->mission_mobid = temp;
pc_setglobalreg(sd,"TK_MISSION_ID", temp);
sd->mission_count = 0;
@@ -2573,7 +2570,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
}
if( sd->status.party_id )
- map_foreachinrange(quest_update_objective_sub,&md->bl,AREA_SIZE,BL_PC,sd->status.party_id,md->class_);
+ iMap->foreachinrange(quest_update_objective_sub,&md->bl,AREA_SIZE,BL_PC,sd->status.party_id,md->class_);
else if( sd->avail_quests )
quest_update_objective(sd, md->class_);
@@ -2583,15 +2580,15 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if( md->npc_event[0] && !md->state.npc_killmonster ) {
if( sd && battle_config.mob_npc_event_type ) {
- pc_setparam(sd, SP_KILLERRID, sd->bl.id);
+ iPc->setparam(sd, SP_KILLERRID, sd->bl.id);
npc_event(sd,md->npc_event,0);
} else if( mvp_sd ) {
- pc_setparam(mvp_sd, SP_KILLERRID, sd?sd->bl.id:0);
+ iPc->setparam(mvp_sd, SP_KILLERRID, sd?sd->bl.id:0);
npc_event(mvp_sd,md->npc_event,0);
} else
npc_event_do(md->npc_event);
} else if( mvp_sd && !md->state.npc_killmonster ) {
- pc_setparam(mvp_sd, SP_KILLEDRID, md->class_);
+ iPc->setparam(mvp_sd, SP_KILLEDRID, md->class_);
npc_script_event(mvp_sd, NPCE_KILLNPC); // PCKillNPC [Lance]
}
@@ -2599,7 +2596,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
}
if(md->deletetimer != INVALID_TIMER) {
- delete_timer(md->deletetimer,mob_timer_delete);
+ iTimer->delete_timer(md->deletetimer,mob_timer_delete);
md->deletetimer = INVALID_TIMER;
}
/**
@@ -2608,7 +2605,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if( md->can_summon )
mob_deleteslave(md);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
if( !rebirth ) {
@@ -2641,7 +2638,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
void mob_revive(struct mob_data *md, unsigned int hp)
{
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
md->state.skillstate = MSS_IDLE;
md->last_thinktime = tick;
md->next_walktime = tick+rnd()%50+5000;
@@ -2650,7 +2647,7 @@ void mob_revive(struct mob_data *md, unsigned int hp)
memset(md->dmglog, 0, sizeof(md->dmglog)); // Reset the damage done on the rebirthed monster, otherwise will grant full exp + damage done. [Valaris]
md->tdmg = 0;
if (!md->bl.prev)
- map_addblock(&md->bl);
+ iMap->addblock(&md->bl);
clif->spawn(&md->bl);
skill->unit_move(&md->bl,tick,1);
mobskill_use(md, tick, MSC_SPAWN);
@@ -2726,7 +2723,7 @@ int mob_random_class (int *value, size_t count)
*------------------------------------------*/
int mob_class_change (struct mob_data *md, int class_)
{
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
int i, c, hp_rate;
nullpo_ret(md);
@@ -2812,7 +2809,7 @@ int mob_warpslave_sub(struct block_list *bl,va_list ap)
if(md->master_id!=master->id)
return 0;
- map_search_freecell(master, 0, &x, &y, range, range, 0);
+ iMap->search_freecell(master, 0, &x, &y, range, range, 0);
unit_warp(&md->bl, master->m, x, y,CLR_RESPAWN);
return 1;
}
@@ -2827,7 +2824,7 @@ int mob_warpslave(struct block_list *bl, int range)
if (range < 1)
range = 1; //Min range needed to avoid crashes and stuff. [Skotlex]
- return map_foreachinmap(mob_warpslave_sub, bl->m, BL_MOB, bl, range);
+ return iMap->foreachinmap(mob_warpslave_sub, bl->m, BL_MOB, bl, range);
}
/*==========================================
@@ -2850,7 +2847,7 @@ int mob_countslave_sub(struct block_list *bl,va_list ap)
*------------------------------------------*/
int mob_countslave(struct block_list *bl)
{
- return map_foreachinmap(mob_countslave_sub, bl->m, BL_MOB,bl->id);
+ return iMap->foreachinmap(mob_countslave_sub, bl->m, BL_MOB,bl->id);
}
/*==========================================
@@ -2897,7 +2894,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,uint16 skill_id)
if (mobdb_checkid(data.class_) == 0)
continue;
- if (map_search_freecell(&md2->bl, 0, &x, &y, MOB_SLAVEDISTANCE, MOB_SLAVEDISTANCE, 0)) {
+ if (iMap->search_freecell(&md2->bl, 0, &x, &y, MOB_SLAVEDISTANCE, MOB_SLAVEDISTANCE, 0)) {
data.x = x;
data.y = y;
} else {
@@ -3006,7 +3003,7 @@ static struct block_list *mob_getfriendhprate(struct mob_data *md,int min_rate,i
if (md->special_state.ai) //Summoned creatures. [Skotlex]
type = BL_PC;
- map_foreachinrange(mob_getfriendhprate_sub, &md->bl, 8, type,md,min_rate,max_rate,&fr);
+ iMap->foreachinrange(mob_getfriendhprate_sub, &md->bl, 8, type,md,min_rate,max_rate,&fr);
return fr;
}
/*==========================================
@@ -3016,7 +3013,7 @@ struct block_list *mob_getmasterhpltmaxrate(struct mob_data *md,int rate)
{
if( md && md->master_id > 0 )
{
- struct block_list *bl = map_id2bl(md->master_id);
+ struct block_list *bl = iMap->id2bl(md->master_id);
if( bl && get_percentage(status_get_hp(bl), status_get_max_hp(bl)) < rate )
return bl;
}
@@ -3063,7 +3060,7 @@ struct mob_data *mob_getfriendstatus(struct mob_data *md,int cond1,int cond2)
struct mob_data* fr = NULL;
nullpo_ret(md);
- map_foreachinrange(mob_getfriendstatus_sub, &md->bl, 8,BL_MOB, md,cond1,cond2,&fr);
+ iMap->foreachinrange(mob_getfriendstatus_sub, &md->bl, 8,BL_MOB, md,cond1,cond2,&fr);
return fr;
}
@@ -3165,7 +3162,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
case MSC_MASTERHPLTMAXRATE:
flag = ((fbl = mob_getmasterhpltmaxrate(md, ms[i].cond2)) != NULL); break;
case MSC_MASTERATTACKED:
- flag = (md->master_id > 0 && (fbl=map_id2bl(md->master_id)) && unit_counttargeted(fbl) > 0); break;
+ flag = (md->master_id > 0 && (fbl=iMap->id2bl(md->master_id)) && unit_counttargeted(fbl) > 0); break;
case MSC_ALCHEMIST:
flag = (md->state.alchemist);
break;
@@ -3188,12 +3185,12 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
case MST_AROUND6:
case MST_AROUND7:
case MST_AROUND8:
- bl = map_id2bl(md->target_id);
+ bl = iMap->id2bl(md->target_id);
break;
case MST_MASTER:
bl = &md->bl;
if (md->master_id)
- bl = map_id2bl(md->master_id);
+ bl = iMap->id2bl(md->master_id);
if (bl) //Otherwise, fall through.
break;
case MST_FRIEND:
@@ -3212,14 +3209,14 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
j = ms[i].target >= MST_AROUND1?
(ms[i].target-MST_AROUND1) +1:
(ms[i].target-MST_AROUND5) +1;
- map_search_freecell(&md->bl, md->bl.m, &x, &y, j, j, 3);
+ iMap->search_freecell(&md->bl, md->bl.m, &x, &y, j, j, 3);
}
md->skill_idx = i;
- map_freeblock_lock();
+ iMap->freeblock_lock();
if( !battle->check_range(&md->bl,bl,skill->get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) ||
!unit_skilluse_pos2(&md->bl, x, y,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel) )
{
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
continue;
}
} else {
@@ -3230,12 +3227,12 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
skill->get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv));
break;
case MST_TARGET:
- bl = map_id2bl(md->target_id);
+ bl = iMap->id2bl(md->target_id);
break;
case MST_MASTER:
bl = &md->bl;
if (md->master_id)
- bl = map_id2bl(md->master_id);
+ bl = iMap->id2bl(md->master_id);
if (bl) //Otherwise, fall through.
break;
case MST_FRIEND:
@@ -3253,11 +3250,11 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
if (!bl) continue;
md->skill_idx = i;
- map_freeblock_lock();
+ iMap->freeblock_lock();
if( !battle->check_range(&md->bl,bl,skill->get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) ||
!unit_skilluse_id2(&md->bl, bl->id,ms[i].skill_id, ms[i].skill_lv,ms[i].casttime, ms[i].cancel) )
{
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
continue;
}
}
@@ -3277,7 +3274,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event)
md->skilldelay[j]=tick;
} else
md->skilldelay[i]=tick;
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
//No skill was used.
@@ -3387,8 +3384,8 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons
//Go Backwards to give better priority to advanced skills.
for (i=0,j = MAX_SKILL_TREE-1;j>=0 && i< MAX_MOBSKILL ;j--) {
- int idx = skill_tree[pc_class2idx(sd->status.class_)][j].idx;
- skill_id = skill_tree[pc_class2idx(sd->status.class_)][j].id;
+ int idx = skill_tree[iPc->class2idx(sd->status.class_)][j].idx;
+ skill_id = skill_tree[iPc->class2idx(sd->status.class_)][j].id;
if (!skill_id || sd->status.skill[idx].lv < 1 ||
(skill_db[idx].inf2&(INF2_WEDDING_SKILL|INF2_GUILD_SKILL))
)
@@ -3525,8 +3522,8 @@ int mob_clone_spawn(struct map_session_data *sd, int16 m, int16 x, int16 y, cons
if (duration) //Auto Delete after a while.
{
if( md->deletetimer != INVALID_TIMER )
- delete_timer(md->deletetimer, mob_timer_delete);
- md->deletetimer = add_timer (gettick() + duration, mob_timer_delete, md->bl.id, 0);
+ iTimer->delete_timer(md->deletetimer, mob_timer_delete);
+ md->deletetimer = iTimer->add_timer (iTimer->gettick() + duration, mob_timer_delete, md->bl.id, 0);
}
}
@@ -3900,14 +3897,14 @@ static void mob_readdb(void)
if(fi > 0)
{
char path[256];
- sprintf(path, "%s/%s", db_path, filename[fi]);
+ sprintf(path, "%s/%s", iMap->db_path, filename[fi]);
if(!exists(path))
{
continue;
}
}
- sv->readdb(db_path, filename[fi], ',', 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, -1, &mob_readdb_sub);
+ sv->readdb(iMap->db_path, filename[fi], ',', 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP, -1, &mob_readdb_sub);
}
}
@@ -3916,7 +3913,7 @@ static void mob_readdb(void)
*------------------------------------------*/
static int mob_read_sqldb(void)
{
- const char* mob_db_name[] = { mob_db_db, mob_db2_db };
+ const char* mob_db_name[] = { iMap->mob_db_db, iMap->mob_db2_db };
int fi;
for( fi = 0; fi < ARRAYLENGTH(mob_db_name); ++fi ) {
@@ -4024,7 +4021,7 @@ static int mob_read_randommonster(void)
for( i = 0; i < ARRAYLENGTH(mobfile) && i < MAX_RANDOMMONSTER; i++ ) {
unsigned int count = 0;
mob_db_data[0]->summonper[i] = 1002; // Default fallback value, in case the database does not provide one
- sprintf(line, "%s/%s", db_path, mobfile[i]);
+ sprintf(line, "%s/%s", iMap->db_path, mobfile[i]);
fp=fopen(line,"r");
if(fp==NULL){
ShowError("can't read %s\n",line);
@@ -4138,7 +4135,7 @@ static void mob_readchatdb(void)
char line[1024], path[256];
int i, tmp=0;
FILE *fp;
- sprintf(path, "%s/%s", db_path, arc);
+ sprintf(path, "%s/%s", iMap->db_path, arc);
fp=fopen(path, "r");
if(fp == NULL)
{
@@ -4464,14 +4461,14 @@ static void mob_readskilldb(void) {
if(fi > 0)
{
char path[256];
- sprintf(path, "%s/%s", db_path, filename[fi]);
+ sprintf(path, "%s/%s", iMap->db_path, filename[fi]);
if(!exists(path))
{
continue;
}
}
- sv->readdb(db_path, filename[fi], ',', 19, 19, -1, &mob_parse_row_mobskilldb);
+ sv->readdb(iMap->db_path, filename[fi], ',', 19, 19, -1, &mob_parse_row_mobskilldb);
}
}
@@ -4482,7 +4479,7 @@ static void mob_readskilldb(void) {
*/
static int mob_read_sqlskilldb(void)
{
- const char* mob_skill_db_name[] = { mob_skill_db_db, mob_skill_db2_db };
+ const char* mob_skill_db_name[] = { iMap->mob_skill_db_db, iMap->mob_skill_db2_db };
int fi;
if( battle_config.mob_skill_rate == 0 ) {
@@ -4586,9 +4583,9 @@ static bool mob_readdb_itemratio(char* str[], int columns, int current)
*/
static void mob_load(void)
{
- sv->readdb(db_path, "mob_item_ratio.txt", ',', 2, 2+MAX_ITEMRATIO_MOBS, -1, &mob_readdb_itemratio); // must be read before mobdb
+ sv->readdb(iMap->db_path, "mob_item_ratio.txt", ',', 2, 2+MAX_ITEMRATIO_MOBS, -1, &mob_readdb_itemratio); // must be read before mobdb
mob_readchatdb();
- if (db_use_sqldbs)
+ if (iMap->db_use_sqldbs)
{
mob_read_sqldb();
mob_read_sqlskilldb();
@@ -4598,9 +4595,9 @@ static void mob_load(void)
mob_readdb();
mob_readskilldb();
}
- sv->readdb(db_path, "mob_avail.txt", ',', 2, 12, -1, &mob_readdb_mobavail);
+ sv->readdb(iMap->db_path, "mob_avail.txt", ',', 2, 12, -1, &mob_readdb_mobavail);
mob_read_randommonster();
- sv->readdb(db_path, DBPATH"mob_race2_db.txt", ',', 2, 20, -1, &mob_readdb_race2);
+ sv->readdb(iMap->db_path, DBPATH"mob_race2_db.txt", ',', 2, 20, -1, &mob_readdb_race2);
}
void mob_reload(void) {
@@ -4645,15 +4642,15 @@ int do_init_mob(void)
mob_load();
- add_timer_func_list(mob_delayspawn,"mob_delayspawn");
- add_timer_func_list(mob_delay_item_drop,"mob_delay_item_drop");
- add_timer_func_list(mob_ai_hard,"mob_ai_hard");
- add_timer_func_list(mob_ai_lazy,"mob_ai_lazy");
- add_timer_func_list(mob_timer_delete,"mob_timer_delete");
- add_timer_func_list(mob_spawn_guardian_sub,"mob_spawn_guardian_sub");
- add_timer_func_list(mob_respawn,"mob_respawn");
- add_timer_interval(gettick()+MIN_MOBTHINKTIME,mob_ai_hard,0,0,MIN_MOBTHINKTIME);
- add_timer_interval(gettick()+MIN_MOBTHINKTIME*10,mob_ai_lazy,0,0,MIN_MOBTHINKTIME*10);
+ iTimer->add_timer_func_list(mob_delayspawn,"mob_delayspawn");
+ iTimer->add_timer_func_list(mob_delay_item_drop,"mob_delay_item_drop");
+ iTimer->add_timer_func_list(mob_ai_hard,"mob_ai_hard");
+ iTimer->add_timer_func_list(mob_ai_lazy,"mob_ai_lazy");
+ iTimer->add_timer_func_list(mob_timer_delete,"mob_timer_delete");
+ iTimer->add_timer_func_list(mob_spawn_guardian_sub,"mob_spawn_guardian_sub");
+ iTimer->add_timer_func_list(mob_respawn,"mob_respawn");
+ iTimer->add_timer_interval(iTimer->gettick()+MIN_MOBTHINKTIME,mob_ai_hard,0,0,MIN_MOBTHINKTIME);
+ iTimer->add_timer_interval(iTimer->gettick()+MIN_MOBTHINKTIME*10,mob_ai_lazy,0,0,MIN_MOBTHINKTIME*10);
return 0;
}
diff --git a/src/map/npc.c b/src/map/npc.c
index 090c03e58..7a6516d9a 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -57,14 +57,14 @@ static int npc_cache_mob=0;
/// Returns a new npc id that isn't being used in id_db.
/// Fatal error if nothing is available.
int npc_get_new_npc_id(void) {
- if( npc_id >= START_NPC_NUM && !map_blid_exists(npc_id) )
+ if( npc_id >= START_NPC_NUM && !iMap->blid_exists(npc_id) )
return npc_id++;// available
else {// find next id
int base_id = npc_id;
while( base_id != ++npc_id ) {
if( npc_id < START_NPC_NUM )
npc_id = START_NPC_NUM;
- if( !map_blid_exists(npc_id) )
+ if( !iMap->blid_exists(npc_id) )
return npc_id++;// available
}
// full loop, nothing available
@@ -122,7 +122,7 @@ struct view_data* npc_get_viewdata(int class_)
static int npc_isnear_sub(struct block_list* bl, va_list args) {
struct npc_data *nd = (struct npc_data*)bl;
- if( nd->sc.option & (OPTION_HIDE|OPTION_INVISIBLE) )
+ if( nd->option & (OPTION_HIDE|OPTION_INVISIBLE) )
return 0;
return 1;
@@ -131,7 +131,7 @@ static int npc_isnear_sub(struct block_list* bl, va_list args) {
bool npc_isnear(struct block_list * bl) {
if( battle_config.min_npc_vendchat_distance > 0 &&
- map_foreachinrange(npc_isnear_sub,bl, battle_config.min_npc_vendchat_distance, BL_NPC) )
+ iMap->foreachinrange(npc_isnear_sub,bl, battle_config.min_npc_vendchat_distance, BL_NPC) )
return true;
return false;
@@ -175,7 +175,7 @@ int npc_enable_sub(struct block_list *bl, va_list ap)
{
TBL_PC *sd = (TBL_PC*)bl;
- if (nd->sc.option&OPTION_INVISIBLE)
+ if (nd->option&OPTION_INVISIBLE)
return 1;
if( npc_ontouch_event(sd,nd) > 0 && npc_ontouch2_event(sd,nd) > 0 )
@@ -197,27 +197,25 @@ int npc_enable(const char* name, int flag)
{
struct npc_data* nd = npc_name2id(name);
- if (nd==NULL)
- {
+ if ( nd == NULL ) {
ShowError("npc_enable: Attempted to %s a non-existing NPC '%s' (flag=%d).\n", (flag&3) ? "show" : "hide", name, flag);
return 0;
}
if (flag&1) {
- nd->sc.option&=~OPTION_INVISIBLE;
+ nd->option&=~OPTION_INVISIBLE;
clif->spawn(&nd->bl);
} else if (flag&2)
- nd->sc.option&=~OPTION_HIDE;
+ nd->option&=~OPTION_HIDE;
else if (flag&4)
- nd->sc.option|= OPTION_HIDE;
- else { //Can't change the view_data to invisible class because the view_data for all npcs is shared! [Skotlex]
- nd->sc.option|= OPTION_INVISIBLE;
+ nd->option|= OPTION_HIDE;
+ else { //Can't change the view_data to invisible class because the view_data for all npcs is shared! [Skotlex]
+ nd->option|= OPTION_INVISIBLE;
clif->clearunit_area(&nd->bl,CLR_OUTSIGHT); // Hack to trick maya purple card [Xazax]
}
- if (nd->class_ == WARP_CLASS || nd->class_ == FLAG_CLASS)
- { //Client won't display option changes for these classes [Toms]
- if (nd->sc.option&(OPTION_HIDE|OPTION_INVISIBLE))
+ if (nd->class_ == WARP_CLASS || nd->class_ == FLAG_CLASS) { //Client won't display option changes for these classes [Toms]
+ if (nd->option&(OPTION_HIDE|OPTION_INVISIBLE))
clif->clearunit_area(&nd->bl, CLR_OUTSIGHT);
else
clif->spawn(&nd->bl);
@@ -225,7 +223,7 @@ int npc_enable(const char* name, int flag)
clif->changeoption(&nd->bl);
if( flag&3 && (nd->u.scr.xs >= 0 || nd->u.scr.ys >= 0) ) //check if player standing on a OnTouchArea
- map_foreachinarea( npc_enable_sub, nd->bl.m, nd->bl.x-nd->u.scr.xs, nd->bl.y-nd->u.scr.ys, nd->bl.x+nd->u.scr.xs, nd->bl.y+nd->u.scr.ys, BL_PC, nd );
+ iMap->foreachinarea( npc_enable_sub, nd->bl.m, nd->bl.x-nd->u.scr.xs, nd->bl.y-nd->u.scr.ys, nd->bl.x+nd->u.scr.xs, nd->bl.y+nd->u.scr.ys, BL_PC, nd );
return 0;
}
@@ -247,7 +245,7 @@ struct npc_data* npc_name2id(const char* name)
int npc_rr_secure_timeout_timer(int tid, unsigned int tick, int id, intptr_t data) {
struct map_session_data* sd = NULL;
unsigned int timeout = NPC_SECURE_TIMEOUT_NEXT;
- if( (sd = map_id2sd(id)) == NULL || !sd->npc_id ) {
+ if( (sd = iMap->id2sd(id)) == NULL || !sd->npc_id ) {
if( sd ) sd->npc_idle_timer = INVALID_TIMER;
return 0;//Not logged in anymore OR no longer attached to a npc
}
@@ -270,11 +268,12 @@ int npc_rr_secure_timeout_timer(int tid, unsigned int tick, int id, intptr_t dat
sd->st->state = END;
sd->state.menu_or_input = 0;
sd->npc_menu = 0;
-
+ clif->scriptmes(sd, sd->npc_id, " ");
/**
* This guy's been idle for longer than allowed, close him.
**/
clif->scriptclose(sd,sd->npc_id);
+ clif->scriptclear(sd,sd->npc_id);
sd->npc_idle_timer = INVALID_TIMER;
} else //Create a new instance of ourselves to continue
sd->npc_idle_timer = add_timer(gettick() + (SECURE_NPCTIMEOUT_INTERVAL*1000),npc_rr_secure_timeout_timer,sd->bl.id,0);
@@ -289,8 +288,7 @@ int npc_event_dequeue(struct map_session_data* sd)
{
nullpo_ret(sd);
- if(sd->npc_id)
- { //Current script is aborted.
+ if(sd->npc_id) { //Current script is aborted.
if(sd->state.using_fake_npc){
clif->clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
sd->state.using_fake_npc = 0;
@@ -305,8 +303,7 @@ int npc_event_dequeue(struct map_session_data* sd)
if (!sd->eventqueue[0][0])
return 0; //Nothing to dequeue
- if (!pc_addeventtimer(sd,100,sd->eventqueue[0]))
- { //Failed to dequeue, couldn't set a timer.
+ if (!iPc->addeventtimer(sd,100,sd->eventqueue[0])) { //Failed to dequeue, couldn't set a timer.
ShowWarning("npc_event_dequeue: event timer is full !\n");
return 0;
}
@@ -353,7 +350,7 @@ int npc_event_doall_sub(DBKey key, DBData *data, va_list ap)
const char* name;
int rid;
- nullpo_ret(ev = DB->data2ptr(data));
+ nullpo_ret(ev = iDB->data2ptr(data));
nullpo_ret(c = va_arg(ap, int *));
nullpo_ret(name = va_arg(ap, const char *));
rid = va_arg(ap, int);
@@ -362,7 +359,7 @@ int npc_event_doall_sub(DBKey key, DBData *data, va_list ap)
if( p && strcmpi(name, p) == 0 /* && !ev->nd->src_id */ ) // Do not run on duplicates. [Paradox924X]
{
if(rid) // a player may only have 1 script running at the same time
- npc_event_sub(map_id2sd(rid),ev,key.str);
+ npc_event_sub(iMap->id2sd(rid),ev,key.str);
else
run_script(ev->nd->u.scr.script,ev->pos,rid,ev->nd->bl.id);
(*c)++;
@@ -381,12 +378,11 @@ static int npc_event_do_sub(DBKey key, DBData *data, va_list ap)
int* c;
const char* name;
- nullpo_ret(ev = DB->data2ptr(data));
+ nullpo_ret(ev = iDB->data2ptr(data));
nullpo_ret(c = va_arg(ap, int *));
nullpo_ret(name = va_arg(ap, const char *));
- if( p && strcmpi(name, p) == 0 )
- {
+ if( p && strcmpi(name, p) == 0 ) {
run_script(ev->nd->u.scr.script,ev->pos,0,ev->nd->bl.id);
(*c)++;
}
@@ -483,7 +479,7 @@ void npc_event_do_oninit(void)
{
ShowStatus("Event '"CL_WHITE"OnInit"CL_RESET"' executed with '"CL_WHITE"%d"CL_RESET"' NPCs."CL_CLL"\n", npc_event_doall("OnInit"));
- add_timer_interval(gettick()+100,npc_event_do_clock,0,0,1000);
+ iTimer->add_timer_interval(iTimer->gettick()+100,npc_event_do_clock,0,0,1000);
}
/*==========================================
@@ -530,7 +526,7 @@ int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data)
{
int old_rid, old_timer;
unsigned int old_tick;
- struct npc_data* nd=(struct npc_data *)map_id2bl(id);
+ struct npc_data* nd=(struct npc_data *)iMap->id2bl(id);
struct npc_timerevent_list *te;
struct timer_event_data *ted = (struct timer_event_data*)data;
struct map_session_data *sd=NULL;
@@ -541,7 +537,7 @@ int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
- if( ted->rid && !(sd = map_id2sd(ted->rid)) )
+ if( ted->rid && !(sd = iMap->id2sd(ted->rid)) )
{
ShowError("npc_timerevent: Attached player not found.\n");
ers_free(timer_event_ers, ted);
@@ -569,9 +565,9 @@ int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data)
next = nd->u.scr.timer_event[ ted->next ].timer - nd->u.scr.timer_event[ ted->next - 1 ].timer;
ted->time += next;
if( sd )
- sd->npc_timer_id = add_timer(tick+next,npc_timerevent,id,(intptr_t)ted);
+ sd->npc_timer_id = iTimer->add_timer(tick+next,npc_timerevent,id,(intptr_t)ted);
else
- nd->u.scr.timerid = add_timer(tick+next,npc_timerevent,id,(intptr_t)ted);
+ nd->u.scr.timerid = iTimer->add_timer(tick+next,npc_timerevent,id,(intptr_t)ted);
}
else
{
@@ -601,7 +597,7 @@ int npc_timerevent(int tid, unsigned int tick, int id, intptr_t data)
int npc_timerevent_start(struct npc_data* nd, int rid)
{
int j;
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
struct map_session_data *sd = NULL; //Player to whom script is attached.
nullpo_ret(nd);
@@ -609,7 +605,7 @@ int npc_timerevent_start(struct npc_data* nd, int rid)
// Check if there is an OnTimer Event
ARR_FIND( 0, nd->u.scr.timeramount, j, nd->u.scr.timer_event[j].timer > nd->u.scr.timer );
- if( nd->u.scr.rid > 0 && !(sd = map_id2sd(nd->u.scr.rid)) )
+ if( nd->u.scr.rid > 0 && !(sd = iMap->id2sd(nd->u.scr.rid)) )
{ // Failed to attach timer to this player.
ShowError("npc_timerevent_start: Attached player not found!\n");
return 1;
@@ -636,13 +632,13 @@ int npc_timerevent_start(struct npc_data* nd, int rid)
if( sd )
{
ted->rid = sd->bl.id; // Attach only the player if attachplayerrid was used.
- sd->npc_timer_id = add_timer(tick+next,npc_timerevent,nd->bl.id,(intptr_t)ted);
+ sd->npc_timer_id = iTimer->add_timer(tick+next,npc_timerevent,nd->bl.id,(intptr_t)ted);
}
else
{
ted->rid = 0;
nd->u.scr.timertick = tick; // Set when timer is started
- nd->u.scr.timerid = add_timer(tick+next,npc_timerevent,nd->bl.id,(intptr_t)ted);
+ nd->u.scr.timerid = iTimer->add_timer(tick+next,npc_timerevent,nd->bl.id,(intptr_t)ted);
}
}
else if (!sd)
@@ -663,7 +659,7 @@ int npc_timerevent_stop(struct npc_data* nd)
nullpo_ret(nd);
- if( nd->u.scr.rid && !(sd = map_id2sd(nd->u.scr.rid)) )
+ if( nd->u.scr.rid && !(sd = iMap->id2sd(nd->u.scr.rid)) )
{
ShowError("npc_timerevent_stop: Attached player not found!\n");
return 1;
@@ -676,16 +672,16 @@ int npc_timerevent_stop(struct npc_data* nd)
// Delete timer
if ( *tid != INVALID_TIMER )
{
- td = get_timer(*tid);
+ td = iTimer->get_timer(*tid);
if( td && td->data )
ers_free(timer_event_ers, (void*)td->data);
- delete_timer(*tid,npc_timerevent);
+ iTimer->delete_timer(*tid,npc_timerevent);
*tid = INVALID_TIMER;
}
if( !sd && nd->u.scr.timertick )
{
- nd->u.scr.timer += DIFF_TICK(gettick(),nd->u.scr.timertick); // Set 'timer' to the time that has passed since the beginning of the timers
+ nd->u.scr.timer += DIFF_TICK(iTimer->gettick(),nd->u.scr.timertick); // Set 'timer' to the time that has passed since the beginning of the timers
nd->u.scr.timertick = 0; // Set 'tick' to zero so that we know it's off.
}
@@ -703,16 +699,16 @@ void npc_timerevent_quit(struct map_session_data* sd)
// Check timer existance
if( sd->npc_timer_id == INVALID_TIMER )
return;
- if( !(td = get_timer(sd->npc_timer_id)) )
+ if( !(td = iTimer->get_timer(sd->npc_timer_id)) )
{
sd->npc_timer_id = INVALID_TIMER;
return;
}
// Delete timer
- nd = (struct npc_data *)map_id2bl(td->id);
+ nd = (struct npc_data *)iMap->id2bl(td->id);
ted = (struct timer_event_data*)td->data;
- delete_timer(sd->npc_timer_id, npc_timerevent);
+ iTimer->delete_timer(sd->npc_timer_id, npc_timerevent);
sd->npc_timer_id = INVALID_TIMER;
// Execute OnTimerQuit
@@ -739,7 +735,7 @@ void npc_timerevent_quit(struct map_session_data* sd)
old_timer = nd->u.scr.timer;
nd->u.scr.rid = sd->bl.id;
- nd->u.scr.timertick = gettick();
+ nd->u.scr.timertick = iTimer->gettick();
nd->u.scr.timer = ted->time;
//Execute label
@@ -767,7 +763,7 @@ int npc_gettimerevent_tick(struct npc_data* nd)
tick = nd->u.scr.timer; // The last time it's active(start, stop or event trigger)
if( nd->u.scr.timertick ) // It's a running timer
- tick += DIFF_TICK(gettick(), nd->u.scr.timertick);
+ tick += DIFF_TICK(iTimer->gettick(), nd->u.scr.timertick);
return tick;
}
@@ -815,7 +811,7 @@ int npc_event_sub(struct map_session_data* sd, struct event_data* ev, const char
ShowWarning("npc_event: player's event queue is full, can't add event '%s' !\n", eventname);
return 1;
}
- if( ev->nd->sc.option&OPTION_INVISIBLE )
+ if( ev->nd->option&OPTION_INVISIBLE )
{
//Disabled npc, shouldn't trigger event.
npc_event_dequeue(sd);
@@ -835,22 +831,20 @@ int npc_event(struct map_session_data* sd, const char* eventname, int ontouch)
nullpo_ret(sd);
- if( ev == NULL || (nd = ev->nd) == NULL )
- {
+ if( ev == NULL || (nd = ev->nd) == NULL ) {
if( !ontouch )
ShowError("npc_event: event not found [%s]\n", eventname);
return ontouch;
}
- switch(ontouch)
- {
- case 1:
- nd->touching_id = sd->bl.id;
- sd->touching_id = nd->bl.id;
- break;
- case 2:
- sd->areanpc_id = nd->bl.id;
- break;
+ switch(ontouch) {
+ case 1:
+ nd->touching_id = sd->bl.id;
+ sd->touching_id = nd->bl.id;
+ break;
+ case 2:
+ sd->areanpc_id = nd->bl.id;
+ break;
}
return npc_event_sub(sd,ev,eventname);
@@ -866,7 +860,7 @@ int npc_touch_areanpc_sub(struct block_list *bl, va_list ap)
char *name;
nullpo_ret(bl);
- nullpo_ret((sd = map_id2sd(bl->id)));
+ nullpo_ret((sd = iMap->id2sd(bl->id)));
pc_id = va_arg(ap,int);
name = va_arg(ap,char*);
@@ -889,7 +883,7 @@ int npc_touch_areanpc_sub(struct block_list *bl, va_list ap)
*------------------------------------------*/
int npc_touchnext_areanpc(struct map_session_data* sd, bool leavemap)
{
- struct npc_data *nd = map_id2nd(sd->touching_id);
+ struct npc_data *nd = iMap->id2nd(sd->touching_id);
short xs, ys;
if( !nd || nd->touching_id != sd->bl.id )
@@ -907,7 +901,7 @@ int npc_touchnext_areanpc(struct map_session_data* sd, bool leavemap)
nd->touching_id = sd->touching_id = 0;
snprintf(name, ARRAYLENGTH(name), "%s::%s", nd->exname, script_config.ontouch_name);
- map_forcountinarea(npc_touch_areanpc_sub,nd->bl.m,nd->bl.x - xs,nd->bl.y - ys,nd->bl.x + xs,nd->bl.y + ys,1,BL_PC,sd->bl.id,name);
+ iMap->forcountinarea(npc_touch_areanpc_sub,nd->bl.m,nd->bl.x - xs,nd->bl.y - ys,nd->bl.x + xs,nd->bl.y + ys,1,BL_PC,sd->bl.id,name);
}
return 0;
}
@@ -928,9 +922,8 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y)
//if(sd->npc_id)
// return 1;
- for(i=0;i<map[m].npc_num;i++)
- {
- if (map[m].npc[i]->sc.option&OPTION_INVISIBLE) {
+ for(i=0;i<map[m].npc_num;i++) {
+ if (map[m].npc[i]->option&OPTION_INVISIBLE) {
f=0; // a npc was found, but it is disabled; don't print warning
continue;
}
@@ -961,7 +954,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y)
case WARP:
if( pc_ishiding(sd) || (sd->sc.count && sd->sc.data[SC_CAMOUFLAGE]) )
break; // hidden chars cannot use warps
- pc_setpos(sd,map[m].npc[i]->u.warp.mapindex,map[m].npc[i]->u.warp.x,map[m].npc[i]->u.warp.y,CLR_OUTSIGHT);
+ iPc->setpos(sd,map[m].npc[i]->u.warp.mapindex,map[m].npc[i]->u.warp.x,map[m].npc[i]->u.warp.y,CLR_OUTSIGHT);
break;
case SCRIPT:
for (j = i; j < map[m].npc_num; j++) {
@@ -973,7 +966,7 @@ int npc_touch_areanpc(struct map_session_data* sd, int16 m, int16 x, int16 y)
(sd->bl.y >= (map[m].npc[j]->bl.y - map[m].npc[j]->u.warp.ys) && sd->bl.y <= (map[m].npc[j]->bl.y + map[m].npc[j]->u.warp.ys))) {
if( pc_ishiding(sd) || (sd->sc.count && sd->sc.data[SC_CAMOUFLAGE]) )
break; // hidden chars cannot use warps
- pc_setpos(sd,map[m].npc[j]->u.warp.mapindex,map[m].npc[j]->u.warp.x,map[m].npc[j]->u.warp.y,CLR_OUTSIGHT);
+ iPc->setpos(sd,map[m].npc[j]->u.warp.mapindex,map[m].npc[j]->u.warp.x,map[m].npc[j]->u.warp.y,CLR_OUTSIGHT);
found_warp = 1;
break;
}
@@ -1008,13 +1001,11 @@ int npc_touch_areanpc2(struct mob_data *md)
struct event_data* ev;
int xs, ys;
- for( i = 0; i < map[m].npc_num; i++ )
- {
- if( map[m].npc[i]->sc.option&OPTION_INVISIBLE )
+ for( i = 0; i < map[m].npc_num; i++ ) {
+ if( map[m].npc[i]->option&OPTION_INVISIBLE )
continue;
- switch( map[m].npc[i]->subtype )
- {
+ switch( map[m].npc[i]->subtype ) {
case WARP:
if( !( battle_config.mob_warp&1 ) )
continue;
@@ -1034,7 +1025,7 @@ int npc_touch_areanpc2(struct mob_data *md)
switch( map[m].npc[i]->subtype )
{
case WARP:
- xs = map_mapindex2mapid(map[m].npc[i]->u.warp.mapindex);
+ xs = iMap->mapindex2mapid(map[m].npc[i]->u.warp.mapindex);
if( m < 0 )
break; // Cannot Warp between map servers
if( unit_warp(&md->bl, xs, map[m].npc[i]->u.warp.x, map[m].npc[i]->u.warp.y, CLR_OUTSIGHT) == 0 )
@@ -1049,7 +1040,7 @@ int npc_touch_areanpc2(struct mob_data *md)
md->areanpc_id = map[m].npc[i]->bl.id;
id = md->bl.id; // Stores Unique ID
run_script(ev->nd->u.scr.script, ev->pos, md->bl.id, ev->nd->bl.id);
- if( map_id2md(id) == NULL ) return 1; // Not Warped, but killed
+ if( iMap->id2md(id) == NULL ) return 1; // Not Warped, but killed
break;
}
@@ -1080,34 +1071,32 @@ int npc_check_areanpc(int flag, int16 m, int16 x, int16 y, int16 range)
i = 0;
for (ys = y0; ys <= y1 && !i; ys++) {
for(xs = x0; xs <= x1 && !i; xs++){
- if (map_getcell(m,xs,ys,CELL_CHKNPC))
+ if (iMap->getcell(m,xs,ys,CELL_CHKNPC))
i = 1;
}
}
if (!i) return 0; //No NPC_CELLs.
//Now check for the actual NPC on said range.
- for(i=0;i<map[m].npc_num;i++)
- {
- if (map[m].npc[i]->sc.option&OPTION_INVISIBLE)
+ for(i=0;i<map[m].npc_num;i++) {
+ if (map[m].npc[i]->option&OPTION_INVISIBLE)
continue;
- switch(map[m].npc[i]->subtype)
- {
- case WARP:
- if (!(flag&1))
- continue;
- xs=map[m].npc[i]->u.warp.xs;
- ys=map[m].npc[i]->u.warp.ys;
- break;
- case SCRIPT:
- if (!(flag&2))
+ switch(map[m].npc[i]->subtype) {
+ case WARP:
+ if (!(flag&1))
+ continue;
+ xs=map[m].npc[i]->u.warp.xs;
+ ys=map[m].npc[i]->u.warp.ys;
+ break;
+ case SCRIPT:
+ if (!(flag&2))
+ continue;
+ xs=map[m].npc[i]->u.scr.xs;
+ ys=map[m].npc[i]->u.scr.ys;
+ break;
+ default:
continue;
- xs=map[m].npc[i]->u.scr.xs;
- ys=map[m].npc[i]->u.scr.ys;
- break;
- default:
- continue;
}
if( x1 >= map[m].npc[i]->bl.x-xs && x0 <= map[m].npc[i]->bl.x+xs
@@ -1206,7 +1195,7 @@ int npc_click(struct map_session_data* sd, struct npc_data* nd)
if ((nd = npc_checknear(sd,&nd->bl)) == NULL)
return 1;
//Hidden/Disabled npc.
- if (nd->class_ < 0 || nd->sc.option&(OPTION_INVISIBLE|OPTION_HIDE))
+ if (nd->class_ < 0 || nd->option&(OPTION_INVISIBLE|OPTION_HIDE))
return 1;
switch(nd->subtype) {
@@ -1235,8 +1224,8 @@ int npc_scriptcont(struct map_session_data* sd, int id, bool closing)
nullpo_retr(1, sd);
if( id != sd->npc_id ){
- TBL_NPC* nd_sd=(TBL_NPC*)map_id2bl(sd->npc_id);
- TBL_NPC* nd=(TBL_NPC*)map_id2bl(id);
+ TBL_NPC* nd_sd=(TBL_NPC*)iMap->id2bl(sd->npc_id);
+ TBL_NPC* nd=(TBL_NPC*)iMap->id2bl(id);
ShowDebug("npc_scriptcont: %s (sd->npc_id=%d) is not %s (id=%d).\n",
nd_sd?(char*)nd_sd->name:"'Unknown NPC'", (int)sd->npc_id,
nd?(char*)nd->name:"'Unknown NPC'", (int)id);
@@ -1244,7 +1233,7 @@ int npc_scriptcont(struct map_session_data* sd, int id, bool closing)
}
if(id != fake_nd->bl.id) { // Not item script
- if ((npc_checknear(sd,map_id2bl(id))) == NULL){
+ if ((npc_checknear(sd,iMap->id2bl(id))) == NULL){
ShowWarning("npc_scriptcont: failed npc_checknear test.\n");
return 1;
}
@@ -1262,7 +1251,7 @@ int npc_scriptcont(struct map_session_data* sd, int id, bool closing)
/**
* WPE can get to this point with a progressbar; we deny it.
**/
- if( sd->progressbar.npc_id && DIFF_TICK(sd->progressbar.timeout,gettick()) > 0 )
+ if( sd->progressbar.npc_id && DIFF_TICK(sd->progressbar.timeout,iTimer->gettick()) > 0 )
return 1;
if( closing && sd->st->state == CLOSE )
@@ -1282,7 +1271,7 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type)
nullpo_retr(1, sd);
- if ((nd = npc_checknear(sd,map_id2bl(id))) == NULL)
+ if ((nd = npc_checknear(sd,iMap->id2bl(id))) == NULL)
return 1;
if (nd->subtype!=SHOP) {
@@ -1291,7 +1280,7 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type)
sd->npc_id=0;
return 1;
}
- if (nd->sc.option & OPTION_INVISIBLE) // can't buy if npc is not visible (hack?)
+ if (nd->option & OPTION_INVISIBLE) // can't buy if npc is not visible (hack?)
return 1;
if( nd->class_ < 0 && !sd->state.callshop )
{// not called through a script and is not a visible NPC so an invalid call
@@ -1315,7 +1304,7 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type)
int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, unsigned short* item_list)
{
int i, j, nameid, amount, new_, w, vt;
- struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
+ struct npc_data *nd = (struct npc_data *)iMap->id2bl(sd->npc_shopid);
if( !nd || nd->subtype != CASHSHOP )
return 1;
@@ -1346,7 +1335,7 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
amount = item_list[i*2+0] = 1;
}
- switch( pc_checkadditem(sd,nameid,amount) )
+ switch( iPc->checkadditem(sd,nameid,amount) )
{
case ADDITEM_NEW:
new_++;
@@ -1361,14 +1350,14 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
if( w + sd->weight > sd->max_weight )
return 3;
- if( pc_inventoryblank(sd) < new_ )
+ if( iPc->inventoryblank(sd) < new_ )
return 3;
if( points > vt ) points = vt;
// Payment Process ----------------------------------------------------
if( sd->kafraPoints < points || sd->cashPoints < (vt - points) )
return 6;
- pc_paycash(sd,vt,points);
+ iPc->paycash(sd,vt,points);
// Delivery Process ----------------------------------------------------
for( i = 0; i < count; i++ )
@@ -1384,7 +1373,7 @@ int npc_cashshop_buylist(struct map_session_data *sd, int points, int count, uns
{
item_tmp.nameid = nameid;
item_tmp.identify = 1;
- pc_additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
+ iPc->additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
}
}
@@ -1422,7 +1411,7 @@ static int npc_buylist_sub(struct map_session_data* sd, int n, unsigned short* i
*------------------------------------------*/
int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int points)
{
- struct npc_data *nd = (struct npc_data *)map_id2bl(sd->npc_shopid);
+ struct npc_data *nd = (struct npc_data *)iMap->id2bl(sd->npc_shopid);
struct item_data *item;
int i, price, w;
@@ -1454,10 +1443,10 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
amount = 1;
}
- switch( pc_checkadditem(sd, nameid, amount) )
+ switch( iPc->checkadditem(sd, nameid, amount) )
{
case ADDITEM_NEW:
- if( pc_inventoryblank(sd) == 0 )
+ if( iPc->inventoryblank(sd) == 0 )
return 3;
break;
case ADDITEM_OVERAMOUNT:
@@ -1483,7 +1472,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
if( (sd->kafraPoints < points) || (sd->cashPoints < price - points) )
return 6;
- pc_paycash(sd, price, points);
+ iPc->paycash(sd, price, points);
if( !pet_create_egg(sd, nameid) )
{
@@ -1492,7 +1481,7 @@ int npc_cashshop_buy(struct map_session_data *sd, int nameid, int amount, int po
item_tmp.nameid = nameid;
item_tmp.identify = 1;
- pc_additem(sd,&item_tmp, amount, LOG_TYPE_NPC);
+ iPc->additem(sd,&item_tmp, amount, LOG_TYPE_NPC);
}
return 0;
@@ -1511,7 +1500,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
nullpo_retr(3, sd);
nullpo_retr(3, item_list);
- nd = npc_checknear(sd,map_id2bl(sd->npc_shopid));
+ nd = npc_checknear(sd,iMap->id2bl(sd->npc_shopid));
if( nd == NULL )
return 3;
if( nd->subtype != SHOP )
@@ -1552,7 +1541,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
continue;
}
- switch( pc_checkadditem(sd,nameid,amount) ) {
+ switch( iPc->checkadditem(sd,nameid,amount) ) {
case ADDITEM_EXIST:
break;
@@ -1564,7 +1553,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
return 2;
}
- value = pc_modifybuyvalue(sd,value);
+ value = iPc->modifybuyvalue(sd,value);
z += (double)value * amount;
w += itemdb_weight(nameid) * amount;
@@ -1577,10 +1566,10 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
return 1; // Not enough Zeny
if( w + sd->weight > sd->max_weight )
return 2; // Too heavy
- if( pc_inventoryblank(sd) < new_ )
+ if( iPc->inventoryblank(sd) < new_ )
return 3; // Not enough space to store items
- pc_payzeny(sd,(int)z,LOG_TYPE_NPC, NULL);
+ iPc->payzeny(sd,(int)z,LOG_TYPE_NPC, NULL);
for( i = 0; i < n; ++i ) {
int nameid = item_list[i*2+1];
@@ -1594,12 +1583,12 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
item_tmp.nameid = nameid;
item_tmp.identify = 1;
- pc_additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
+ iPc->additem(sd,&item_tmp,amount,LOG_TYPE_NPC);
}
}
// custom merchant shop exp bonus
- if( battle_config.shop_exp > 0 && z > 0 && (skill_t = pc_checkskill2(sd,idx)) > 0 ) {
+ if( battle_config.shop_exp > 0 && z > 0 && (skill_t = iPc->checkskill2(sd,idx)) > 0 ) {
if( sd->status.skill[idx].flag >= SKILL_FLAG_REPLACED_LV_0 )
skill_t = sd->status.skill[idx].flag - SKILL_FLAG_REPLACED_LV_0;
@@ -1607,7 +1596,7 @@ int npc_buylist(struct map_session_data* sd, int n, unsigned short* item_list)
z = z * (double)skill_t * (double)battle_config.shop_exp/10000.;
if( z < 1 )
z = 1;
- pc_gainexp(sd,NULL,0,(int)z, false);
+ iPc->gainexp(sd,NULL,0,(int)z, false);
}
}
@@ -1684,7 +1673,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
nullpo_retr(1, sd);
nullpo_retr(1, item_list);
- if( ( nd = npc_checknear(sd, map_id2bl(sd->npc_shopid)) ) == NULL || nd->subtype != SHOP ) {
+ if( ( nd = npc_checknear(sd, iMap->id2bl(sd->npc_shopid)) ) == NULL || nd->subtype != SHOP ) {
return 1;
}
@@ -1711,7 +1700,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
continue;
}
- value = pc_modifysellvalue(sd, sd->inventory_data[idx]->value_sell);
+ value = iPc->modifysellvalue(sd, sd->inventory_data[idx]->value_sell);
z+= (double)value*amount;
}
@@ -1733,16 +1722,16 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
}
}
- pc_delitem(sd, idx, amount, 0, 6, LOG_TYPE_NPC);
+ iPc->delitem(sd, idx, amount, 0, 6, LOG_TYPE_NPC);
}
if( z > MAX_ZENY )
z = MAX_ZENY;
- pc_getzeny(sd, (int)z, LOG_TYPE_NPC, NULL);
+ iPc->getzeny(sd, (int)z, LOG_TYPE_NPC, NULL);
// custom merchant shop exp bonus
- if( battle_config.shop_exp > 0 && z > 0 && ( skill_t = pc_checkskill2(sd,idx) ) > 0) {
+ if( battle_config.shop_exp > 0 && z > 0 && ( skill_t = iPc->checkskill2(sd,idx) ) > 0) {
if( sd->status.skill[idx].flag >= SKILL_FLAG_REPLACED_LV_0 )
skill_t = sd->status.skill[idx].flag - SKILL_FLAG_REPLACED_LV_0;
@@ -1750,7 +1739,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
z = z * (double)skill_t * (double)battle_config.shop_exp/10000.;
if( z < 1 )
z = 1;
- pc_gainexp(sd, NULL, 0, (int)z, false);
+ iPc->gainexp(sd, NULL, 0, (int)z, false);
}
}
@@ -1759,8 +1748,7 @@ int npc_selllist(struct map_session_data* sd, int n, unsigned short* item_list)
//Atempt to remove an npc from a map
//This doesn't remove it from map_db
-int npc_remove_map(struct npc_data* nd)
-{
+int npc_remove_map(struct npc_data* nd) {
int16 m,i;
nullpo_retr(1, nd);
@@ -1769,7 +1757,7 @@ int npc_remove_map(struct npc_data* nd)
m = nd->bl.m;
clif->clearunit_area(&nd->bl,CLR_RESPAWN);
npc_unsetcells(nd);
- map_delblock(&nd->bl);
+ iMap->delblock(&nd->bl);
//Remove npc from map[].npc list. [Skotlex]
ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == nd );
if( i == map[m].npc_num ) return 2; //failed to find it?
@@ -1785,7 +1773,7 @@ int npc_remove_map(struct npc_data* nd)
*/
static int npc_unload_ev(DBKey key, DBData *data, va_list ap)
{
- struct event_data* ev = DB->data2ptr(data);
+ struct event_data* ev = iDB->data2ptr(data);
char* npcname = va_arg(ap, char *);
if(strcmp(ev->nd->exname,npcname)==0){
@@ -1810,7 +1798,7 @@ static int npc_unload_dup_sub(struct npc_data* nd, va_list args)
//Removes all npcs that are duplicates of the passed one. [Skotlex]
void npc_unload_duplicates(struct npc_data* nd)
{
- map_foreachnpc(npc_unload_dup_sub,nd->bl.id);
+ iMap->map_foreachnpc(npc_unload_dup_sub,nd->bl.id);
}
//Removes an npc from map and db.
@@ -1819,7 +1807,7 @@ int npc_unload(struct npc_data* nd, bool single) {
nullpo_ret(nd);
npc_remove_map(nd);
- map_deliddb(&nd->bl);
+ iMap->deliddb(&nd->bl);
if( single )
strdb_remove(npcname_db, nd->exname);
@@ -1855,14 +1843,14 @@ int npc_unload(struct npc_data* nd, bool single) {
for( bl = (struct block_list*)mapit->first(iter); mapit->exists(iter); bl = (struct block_list*)mapit->next(iter) ) {
struct map_session_data *sd = ((TBL_PC*)bl);
if( sd && sd->npc_timer_id != INVALID_TIMER ) {
- const struct TimerData *td = get_timer(sd->npc_timer_id);
+ const struct TimerData *td = iTimer->get_timer(sd->npc_timer_id);
if( td && td->id != nd->bl.id )
continue;
if( td && td->data )
ers_free(timer_event_ers, (void*)td->data);
- delete_timer(sd->npc_timer_id, npc_timerevent);
+ iTimer->delete_timer(sd->npc_timer_id, npc_timerevent);
sd->npc_timer_id = INVALID_TIMER;
}
}
@@ -1870,10 +1858,10 @@ int npc_unload(struct npc_data* nd, bool single) {
if (nd->u.scr.timerid != INVALID_TIMER) {
const struct TimerData *td;
- td = get_timer(nd->u.scr.timerid);
+ td = iTimer->get_timer(nd->u.scr.timerid);
if (td && td->data)
ers_free(timer_event_ers, (void*)td->data);
- delete_timer(nd->u.scr.timerid, npc_timerevent);
+ iTimer->delete_timer(nd->u.scr.timerid, npc_timerevent);
}
if (nd->u.scr.timer_event)
aFree(nd->u.scr.timer_event);
@@ -1892,6 +1880,11 @@ int npc_unload(struct npc_data* nd, bool single) {
guild->flag_remove(nd);
}
+ if( nd->ud != &npc_base_ud ) {
+ aFree(nd->ud);
+ nd->ud = NULL;
+ }
+
script_stop_sleeptimers(nd->bl.id);
aFree(nd);
@@ -2060,14 +2053,13 @@ static void npc_parsename(struct npc_data* nd, const char* name, const char* sta
}
//Add then display an npc warp on map
-struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y)
-{
+struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y) {
int i, flag = 0;
struct npc_data *nd;
CREATE(nd, struct npc_data, 1);
nd->bl.id = npc_get_new_npc_id();
- map_addnpc(from_mapid, nd);
+ iMap->addnpc(from_mapid, nd);
nd->bl.prev = nd->bl.next = NULL;
nd->bl.m = from_mapid;
nd->bl.x = from_x;
@@ -2098,10 +2090,9 @@ struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short
nd->bl.type = BL_NPC;
nd->subtype = WARP;
npc_setcells(nd);
- map_addblock(&nd->bl);
+ iMap->addblock(&nd->bl);
status_set_viewdata(&nd->bl, nd->class_);
- status_change_init(&nd->bl);
- unit_dataset(&nd->bl);
+ nd->ud = &npc_base_ud;
if( map[nd->bl.m].users )
clif->spawn(&nd->bl);
strdb_put(npcname_db, nd->exname, nd);
@@ -2126,7 +2117,7 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const
return strchr(start,'\n');// skip and continue
}
- m = map_mapname2mapid(mapname);
+ m = iMap->mapname2mapid(mapname);
i = mapindex_name2id(to_mapname);
if( i == 0 )
{
@@ -2142,7 +2133,7 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const
CREATE(nd, struct npc_data, 1);
nd->bl.id = npc_get_new_npc_id();
- map_addnpc(m, nd);
+ iMap->addnpc(m, nd);
nd->bl.prev = nd->bl.next = NULL;
nd->bl.m = m;
nd->bl.x = x;
@@ -2164,10 +2155,9 @@ static const char* npc_parse_warp(char* w1, char* w2, char* w3, char* w4, const
nd->bl.type = BL_NPC;
nd->subtype = WARP;
npc_setcells(nd);
- map_addblock(&nd->bl);
+ iMap->addblock(&nd->bl);
status_set_viewdata(&nd->bl, nd->class_);
- status_change_init(&nd->bl);
- unit_dataset(&nd->bl);
+ nd->ud = &npc_base_ud;
if( map[nd->bl.m].users )
clif->spawn(&nd->bl);
strdb_put(npcname_db, nd->exname, nd);
@@ -2198,7 +2188,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
return strchr(start,'\n');// skip and continue
}
- m = map_mapname2mapid(mapname);
+ m = iMap->mapname2mapid(mapname);
}
if( m != -1 && ( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys ) ) {
@@ -2275,19 +2265,16 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
++npc_shop;
nd->bl.type = BL_NPC;
nd->subtype = type;
- if( m >= 0 )
- {// normal shop npc
- map_addnpc(m,nd);
- map_addblock(&nd->bl);
+ if( m >= 0 ) {// normal shop npc
+ iMap->addnpc(m,nd);
+ iMap->addblock(&nd->bl);
status_set_viewdata(&nd->bl, nd->class_);
- status_change_init(&nd->bl);
- unit_dataset(&nd->bl);
- nd->ud.dir = dir;
+ nd->ud = &npc_base_ud;
+ nd->dir = dir;
if( map[nd->bl.m].users )
clif->spawn(&nd->bl);
- } else
- {// 'floating' shop?
- map_addiddb(&nd->bl);
+ } else {// 'floating' shop?
+ iMap->addiddb(&nd->bl);
}
strdb_put(npcname_db, nd->exname, nd);
@@ -2302,7 +2289,7 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const
int npc_convertlabel_db(DBKey key, DBData *data, va_list ap)
{
const char* lname = (const char*)key.str;
- int lpos = DB->data2i(data);
+ int lpos = iDB->data2i(data);
struct npc_label_list** label_list;
int* label_list_num;
const char* filepath;
@@ -2429,7 +2416,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
ShowError("npc_parse_script: Invalid placement format for a script in file '%s', line '%d'. Skipping the rest of file...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return NULL;// unknown format, don't continue
}
- m = map_mapname2mapid(mapname);
+ m = iMap->mapname2mapid(mapname);
}
script_start = strstr(start,",{");
@@ -2485,25 +2472,20 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons
nd->bl.type = BL_NPC;
nd->subtype = SCRIPT;
- if( m >= 0 )
- {
- map_addnpc(m, nd);
- status_change_init(&nd->bl);
- unit_dataset(&nd->bl);
- nd->ud.dir = dir;
+ if( m >= 0 ) {
+ iMap->addnpc(m, nd);
+ nd->ud = &npc_base_ud;
+ nd->dir = dir;
npc_setcells(nd);
- map_addblock(&nd->bl);
- if( class_ >= 0 )
- {
+ iMap->addblock(&nd->bl);
+ if( class_ >= 0 ) {
status_set_viewdata(&nd->bl, nd->class_);
if( map[nd->bl.m].users )
clif->spawn(&nd->bl);
}
- }
- else
- {
- // we skip map_addnpc, but still add it to the list of ID's
- map_addiddb(&nd->bl);
+ } else {
+ // we skip iMap->addnpc, but still add it to the list of ID's
+ iMap->addiddb(&nd->bl);
}
strdb_put(npcname_db, nd->exname, nd);
@@ -2576,19 +2558,16 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
type = dnd->subtype;
// get placement
- if( (type==SHOP || type==CASHSHOP || type==SCRIPT) && strcmp(w1, "-") == 0 )
- {// floating shop/chashshop/script
+ if( (type==SHOP || type==CASHSHOP || type==SCRIPT) && strcmp(w1, "-") == 0 ) {// floating shop/chashshop/script
x = y = dir = 0;
m = -1;
- }
- else
- {
+ } else {
if( sscanf(w1, "%31[^,],%d,%d,%d", mapname, &x, &y, &dir) != 4 )// <map name>,<x>,<y>,<facing>
{
ShowError("npc_parse_duplicate: Invalid placement format for duplicate in file '%s', line '%d'. Skipping line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return end;// next line, try to continue
}
- m = map_mapname2mapid(mapname);
+ m = iMap->mapname2mapid(mapname);
}
if( m != -1 && ( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys ) ) {
@@ -2599,8 +2578,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
if( type == WARP && sscanf(w4, "%d,%d", &xs, &ys) == 2 );// <spanx>,<spany>
else if( type == SCRIPT && sscanf(w4, "%d,%d,%d", &class_, &xs, &ys) == 3);// <sprite id>,<triggerX>,<triggerY>
else if( type != WARP ) class_ = atoi(w4);// <sprite id>
- else
- {
+ else {
ShowError("npc_parse_duplicate: Invalid span format for duplicate warp in file '%s', line '%d'. Skipping line...\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return end;// next line, try to continue
}
@@ -2618,58 +2596,52 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
nd->src_id = src_id;
nd->bl.type = BL_NPC;
nd->subtype = (enum npc_subtype)type;
- switch( type )
- {
- case SCRIPT:
- ++npc_script;
- nd->u.scr.xs = xs;
- nd->u.scr.ys = ys;
- nd->u.scr.script = dnd->u.scr.script;
- nd->u.scr.label_list = dnd->u.scr.label_list;
- nd->u.scr.label_list_num = dnd->u.scr.label_list_num;
- break;
-
- case SHOP:
- case CASHSHOP:
- ++npc_shop;
- nd->u.shop.shop_item = dnd->u.shop.shop_item;
- nd->u.shop.count = dnd->u.shop.count;
- break;
-
- case WARP:
- ++npc_warp;
- if( !battle_config.warp_point_debug )
- nd->class_ = WARP_CLASS;
- else
- nd->class_ = WARP_DEBUG_CLASS;
- nd->u.warp.xs = xs;
- nd->u.warp.ys = ys;
- nd->u.warp.mapindex = dnd->u.warp.mapindex;
- nd->u.warp.x = dnd->u.warp.x;
- nd->u.warp.y = dnd->u.warp.y;
- break;
+ switch( type ) {
+ case SCRIPT:
+ ++npc_script;
+ nd->u.scr.xs = xs;
+ nd->u.scr.ys = ys;
+ nd->u.scr.script = dnd->u.scr.script;
+ nd->u.scr.label_list = dnd->u.scr.label_list;
+ nd->u.scr.label_list_num = dnd->u.scr.label_list_num;
+ break;
+
+ case SHOP:
+ case CASHSHOP:
+ ++npc_shop;
+ nd->u.shop.shop_item = dnd->u.shop.shop_item;
+ nd->u.shop.count = dnd->u.shop.count;
+ break;
+
+ case WARP:
+ ++npc_warp;
+ if( !battle_config.warp_point_debug )
+ nd->class_ = WARP_CLASS;
+ else
+ nd->class_ = WARP_DEBUG_CLASS;
+ nd->u.warp.xs = xs;
+ nd->u.warp.ys = ys;
+ nd->u.warp.mapindex = dnd->u.warp.mapindex;
+ nd->u.warp.x = dnd->u.warp.x;
+ nd->u.warp.y = dnd->u.warp.y;
+ break;
}
//Add the npc to its location
- if( m >= 0 )
- {
- map_addnpc(m, nd);
- status_change_init(&nd->bl);
- unit_dataset(&nd->bl);
- nd->ud.dir = dir;
+ if( m >= 0 ) {
+ iMap->addnpc(m, nd);
+ nd->ud = &npc_base_ud;
+ nd->dir = dir;
npc_setcells(nd);
- map_addblock(&nd->bl);
- if( class_ >= 0 )
- {
+ iMap->addblock(&nd->bl);
+ if( class_ >= 0 ) {
status_set_viewdata(&nd->bl, nd->class_);
if( map[nd->bl.m].users )
clif->spawn(&nd->bl);
}
- }
- else
- {
- // we skip map_addnpc, but still add it to the list of ID's
- map_addiddb(&nd->bl);
+ } else {
+ // we skip iMap->addnpc, but still add it to the list of ID's
+ iMap->addiddb(&nd->bl);
}
strdb_put(npcname_db, nd->exname, nd);
@@ -2694,32 +2666,28 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch
int npc_duplicate4instance(struct npc_data *snd, int16 m) {
char newname[NAME_LENGTH];
- if( map[m].instance_id == 0 )
+ if( map[m].instance_id == -1 )
return 1;
snprintf(newname, ARRAYLENGTH(newname), "dup_%d_%d", map[m].instance_id, snd->bl.id);
- if( npc_name2id(newname) != NULL )
- { // Name already in use
+ if( npc_name2id(newname) != NULL ) { // Name already in use
ShowError("npc_duplicate4instance: the npcname (%s) is already in use while trying to duplicate npc %s in instance %d.\n", newname, snd->exname, map[m].instance_id);
return 1;
}
- if( snd->subtype == WARP )
- { // Adjust destination, if instanced
+ if( snd->subtype == WARP ) { // Adjust destination, if instanced
struct npc_data *wnd = NULL; // New NPC
- int dm = map_mapindex2mapid(snd->u.warp.mapindex), im;
+ int dm = iMap->mapindex2mapid(snd->u.warp.mapindex), im;
if( dm < 0 ) return 1;
- im = instance_mapid2imapid(dm, map[m].instance_id);
- if( im == -1 )
- {
+ if( ( im = instance->mapid2imapid(dm, map[m].instance_id) ) == -1 ) {
ShowError("npc_duplicate4instance: warp (%s) leading to instanced map (%s), but instance map is not attached to current instance.\n", map[dm].name, snd->exname);
return 1;
}
CREATE(wnd, struct npc_data, 1);
wnd->bl.id = npc_get_new_npc_id();
- map_addnpc(m, wnd);
+ iMap->addnpc(m, wnd);
wnd->bl.prev = wnd->bl.next = NULL;
wnd->bl.m = m;
wnd->bl.x = snd->bl.x;
@@ -2736,20 +2704,17 @@ int npc_duplicate4instance(struct npc_data *snd, int16 m) {
wnd->bl.type = BL_NPC;
wnd->subtype = WARP;
npc_setcells(wnd);
- map_addblock(&wnd->bl);
+ iMap->addblock(&wnd->bl);
status_set_viewdata(&wnd->bl, wnd->class_);
- status_change_init(&wnd->bl);
- unit_dataset(&wnd->bl);
+ wnd->ud = &npc_base_ud;
if( map[wnd->bl.m].users )
clif->spawn(&wnd->bl);
strdb_put(npcname_db, wnd->exname, wnd);
- }
- else
- {
+ } else {
static char w1[50], w2[50], w3[50], w4[50];
const char* stat_buf = "- call from instancing subsystem -\n";
- snprintf(w1, sizeof(w1), "%s,%d,%d,%d", map[m].name, snd->bl.x, snd->bl.y, snd->ud.dir);
+ snprintf(w1, sizeof(w1), "%s,%d,%d,%d", map[m].name, snd->bl.x, snd->bl.y, snd->dir);
snprintf(w2, sizeof(w2), "duplicate(%s)", snd->exname);
snprintf(w3, sizeof(w3), "%s::%s", snd->name, newname);
@@ -2765,39 +2730,36 @@ int npc_duplicate4instance(struct npc_data *snd, int16 m) {
}
//Set mapcell CELL_NPC to trigger event later
-void npc_setcells(struct npc_data* nd)
-{
+void npc_setcells(struct npc_data* nd) {
int16 m = nd->bl.m, x = nd->bl.x, y = nd->bl.y, xs, ys;
int i,j;
- switch(nd->subtype)
- {
- case WARP:
- xs = nd->u.warp.xs;
- ys = nd->u.warp.ys;
- break;
- case SCRIPT:
- xs = nd->u.scr.xs;
- ys = nd->u.scr.ys;
- break;
- default:
- return; // Other types doesn't have touch area
+ switch(nd->subtype) {
+ case WARP:
+ xs = nd->u.warp.xs;
+ ys = nd->u.warp.ys;
+ break;
+ case SCRIPT:
+ xs = nd->u.scr.xs;
+ ys = nd->u.scr.ys;
+ break;
+ default:
+ return; // Other types doesn't have touch area
}
- if (m < 0 || xs < 0 || ys < 0) //invalid range or map
+ if (m < 0 || xs < 0 || ys < 0 || map[m].cell == (struct mapcell *)0xdeadbeaf) //invalid range or map
return;
for (i = y-ys; i <= y+ys; i++) {
for (j = x-xs; j <= x+xs; j++) {
- if (map_getcell(m, j, i, CELL_CHKNOPASS))
+ if (iMap->getcell(m, j, i, CELL_CHKNOPASS))
continue;
- map_setcell(m, j, i, CELL_NPC, true);
+ map[m].setcell(m, j, i, CELL_NPC, true);
}
}
}
-int npc_unsetcells_sub(struct block_list* bl, va_list ap)
-{
+int npc_unsetcells_sub(struct block_list* bl, va_list ap) {
struct npc_data *nd = (struct npc_data*)bl;
int id = va_arg(ap,int);
if (nd->bl.id == id) return 0;
@@ -2805,8 +2767,7 @@ int npc_unsetcells_sub(struct block_list* bl, va_list ap)
return 1;
}
-void npc_unsetcells(struct npc_data* nd)
-{
+void npc_unsetcells(struct npc_data* nd) {
int16 m = nd->bl.m, x = nd->bl.x, y = nd->bl.y, xs, ys;
int i,j, x0, x1, y0, y1;
@@ -2818,23 +2779,23 @@ void npc_unsetcells(struct npc_data* nd)
ys = nd->u.scr.ys;
}
- if (m < 0 || xs < 0 || ys < 0)
+ if (m < 0 || xs < 0 || ys < 0 || map[m].cell == (struct mapcell *)0xdeadbeaf)
return;
//Locate max range on which we can locate npc cells
//FIXME: does this really do what it's supposed to do? [ultramage]
- for(x0 = x-xs; x0 > 0 && map_getcell(m, x0, y, CELL_CHKNPC); x0--);
- for(x1 = x+xs; x1 < map[m].xs-1 && map_getcell(m, x1, y, CELL_CHKNPC); x1++);
- for(y0 = y-ys; y0 > 0 && map_getcell(m, x, y0, CELL_CHKNPC); y0--);
- for(y1 = y+ys; y1 < map[m].ys-1 && map_getcell(m, x, y1, CELL_CHKNPC); y1++);
+ for(x0 = x-xs; x0 > 0 && iMap->getcell(m, x0, y, CELL_CHKNPC); x0--);
+ for(x1 = x+xs; x1 < map[m].xs-1 && iMap->getcell(m, x1, y, CELL_CHKNPC); x1++);
+ for(y0 = y-ys; y0 > 0 && iMap->getcell(m, x, y0, CELL_CHKNPC); y0--);
+ for(y1 = y+ys; y1 < map[m].ys-1 && iMap->getcell(m, x, y1, CELL_CHKNPC); y1++);
//Erase this npc's cells
for (i = y-ys; i <= y+ys; i++)
for (j = x-xs; j <= x+xs; j++)
- map_setcell(m, j, i, CELL_NPC, false);
+ map[m].setcell(m, j, i, CELL_NPC, false);
//Re-deploy NPC cells for other nearby npcs.
- map_foreachinarea( npc_unsetcells_sub, m, x0, y0, x1, y1, BL_NPC, nd->bl.id );
+ iMap->foreachinarea( npc_unsetcells_sub, m, x0, y0, x1, y1, BL_NPC, nd->bl.id );
}
void npc_movenpc(struct npc_data* nd, int16 x, int16 y)
@@ -2845,9 +2806,9 @@ void npc_movenpc(struct npc_data* nd, int16 x, int16 y)
x = cap_value(x, 0, map[m].xs-1);
y = cap_value(y, 0, map[m].ys-1);
- map_foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
- map_moveblock(&nd->bl, x, y, gettick());
- map_foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
+ iMap->foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
+ iMap->moveblock(&nd->bl, x, y, iTimer->gettick());
+ iMap->foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
}
/// Changes the display name of the npc.
@@ -2910,7 +2871,7 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c
return 1;
}
- if( ev->nd->sc.option&OPTION_INVISIBLE ) { // Disabled npc, shouldn't trigger event.
+ if( ev->nd->option&OPTION_INVISIBLE ) { // Disabled npc, shouldn't trigger event.
npc_event_dequeue(sd);
return 2;
}
@@ -2972,9 +2933,9 @@ static const char* npc_parse_function(char* w1, char* w2, char* w3, char* w4, co
return end;
func_db = script_get_userfunc_db();
- if (func_db->put(func_db, DB->str2key(w3), DB->ptr2data(script), &old_data))
+ if (func_db->put(func_db, iDB->str2key(w3), iDB->ptr2data(script), &old_data))
{
- struct script_code *oldscript = (struct script_code*)DB->data2ptr(&old_data);
+ struct script_code *oldscript = (struct script_code*)iDB->data2ptr(&old_data);
ShowInfo("npc_parse_function: Overwriting user function [%s] (%s:%d)\n", w3, filepath, strline(buffer,start-buffer));
script_free_vars(oldscript->script_vars);
aFree(oldscript->script_buf);
@@ -2994,8 +2955,7 @@ void npc_parse_mob2(struct spawn_data* mob)
{
int i;
- for( i = mob->active; i < mob->num; ++i )
- {
+ for( i = mob->active; i < mob->num; ++i ) {
struct mob_data* md = mob_spawn_dataset(mob);
md->spawn = mob;
md->spawn->active++;
@@ -3030,7 +2990,7 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c
ShowError("npc_parse_mob: Unknown map '%s' in file '%s', line '%d'.\n", mapname, filepath, strline(buffer,start-buffer));
return strchr(start,'\n');// skip and continue
}
- m = map_mapname2mapid(mapname);
+ m = iMap->mapname2mapid(mapname);
if( m < 0 )//Not loaded on this map-server instance.
return strchr(start,'\n');// skip and continue
mob.m = (unsigned short)m;
@@ -3150,19 +3110,17 @@ static const char* npc_parse_mob(char* w1, char* w2, char* w3, char* w4, const c
memcpy(data, &mob, sizeof(struct spawn_data));
// spawn / cache the new mobs
- if( battle_config.dynamic_mobs && map_addmobtolist(data->m, data) >= 0 )
- {
+ if( battle_config.dynamic_mobs && iMap->addmobtolist(data->m, data) >= 0 ) {
data->state.dynamic = true;
npc_cache_mob += data->num;
// check if target map has players
// (usually shouldn't occur when map server is just starting,
// but not the case when we do @reloadscript
- if( map[data->m].users > 0 )
+ if( map[data->m].users > 0 ) {
npc_parse_mob2(data);
- }
- else
- {
+ }
+ } else {
data->state.dynamic = false;
npc_parse_mob2(data);
npc_delay_mob += data->num;
@@ -3188,7 +3146,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
ShowError("npc_parse_mapflag: Invalid mapflag definition in file '%s', line '%d'.\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
return strchr(start,'\n');// skip and continue
}
- m = map_mapname2mapid(mapname);
+ m = iMap->mapname2mapid(mapname);
if( m < 0 )
{
ShowWarning("npc_parse_mapflag: Unknown map in file '%s', line '%d' : %s\n * w1=%s\n * w2=%s\n * w3=%s\n * w4=%s\n", mapname, filepath, strline(buffer,start-buffer), w1, w2, w3, w4);
@@ -3257,7 +3215,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
ShowWarning("npc_parse_mapflag: You can't set PvP and BattleGround flags for the same map! Removing BattleGround flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer));
}
if( state && (zone = strdb_get(zone_db, MAP_ZONE_PVP_NAME)) && map[m].zone != zone ) {
- map_zone_change(m,zone,start,buffer,filepath);
+ iMap->zone_change(m,zone,start,buffer,filepath);
} else if ( !state ) {
map[m].zone = &map_zone_pk;
}
@@ -3282,16 +3240,11 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
else if (!strcmpi(drop_arg2,"all"))
drop_type = 3;
- if (drop_id != 0){
- int i;
- for (i = 0; i < MAX_DROP_PER_MAP; i++) {
- if (map[m].drop_list[i].drop_id == 0){
- map[m].drop_list[i].drop_id = drop_id;
- map[m].drop_list[i].drop_type = drop_type;
- map[m].drop_list[i].drop_per = drop_per;
- break;
- }
- }
+ if (drop_id != 0) {
+ RECREATE(map[m].drop_list, struct map_drop_list, ++map[m].drop_list_count);
+ map[m].drop_list[map[m].drop_list_count-1].drop_id = drop_id;
+ map[m].drop_list[map[m].drop_list_count-1].drop_type = drop_type;
+ map[m].drop_list[map[m].drop_list_count-1].drop_per = drop_per;
map[m].flag.pvp_nightmaredrop = 1;
}
} else if (!state) //Disable
@@ -3312,7 +3265,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
ShowWarning("npc_parse_mapflag: You can't set GvG and BattleGround flags for the same map! Removing BattleGround flag from %s (file '%s', line '%d').\n", map[m].name, filepath, strline(buffer,start-buffer));
}
if( state && (zone = strdb_get(zone_db, MAP_ZONE_GVG_NAME)) && map[m].zone != zone ) {
- map_zone_change(m,zone,start,buffer,filepath);
+ iMap->zone_change(m,zone,start,buffer,filepath);
}
}
else if (!strcmpi(w3,"gvg_noparty"))
@@ -3347,7 +3300,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
}
if( state && (zone = strdb_get(zone_db, MAP_ZONE_BG_NAME)) && map[m].zone != zone ) {
- map_zone_change(m,zone,start,buffer,filepath);
+ iMap->zone_change(m,zone,start,buffer,filepath);
}
}
else if (!strcmpi(w3,"noexppenalty"))
@@ -3540,7 +3493,7 @@ const char* npc_parse_mapflag(char* w1, char* w2, char* w3, char* w4, const char
if( !(zone = strdb_get(zone_db, w4)) ) {
ShowWarning("npc_parse_mapflag: Invalid zone '%s'! removing flag from %s (file '%s', line '%d').\n", w4, map[m].name, filepath, strline(buffer,start-buffer));
} else if( map[m].zone != zone ) {
- map_zone_change(m,zone,start,buffer,filepath);
+ iMap->zone_change(m,zone,start,buffer,filepath);
}
} else if ( !strcmpi(w3,"nomapchannelautojoin") ) {
map[m].flag.chsysnolocalaj = state;
@@ -3666,7 +3619,7 @@ void npc_parsesrcfile(const char* filepath, bool runOnInit)
p = strchr(p,'\n');// next line
continue;
}
- m = map_mapname2mapid(mapname);
+ m = iMap->mapname2mapid(mapname);
if( m < 0 )
{// "mapname" is not assigned to this server, we must skip the script info...
if( strcasecmp(w2,"script") == 0 && count > 3 )
@@ -3776,7 +3729,7 @@ void npc_read_event_script(void)
for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) )
{
const char* p = key.str;
- struct event_data* ed = DB->data2ptr(data);
+ struct event_data* ed = iDB->data2ptr(data);
unsigned char count = script_event[i].event_count;
if( count >= ARRAYLENGTH(script_event[i].event) )
@@ -3851,7 +3804,7 @@ int npc_reload(void) {
if(battle_config.dynamic_mobs)
{// dynamic check by [random]
- for (m = 0; m < map_num; m++) {
+ for (m = 0; m < iMap->map_num; m++) {
for (i = 0; i < MAX_MOB_LIST_PER_MAP; i++) {
if (map[m].moblist[i] != NULL) {
aFree(map[m].moblist[i]);
@@ -3859,7 +3812,7 @@ int npc_reload(void) {
}
if( map[m].mob_delete_timer != INVALID_TIMER )
{ // Mobs were removed anyway,so delete the timer [Inkfish]
- delete_timer(map[m].mob_delete_timer, map_removemobs_timer);
+ iTimer->delete_timer(map[m].mob_delete_timer, iMap->removemobs_timer);
map[m].mob_delete_timer = INVALID_TIMER;
}
}
@@ -3875,7 +3828,7 @@ int npc_reload(void) {
npc_mob = npc_cache_mob = npc_delay_mob = 0;
// reset mapflags
- map_flags_init();
+ iMap->flags_init();
//TODO: the following code is copy-pasted from do_init_npc(); clean it up
// Reloading npcs now
@@ -3892,12 +3845,11 @@ int npc_reload(void) {
"\t-'"CL_WHITE"%d"CL_RESET"' Mobs Not Cached\n",
npc_id - npc_new_min, npc_warp, npc_shop, npc_script, npc_mob, npc_cache_mob, npc_delay_mob);
- do_final_instance();
+ instance->final();
- for( i = 0; i < ARRAYLENGTH(instance); ++i )
- instance_init(instance[i].instance_id);
-
- map_zone_init();
+ iMap->zone_init();
+
+ npc->motd = npc_name2id("HerculesMOTD"); /* [Ind/Hercules] */
//Re-read the NPC Script Events cache.
npc_read_event_script();
@@ -3964,18 +3916,18 @@ static void npc_debug_warps_sub(struct npc_data* nd)
if (nd->bl.type != BL_NPC || nd->subtype != WARP || nd->bl.m < 0)
return;
- m = map_mapindex2mapid(nd->u.warp.mapindex);
+ m = iMap->mapindex2mapid(nd->u.warp.mapindex);
if (m < 0) return; //Warps to another map, nothing to do about it.
if (nd->u.warp.x == 0 && nd->u.warp.y == 0) return; // random warp
- if (map_getcell(m, nd->u.warp.x, nd->u.warp.y, CELL_CHKNPC)) {
+ if (iMap->getcell(m, nd->u.warp.x, nd->u.warp.y, CELL_CHKNPC)) {
ShowWarning("Warp %s at %s(%d,%d) warps directly on top of an area npc at %s(%d,%d)\n",
nd->name,
map[nd->bl.m].name, nd->bl.x, nd->bl.y,
map[m].name, nd->u.warp.x, nd->u.warp.y
);
}
- if (map_getcell(m, nd->u.warp.x, nd->u.warp.y, CELL_CHKNOPASS)) {
+ if (iMap->getcell(m, nd->u.warp.x, nd->u.warp.y, CELL_CHKNOPASS)) {
ShowWarning("Warp %s at %s(%d,%d) warps to a non-walkable tile at %s(%d,%d)\n",
nd->name,
map[nd->bl.m].name, nd->bl.x, nd->bl.y,
@@ -3987,7 +3939,7 @@ static void npc_debug_warps_sub(struct npc_data* nd)
static void npc_debug_warps(void)
{
int16 m, i;
- for (m = 0; m < map_num; m++)
+ for (m = 0; m < iMap->map_num; m++)
for (i = 0; i < map[m].npc_num; i++)
npc_debug_warps_sub(map[m].npc[i]);
}
@@ -4000,8 +3952,18 @@ int do_init_npc(void)
struct npc_src_list *file;
int i;
+ memset(&npc_base_ud, 0, sizeof( struct unit_data) );
+ npc_base_ud.bl = NULL;
+ npc_base_ud.walktimer = INVALID_TIMER;
+ npc_base_ud.skilltimer = INVALID_TIMER;
+ npc_base_ud.attacktimer = INVALID_TIMER;
+ npc_base_ud.attackabletime =
+ npc_base_ud.canact_tick =
+ npc_base_ud.canmove_tick = iTimer->gettick();
+
//Stock view data for normal npcs.
memset(&npc_viewdb, 0, sizeof(npc_viewdb));
+
npc_viewdb[0].class_ = INVISIBLE_CLASS; //Invisible class is stored here.
for( i = 1; i < MAX_NPC_CLASS; i++ )
npc_viewdb[i].class_ = i;
@@ -4028,8 +3990,10 @@ int do_init_npc(void)
"\t-'"CL_WHITE"%d"CL_RESET"' Mobs Cached\n"
"\t-'"CL_WHITE"%d"CL_RESET"' Mobs Not Cached\n",
npc_id - START_NPC_NUM, npc_warp, npc_shop, npc_script, npc_mob, npc_cache_mob, npc_delay_mob);
-
- map_zone_init();
+
+ iMap->zone_init();
+
+ npc->motd = npc_name2id("HerculesMOTD"); /* [Ind/Hercules] */
// set up the events cache
memset(script_event, 0, sizeof(script_event));
@@ -4039,8 +4003,8 @@ int do_init_npc(void)
if (battle_config.warp_point_debug)
npc_debug_warps();
- add_timer_func_list(npc_event_do_clock,"npc_event_do_clock");
- add_timer_func_list(npc_timerevent,"npc_timerevent");
+ iTimer->add_timer_func_list(npc_event_do_clock,"npc_event_do_clock");
+ iTimer->add_timer_func_list(npc_timerevent,"npc_timerevent");
// Init dummy NPC
fake_nd = (struct npc_data *)aCalloc(1,sizeof(struct npc_data));
@@ -4057,8 +4021,13 @@ int do_init_npc(void)
strdb_put(npcname_db, fake_nd->exname, fake_nd);
fake_nd->u.scr.timerid = INVALID_TIMER;
- map_addiddb(&fake_nd->bl);
+ iMap->addiddb(&fake_nd->bl);
// End of initialization
return 0;
}
+void npc_defaults(void) {
+ npc = &npc_s;
+
+ npc->motd = NULL;
+}
diff --git a/src/map/npc.h b/src/map/npc.h
index 8800b4e5b..16e6fe74c 100644
--- a/src/map/npc.h
+++ b/src/map/npc.h
@@ -1,5 +1,6 @@
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see LICENCE in the main folder
+// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// See the LICENSE file
+// Portions Copyright (c) Athena Dev Teams
#ifndef _NPC_H_
#define _NPC_H_
@@ -11,6 +12,7 @@ struct block_list;
struct npc_data;
struct view_data;
+struct unit_data npc_base_ud;
struct npc_timerevent_list {
int timer,pos;
@@ -25,9 +27,9 @@ struct npc_item_list {
struct npc_data {
struct block_list bl;
- struct unit_data ud; //Because they need to be able to move....
+ struct unit_data *ud;
struct view_data *vd;
- struct status_change sc; //They can't have status changes, but.. they want the visual opt values.
+ unsigned int option;
struct npc_data *master_nd;
short class_;
short speed;
@@ -36,12 +38,13 @@ struct npc_data {
int chat_id;
int touching_id;
unsigned int next_walktime;
-
+ uint8 dir;
+
unsigned size : 2;
struct status_data status;
- unsigned int level;
- unsigned int stat_point;
+ unsigned short level;
+ unsigned short stat_point;
void* chatdb; // pointer to a npc_parse struct (see npc_chat.c)
char* path;/* path dir */
@@ -188,4 +191,15 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c
bool npc_unloadfile( const char* path );
+/* npc.c interface (barely started/WIP) */
+struct npc_interface {
+ /* */
+ struct npc_data *motd;
+ /* */
+} npc_s;
+
+struct npc_interface *npc;
+
+void npc_defaults(void);
+
#endif /* _NPC_H_ */
diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c
index 81373bbb6..c7faa2df6 100644
--- a/src/map/npc_chat.c
+++ b/src/map/npc_chat.c
@@ -411,7 +411,7 @@ int buildin_defpattern(struct script_state* st)
int setid = script->conv_num(st,& (st->stack->stack_data[st->start+2]));
const char* pattern = script->conv_str(st,& (st->stack->stack_data[st->start+3]));
const char* label = script->conv_str(st,& (st->stack->stack_data[st->start+4]));
- struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
+ struct npc_data* nd = (struct npc_data *)iMap->id2bl(st->oid);
npc_chat_def_pattern(nd, setid, pattern, label);
@@ -421,7 +421,7 @@ int buildin_defpattern(struct script_state* st)
int buildin_activatepset(struct script_state* st)
{
int setid = script->conv_num(st,& (st->stack->stack_data[st->start+2]));
- struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
+ struct npc_data* nd = (struct npc_data *)iMap->id2bl(st->oid);
activate_pcreset(nd, setid);
@@ -431,7 +431,7 @@ int buildin_activatepset(struct script_state* st)
int buildin_deactivatepset(struct script_state* st)
{
int setid = script->conv_num(st,& (st->stack->stack_data[st->start+2]));
- struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
+ struct npc_data* nd = (struct npc_data *)iMap->id2bl(st->oid);
deactivate_pcreset(nd, setid);
@@ -441,7 +441,7 @@ int buildin_deactivatepset(struct script_state* st)
int buildin_deletepset(struct script_state* st)
{
int setid = script->conv_num(st,& (st->stack->stack_data[st->start+2]));
- struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
+ struct npc_data* nd = (struct npc_data *)iMap->id2bl(st->oid);
delete_pcreset(nd, setid);
diff --git a/src/map/packets.h b/src/map/packets.h
index 7e14305b7..5d07f7f9e 100644
--- a/src/map/packets.h
+++ b/src/map/packets.h
@@ -1869,6 +1869,10 @@ packet(0x020d,-1);
packet(0x0838,6,clif->pSolveCharName,2);
packet(0x0439,8,clif->pUseItem,2,4);
packet(0x08d2,10);
+ packet(0x08d7,28,clif->pBGQueueRegister,2);
+ packet(0x090a,26,clif->pBGQueueCheckState,2);
+ packet(0x08da,26,clif->pBGQueueRevokeReq,2);
+ packet(0x08e0,51,clif->pBGQueueBattleBeginAck,2);
#endif
//2011-11-02aRagexe
@@ -1985,7 +1989,6 @@ packet(0x020d,-1);
packet(0x08FB,6,clif->pDull,2); //bookingcanceljoinparty
packet(0x0907,5,clif->pMoveItem,2,4);
packet(0x0908,5);
- packet(0x08D7,28,clif->pDull,2,4); //battlegroundreg
packet(0x08CF,10);//Amulet spirits
packet(0x0977,14);//Monster HP Bar
#endif
@@ -2086,4 +2089,74 @@ packet(0x020d,-1);
// New Packets End
#endif
+//2013-05-15aRagexe (Shakto)
+#if PACKETVER >= 20130515
+ // Shuffle Start
+ packet(0x0369,7,clif->pActionRequest,2,6);
+ packet(0x083C,10,clif->pUseSkillToId,2,4,6);
+ packet(0x0437,5,clif->pWalkToXY,2);
+ packet(0x035F,6,clif->pTickSend,2);
+ packet(0x0362,5,clif->pChangeDir,2,4);
+ packet(0x08A1,6,clif->pTakeItem,2);
+ packet(0x0944,6,clif->pDropItem,2,4);
+ packet(0x0887,8,clif->pMoveToKafra,2,4);
+ packet(0x08AC,8,clif->pMoveFromKafra,2,4);
+ packet(0x0438,10,clif->pUseSkillToPos,2,4,6,8);
+ packet(0x0366,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10);
+ packet(0x096A,6,clif->pGetCharNameRequest,2);
+ packet(0x0368,6,clif->pSolveCharName,2);
+ packet(0x0838,12,clif->pSearchStoreInfoListItemClick,2,6,10);
+ packet(0x0835,2,clif->pSearchStoreInfoNextPage,0);
+ packet(0x0819,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15);
+ packet(0x0811,-1,clif->pReqTradeBuyingStore,2,4,8,12);
+ packet(0x0360,6,clif->pReqClickBuyingStore,2);
+ packet(0x0817,2,clif->pReqCloseBuyingStore,0);
+ packet(0x0815,-1,clif->pReqOpenBuyingStore,2,4,8,9,89);
+ packet(0x092D,41,clif->pPartyBookingRegisterReq,2,4);
+ //packet(0x08AA,8); // CZ_JOIN_BATTLE_FIELD
+ packet(0x0963,-1,clif->pItemListWindowSelected,2,4,8);
+ packet(0x0943,19,clif->pWantToConnection,2,6,10,14,18);
+ packet(0x0947,26,clif->pPartyInvite2,2);
+ //packet(0x0862,4); // CZ_GANGSI_RANK
+ packet(0x0962,26,clif->pFriendsListAdd,2);
+ packet(0x0931,5,clif->pHomMenu,2,4);
+ packet(0x093E,36,clif->pStoragePassword,0);
+ // Shuffle End
+#endif
+
+//2013-05-22Ragexe (Shakto)
+#if PACKETVER >= 20130522
+ // Shuffle Start
+ packet(0x08A2,7,clif->pActionRequest,2,6);
+ packet(0x095C,10,clif->pUseSkillToId,2,4,6);
+ packet(0x0360,5,clif->pWalkToXY,2);
+ packet(0x07EC,6,clif->pTickSend,2);
+ packet(0x0925,5,clif->pChangeDir,2,4);
+ packet(0x095E,6,clif->pTakeItem,2);
+ packet(0x089C,6,clif->pDropItem,2,4);
+ packet(0x08A3,8,clif->pMoveToKafra,2,4);
+ packet(0x087E,8,clif->pMoveFromKafra,2,4);
+ packet(0x0811,10,clif->pUseSkillToPos,2,4,6,8);
+ packet(0x0964,90,clif->pUseSkillToPosMoreInfo,2,4,6,8,10);
+ packet(0x08A6,6,clif->pGetCharNameRequest,2);
+ packet(0x0369,6,clif->pSolveCharName,2);
+ packet(0x093E,12,clif->pSearchStoreInfoListItemClick,2,6,10);
+ packet(0x08AA,2,clif->pSearchStoreInfoNextPage,0);
+ packet(0x095B,-1,clif->pSearchStoreInfo,2,4,5,9,13,14,15);
+ packet(0x0952,-1,clif->pReqTradeBuyingStore,2,4,8,12);
+ packet(0x0368,6,clif->pReqClickBuyingStore,2);
+ packet(0x086E,2,clif->pReqCloseBuyingStore,0);
+ packet(0x0874,-1,clif->pReqOpenBuyingStore,2,4,8,9,89);
+ packet(0x089B,41,clif->pPartyBookingRegisterReq,2,4);
+ //packet(0x0965,8); // CZ_JOIN_BATTLE_FIELD
+ packet(0x086A,-1,clif->pItemListWindowSelected,2,4,8);
+ packet(0x08A9,19,clif->pWantToConnection,2,6,10,14,18);
+ packet(0x0950,26,clif->pPartyInvite2,2);
+ //packet(0x08AC,4); // CZ_GANGSI_RANK
+ packet(0x0362,26,clif->pFriendsListAdd,2);
+ packet(0x0926,5,clif->pHomMenu,2,4);
+ packet(0x088E,36,clif->pStoragePassword,0);
+ // Shuffle End
+#endif
+
#endif /* _PACKETS_H_ */
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index c873d3ad3..083c00e31 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -72,6 +72,7 @@ enum packet_headers {
#else
authokType = 0x2eb,
#endif
+ script_clearType = 0x8d6,
#if PACKETVER < 4
unit_walkingType = 0x7b,
#elif PACKETVER < 7
@@ -87,6 +88,15 @@ enum packet_headers {
#else
unit_walkingType = 0x914,
#endif
+ bgqueue_ackType = 0x8d8,
+ bgqueue_notice_deleteType = 0x8db,
+ bgqueue_registerType = 0x8d7,
+ bgqueue_updateinfoType = 0x8d9,
+ bgqueue_checkstateType = 0x90a,
+ bgqueue_revokereqType = 0x8da,
+ bgqueue_battlebeginackType = 0x8e0,
+ bgqueue_notify_entryType = 0x8d9,
+ bgqueue_battlebegins = 0x8df,
#if PACKETVER > 20130000 /* not sure date */
dropflooritemType = 0x84b,
#else
@@ -391,6 +401,65 @@ struct packet_maptypeproperty2 {
} flag;
} __attribute__((packed));
+struct packet_bgqueue_ack {
+ short PacketType;
+ short type;
+ char bg_name[NAME_LENGTH];
+} __attribute__((packed));
+
+struct packet_bgqueue_notice_delete {
+ short PacketType;
+ short type;
+ char bg_name[NAME_LENGTH];
+} __attribute__((packed));
+
+struct packet_bgqueue_register {
+ short PacketType;
+ short type;
+ char bg_name[NAME_LENGTH];
+} __attribute__((packed));
+
+struct packet_bgqueue_update_info {
+ short PacketType;
+ char bg_name[NAME_LENGTH];
+ int position;
+} __attribute__((packed));
+
+struct packet_bgqueue_checkstate {
+ short PacketType;
+ char bg_name[NAME_LENGTH];
+} __attribute__((packed));
+
+struct packet_bgqueue_revoke_req {
+ short PacketType;
+ char bg_name[NAME_LENGTH];
+} __attribute__((packed));
+
+struct packet_bgqueue_battlebegin_ack {
+ short PacketType;
+ short result;
+ char bg_name[NAME_LENGTH];
+ char game_name[NAME_LENGTH];
+} __attribute__((packed));
+
+struct packet_bgqueue_notify_entry {
+ short PacketType;
+ char name[NAME_LENGTH];
+ int position;
+} __attribute__((packed));
+
+struct packet_bgqueue_battlebegins {
+ short PacketType;
+ char bg_name[NAME_LENGTH];
+ char game_name[NAME_LENGTH];
+} __attribute__((packed));
+
+struct packet_script_clear {
+ short PacketType;
+ unsigned int NpcID;
+} __attribute__((packed));
+
+
#pragma pack(pop)
#endif /* _PACKETS_STRUCT_H_ */
diff --git a/src/map/party.c b/src/map/party.c
index d8bb321f1..a7a002404 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -50,8 +50,6 @@ static void party_fill_member(struct party_member* member, struct map_session_da
member->online = 1;
member->leader = leader;
}
-
-
/// Get the member_id of a party member.
/// Return -1 if not in party.
int party_getmemberid(struct party_data* p, struct map_session_data* sd)
@@ -86,7 +84,7 @@ struct map_session_data* party_getavailablesd(struct party_data *p)
static TBL_PC* party_sd_check(int party_id, int account_id, int char_id)
{
- TBL_PC* sd = map_id2sd(account_id);
+ TBL_PC* sd = iMap->id2sd(account_id);
if (!(sd && sd->status.char_id == char_id))
return NULL;
@@ -101,14 +99,21 @@ static TBL_PC* party_sd_check(int party_id, int account_id, int char_id)
return sd;
}
-
+int party_db_final(DBKey key, DBData *data, va_list ap) {
+ struct party_data *p;
+
+ if( ( p = iDB->data2ptr(data) ) && p->instance )
+ aFree(p->instance);
+
+ return 0;
+}
/*==========================================
* Destructor
* Called in map shutdown, cleanup var
*------------------------------------------*/
void do_final_party(void)
{
- party_db->destroy(party_db,NULL);
+ party_db->destroy(party_db,party_db_final);
party_booking_db->destroy(party_booking_db,NULL); // Party Booking [Spiria]
}
// Constructor, init vars
@@ -116,8 +121,8 @@ void do_init_party(void)
{
party_db = idb_alloc(DB_OPT_RELEASE_DATA);
party_booking_db = idb_alloc(DB_OPT_RELEASE_DATA); // Party Booking [Spiria]
- add_timer_func_list(party_send_xy_timer, "party_send_xy_timer");
- add_timer_interval(gettick()+battle_config.party_update_interval, party_send_xy_timer, 0, 0, battle_config.party_update_interval);
+ iTimer->add_timer_func_list(party_send_xy_timer, "party_send_xy_timer");
+ iTimer->add_timer_interval(iTimer->gettick()+battle_config.party_update_interval, party_send_xy_timer, 0, 0, battle_config.party_update_interval);
}
/// Party data lookup using party id.
@@ -175,7 +180,7 @@ int party_create(struct map_session_data *sd,char *name,int item,int item2)
void party_created(int account_id,int char_id,int fail,int party_id,char *name)
{
struct map_session_data *sd;
- sd=map_id2sd(account_id);
+ sd=iMap->id2sd(account_id);
if (!sd || sd->status.char_id != char_id || !sd->party_creating )
{ //Character logged off before creation ack?
@@ -204,11 +209,11 @@ int party_request_info(int party_id, int char_id)
/// Invoked (from char-server) when the party info is not found.
int party_recv_noinfo(int party_id, int char_id)
{
- party_broken(party_id);
+ iParty->broken(party_id);
if( char_id != 0 )// requester
{
struct map_session_data* sd;
- sd = map_charid2sd(char_id);
+ sd = iMap->charid2sd(char_id);
if( sd && sd->status.party_id == party_id )
sd->status.party_id = 0;
}
@@ -251,16 +256,14 @@ int party_recv_info(struct party* sp, int char_id)
int removed_count = 0;
int added[MAX_PARTY];// member_id in new data
int added_count = 0;
- int i;
+ int i,j;
int member_id;
nullpo_ret(sp);
p = (struct party_data*)idb_get(party_db, sp->party_id);
- if( p != NULL )// diff members
- {
- for( member_id = 0; member_id < MAX_PARTY; ++member_id )
- {
+ if( p != NULL ) {// diff members
+ for( member_id = 0; member_id < MAX_PARTY; ++member_id ) {
member = &p->party.member[member_id];
if( member->char_id == 0 )
continue;// empty
@@ -270,8 +273,7 @@ int party_recv_info(struct party* sp, int char_id)
if( i == MAX_PARTY )
removed[removed_count++] = member_id;
}
- for( member_id = 0; member_id < MAX_PARTY; ++member_id )
- {
+ for( member_id = 0; member_id < MAX_PARTY; ++member_id ) {
member = &sp->member[member_id];
if( member->char_id == 0 )
continue;// empty
@@ -281,36 +283,33 @@ int party_recv_info(struct party* sp, int char_id)
if( i == MAX_PARTY )
added[added_count++] = member_id;
}
- }
- else
- {
+ } else {
for( member_id = 0; member_id < MAX_PARTY; ++member_id )
if( sp->member[member_id].char_id != 0 )
added[added_count++] = member_id;
CREATE(p, struct party_data, 1);
+ p->instance = NULL;
+ p->instances = 0;
idb_put(party_db, sp->party_id, p);
}
- while( removed_count > 0 )// no longer in party
- {
+ while( removed_count > 0 ) {// no longer in party
member_id = removed[--removed_count];
sd = p->data[member_id].sd;
if( sd == NULL )
continue;// not online
- party_member_withdraw(sp->party_id, sd->status.account_id, sd->status.char_id);
+ iParty->member_withdraw(sp->party_id, sd->status.account_id, sd->status.char_id);
}
memcpy(&p->party, sp, sizeof(struct party));
memset(&p->state, 0, sizeof(p->state));
memset(&p->data, 0, sizeof(p->data));
- for( member_id = 0; member_id < MAX_PARTY; member_id++ )
- {
+ for( member_id = 0; member_id < MAX_PARTY; member_id++ ) {
member = &p->party.member[member_id];
if ( member->char_id == 0 )
continue;// empty
p->data[member_id].sd = party_sd_check(sp->party_id, member->account_id, member->char_id);
}
party_check_state(p);
- while( added_count > 0 )// new in party
- {
+ while( added_count > 0 ) { // new in party
member_id = added[--added_count];
sd = p->data[member_id].sd;
if( sd == NULL )
@@ -319,13 +318,17 @@ int party_recv_info(struct party* sp, int char_id)
clif->party_member_info(p,sd);
clif->party_option(p,sd,0x100);
clif->party_info(p,NULL);
- if( p->instance_id != 0 )
- clif->instance_join(sd->fd, p->instance_id);
+ for( j = 0; j < p->instances; j++ ) {
+ if( instances[p->instance[j]].idle_timer == INVALID_TIMER && instances[p->instance[j]].progress_timer == INVALID_TIMER )
+ continue;
+ clif->instance_join(sd->fd, p->instance[j]);
+ break;
+ }
}
if( char_id != 0 )// requester
{
- sd = map_charid2sd(char_id);
- if( sd && sd->status.party_id == sp->party_id && party_getmemberid(p,sd) == -1 )
+ sd = iMap->charid2sd(char_id);
+ if( sd && sd->status.party_id == sp->party_id && iParty->getmemberid(p,sd) == -1 )
sd->status.party_id = 0;// was not in the party
}
return 0;
@@ -338,7 +341,7 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd)
nullpo_ret(sd);
- if( ( p = party_search(sd->status.party_id) ) == NULL )
+ if( ( p = iParty->search(sd->status.party_id) ) == NULL )
return 0;
// confirm if this player is a party leader
@@ -404,7 +407,7 @@ void party_reply_invite(struct map_session_data *sd,int party_id,int flag)
sd->party_invite_account = 0;
return;
}
- tsd = map_id2sd(sd->party_invite_account);
+ tsd = iMap->id2sd(sd->party_invite_account);
if( flag == 1 && !sd->party_creating && !sd->party_joining )
{// accepted and allowed
@@ -427,21 +430,23 @@ void party_reply_invite(struct map_session_data *sd,int party_id,int flag)
//- Player must be authed/active and belong to a party before calling this method
void party_member_joined(struct map_session_data *sd)
{
- struct party_data* p = party_search(sd->status.party_id);
+ struct party_data* p = iParty->search(sd->status.party_id);
int i;
- if (!p)
- {
- party_request_info(sd->status.party_id, sd->status.char_id);
+ if (!p) {
+ iParty->request_info(sd->status.party_id, sd->status.char_id);
return;
}
ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == sd->status.account_id && p->party.member[i].char_id == sd->status.char_id );
- if (i < MAX_PARTY)
- {
+ if (i < MAX_PARTY) {
+ int j;
p->data[i].sd = sd;
- if( p->instance_id )
- clif->instance_join(sd->fd,p->instance_id);
- }
- else
+ for( j = 0; j < p->instances; j++ ) {
+ if( instances[p->instance[j]].idle_timer == INVALID_TIMER && instances[p->instance[j]].progress_timer == INVALID_TIMER )
+ continue;
+ clif->instance_join(sd->fd, p->instance[j]);
+ break;
+ }
+ } else
sd->status.party_id = 0; //He does not belongs to the party really?
}
@@ -449,9 +454,9 @@ void party_member_joined(struct map_session_data *sd)
/// flag: 0-success, 1-failure
int party_member_added(int party_id,int account_id,int char_id, int flag)
{
- struct map_session_data *sd = map_id2sd(account_id),*sd2;
- struct party_data *p = party_search(party_id);
- int i;
+ struct map_session_data *sd = iMap->id2sd(account_id),*sd2;
+ struct party_data *p = iParty->search(party_id);
+ int i, j;
if(sd == NULL || sd->status.char_id != char_id || !sd->party_joining ) {
if (!flag) //Char logged off before being accepted into party.
@@ -459,7 +464,7 @@ int party_member_added(int party_id,int account_id,int char_id, int flag)
return 0;
}
- sd2 = map_id2sd(sd->party_invite_account);
+ sd2 = iMap->id2sd(sd->party_invite_account);
sd->party_joining = false;
sd->party_invite = 0;
@@ -481,7 +486,6 @@ int party_member_added(int party_id,int account_id,int char_id, int flag)
sd->status.party_id = party_id;
clif->party_member_info(p,sd);
- clif->party_option(p,sd,0x100);
clif->party_info(p,sd);
if( sd2 != NULL )
@@ -497,9 +501,13 @@ int party_member_added(int party_id,int account_id,int char_id, int flag)
clif->party_xy(sd);
clif->charnameupdate(sd); //Update char name's display [Skotlex]
- if( p->instance_id )
- clif->instance_join(sd->fd, p->instance_id);
-
+ for( j = 0; j < p->instances; j++ ) {
+ if( instances[p->instance[j]].idle_timer == INVALID_TIMER && instances[p->instance[j]].progress_timer == INVALID_TIMER )
+ continue;
+ clif->instance_join(sd->fd, p->instance[j]);
+ break;
+ }
+
return 0;
}
@@ -509,7 +517,7 @@ int party_removemember(struct map_session_data* sd, int account_id, char* name)
struct party_data *p;
int i;
- p = party_search(sd->status.party_id);
+ p = iParty->search(sd->status.party_id);
if( p == NULL )
return 0;
@@ -534,7 +542,7 @@ int party_leave(struct map_session_data *sd)
struct party_data *p;
int i;
- p = party_search(sd->status.party_id);
+ p = iParty->search(sd->status.party_id);
if( p == NULL )
return 0;
@@ -549,15 +557,13 @@ int party_leave(struct map_session_data *sd)
/// Invoked (from char-server) when a party member leaves the party.
int party_member_withdraw(int party_id, int account_id, int char_id)
{
- struct map_session_data* sd = map_id2sd(account_id);
- struct party_data* p = party_search(party_id);
+ struct map_session_data* sd = iMap->id2sd(account_id);
+ struct party_data* p = iParty->search(party_id);
- if( p )
- {
+ if( p ) {
int i;
ARR_FIND( 0, MAX_PARTY, i, p->party.member[i].account_id == account_id && p->party.member[i].char_id == char_id );
- if( i < MAX_PARTY )
- {
+ if( i < MAX_PARTY ) {
clif->party_withdraw(p,sd,account_id,p->party.member[i].name,0x0);
memset(&p->party.member[i], 0, sizeof(p->party.member[0]));
memset(&p->data[i], 0, sizeof(p->data[0]));
@@ -566,13 +572,12 @@ int party_member_withdraw(int party_id, int account_id, int char_id)
}
}
- if( sd && sd->status.party_id == party_id && sd->status.char_id == char_id )
- {
+ if( sd && sd->status.party_id == party_id && sd->status.char_id == char_id ) {
sd->status.party_id = 0;
clif->charnameupdate(sd); //Update name display [Skotlex]
//TODO: hp bars should be cleared too
- if( p->instance_id )
- instance_check_kick(sd);
+ if( p->instances )
+ instance->check_kick(sd);
}
return 0;
@@ -582,22 +587,19 @@ int party_member_withdraw(int party_id, int account_id, int char_id)
int party_broken(int party_id)
{
struct party_data* p;
- int i;
+ int i, j;
- p = party_search(party_id);
+ p = iParty->search(party_id);
if( p == NULL )
return 0;
- if( p->instance_id )
- {
- instance[p->instance_id].party_id = 0;
- instance_destroy( p->instance_id );
+ for( j = 0; j < p->instances; j++ ) {
+ instance->destroy( p->instance[j] );
+ instances[p->instance[j]].owner_id = 0;
}
-
- for( i = 0; i < MAX_PARTY; i++ )
- {
- if( p->data[i].sd!=NULL )
- {
+
+ for( i = 0; i < MAX_PARTY; i++ ) {
+ if( p->data[i].sd!=NULL ) {
clif->party_withdraw(p,p->data[i].sd,p->party.member[i].account_id,p->party.member[i].name,0x10);
p->data[i].sd->status.party_id=0;
}
@@ -620,8 +622,8 @@ int party_changeoption(struct map_session_data *sd,int exp,int item)
int party_optionchanged(int party_id,int account_id,int exp,int item,int flag)
{
struct party_data *p;
- struct map_session_data *sd=map_id2sd(account_id);
- if( (p=party_search(party_id))==NULL)
+ struct map_session_data *sd=iMap->id2sd(account_id);
+ if( (p=iParty->search(party_id))==NULL)
return 0;
//Flag&1: Exp change denied. Flag&2: Item change denied.
@@ -654,7 +656,7 @@ bool party_changeleader(struct map_session_data *sd, struct map_session_data *ts
return false;
}
- if ((p = party_search(sd->status.party_id)) == NULL)
+ if ((p = iParty->search(sd->status.party_id)) == NULL)
return false;
ARR_FIND( 0, MAX_PARTY, mi, p->data[mi].sd == sd );
@@ -696,7 +698,7 @@ int party_recv_movemap(int party_id,int account_id,int char_id, unsigned short m
struct party_data* p;
int i;
- p = party_search(party_id);
+ p = iParty->search(party_id);
if( p == NULL )
return 0;
@@ -727,12 +729,11 @@ void party_send_movemap(struct map_session_data *sd)
intif_party_changemap(sd,1);
- p=party_search(sd->status.party_id);
+ p=iParty->search(sd->status.party_id);
if (!p) return;
if(sd->state.connect_new) {
//Note that this works because this function is invoked before connect_new is cleared.
- clif->party_option(p,sd,0x100);
clif->party_info(p,sd);
clif->party_member_info(p,sd);
}
@@ -766,7 +767,7 @@ int party_send_logout(struct map_session_data *sd)
return 0;
intif_party_changemap(sd,0);
- p=party_search(sd->status.party_id);
+ p=iParty->search(sd->status.party_id);
if(!p) return 0;
ARR_FIND( 0, MAX_PARTY, i, p->data[i].sd == sd );
@@ -783,7 +784,7 @@ int party_send_message(struct map_session_data *sd,const char *mes,int len)
if(sd->status.party_id==0)
return 0;
intif_party_message(sd->status.party_id,sd->status.account_id,mes,len);
- party_recv_message(sd->status.party_id,sd->status.account_id,mes,len);
+ iParty->recv_message(sd->status.party_id,sd->status.account_id,mes,len);
// Chat logging type 'P' / Party Chat
logs->chat(LOG_CHAT_PARTY, sd->status.party_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
@@ -794,7 +795,7 @@ int party_send_message(struct map_session_data *sd,const char *mes,int len)
int party_recv_message(int party_id,int account_id,const char *mes,int len)
{
struct party_data *p;
- if( (p=party_search(party_id))==NULL)
+ if( (p=iParty->search(party_id))==NULL)
return 0;
clif->party_message(p,account_id,mes,len);
return 0;
@@ -806,7 +807,7 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id
struct map_session_data *p_sd;
int i;
- if(!party_id || (p=party_search(party_id))==NULL)
+ if(!party_id || (p=iParty->search(party_id))==NULL)
return 0;
switch(skill_id) {
case TK_COUNTER: //Increase Triple Attack rate of Monks.
@@ -831,7 +832,7 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id
switch(skill_id) {
case TK_COUNTER: //Increase Triple Attack rate of Monks.
if((p_sd->class_&MAPID_UPPERMASK) == MAPID_MONK
- && pc_checkskill(p_sd,MO_TRIPLEATTACK)) {
+ && iPc->checkskill(p_sd,MO_TRIPLEATTACK)) {
sc_start4(&p_sd->bl,SC_SKILLRATE_UP,100,MO_TRIPLEATTACK,
50+50*skill_lv, //+100/150/200% rate
0,0,skill->get_time(SG_FRIEND, 1));
@@ -840,9 +841,9 @@ int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id
case MO_COMBOFINISH: //Increase Counter rate of Star Gladiators
if((p_sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR
&& sd->sc.data[SC_READYCOUNTER]
- && pc_checkskill(p_sd,SG_FRIEND)) {
+ && iPc->checkskill(p_sd,SG_FRIEND)) {
sc_start4(&p_sd->bl,SC_SKILLRATE_UP,100,TK_COUNTER,
- 50+50*pc_checkskill(p_sd,SG_FRIEND), //+100/150/200% rate
+ 50+50*iPc->checkskill(p_sd,SG_FRIEND), //+100/150/200% rate
0,0,skill->get_time(SG_FRIEND, 1));
}
break;
@@ -947,15 +948,15 @@ int party_exp_share(struct party_data* p, struct block_list* src, unsigned int b
for (i = 0; i < c; i++) {
#ifdef RENEWAL_EXP
if( !(src && src->type == BL_MOB && ((TBL_MOB*)src)->db->mexp) ){
- int rate = pc_level_penalty_mod(sd[i], (TBL_MOB*)src, 1);
+ int rate = iPc->level_penalty_mod(sd[i], (TBL_MOB*)src, 1);
base_exp = (unsigned int)cap_value(base_exp_bonus * rate / 100, 1, UINT_MAX);
job_exp = (unsigned int)cap_value(job_exp_bonus * rate / 100, 1, UINT_MAX);
}
#endif
- pc_gainexp(sd[i], src, base_exp, job_exp, false);
+ iPc->gainexp(sd[i], src, base_exp, job_exp, false);
if (zeny) // zeny from mobs [Valaris]
- pc_getzeny(sd[i],zeny,LOG_TYPE_PICKDROP_MONSTER,NULL);
+ iPc->getzeny(sd[i],zeny,LOG_TYPE_PICKDROP_MONSTER,NULL);
}
return 0;
}
@@ -980,7 +981,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
if( (psd = p->data[i].sd) == NULL || sd->bl.m != psd->bl.m || pc_isdead(psd) || (battle_config.idle_no_share && pc_isidle(psd)) )
continue;
- if (pc_additem(psd,item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER))
+ if (iPc->additem(psd,item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER))
continue; //Chosen char can't pick up loot.
//Successful pick.
@@ -1002,7 +1003,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
}
while (count > 0) { //Pick a random member.
i = rnd()%count;
- if (pc_additem(psd[i],item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER))
+ if (iPc->additem(psd[i],item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER))
{ //Discard this receiver.
psd[i] = psd[count-1];
count--;
@@ -1016,7 +1017,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
if (!target) {
target = sd; //Give it to the char that picked it up
- if ((i=pc_additem(sd,item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER)))
+ if ((i=iPc->additem(sd,item_data,item_data->amount,LOG_TYPE_PICKDROP_PLAYER)))
return i;
}
@@ -1035,7 +1036,7 @@ int party_send_dot_remove(struct map_session_data *sd)
// To use for Taekwon's "Fighting Chant"
// int c = 0;
-// party_foreachsamemap(party_sub_count, sd, 0, &c);
+// party_foreachsamemap(iParty->sub_count, sd, 0, &c);
int party_sub_count(struct block_list *bl, va_list ap)
{
struct map_session_data *sd = (TBL_PC *)bl;
@@ -1061,7 +1062,7 @@ int party_foreachsamemap(int (*func)(struct block_list*,va_list),struct map_sess
nullpo_ret(sd);
- if((p=party_search(sd->status.party_id))==NULL)
+ if((p=iParty->search(sd->status.party_id))==NULL)
return 0;
x0=sd->bl.x-range;
@@ -1082,7 +1083,7 @@ int party_foreachsamemap(int (*func)(struct block_list*,va_list),struct map_sess
list[blockcount++]=&psd->bl;
}
- map_freeblock_lock();
+ iMap->freeblock_lock();
for(i=0;i<blockcount;i++)
{
@@ -1092,7 +1093,7 @@ int party_foreachsamemap(int (*func)(struct block_list*,va_list),struct map_sess
va_end(ap);
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return total;
}
@@ -1209,3 +1210,54 @@ bool party_booking_delete(struct map_session_data *sd)
}
return true;
}
+
+/*=====================================
+* Default Functions : party.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+void party_defaults(void) {
+ iParty = &iParty_s;
+
+ /* funcs */
+
+ iParty->do_init_party = do_init_party;
+ iParty->do_final_party = do_final_party;
+ iParty->search = party_search;
+ iParty->searchname = party_searchname;
+ iParty->getmemberid = party_getmemberid;
+ iParty->getavailablesd = party_getavailablesd;
+
+ iParty->create = party_create;
+ iParty->created = party_created;
+ iParty->request_info = party_request_info;
+ iParty->invite = party_invite;
+ iParty->member_joined = party_member_joined;
+ iParty->member_added = party_member_added;
+ iParty->leave = party_leave;
+ iParty->removemember = party_removemember;
+ iParty->member_withdraw = party_member_withdraw;
+ iParty->reply_invite = party_reply_invite;
+ iParty->recv_noinfo = party_recv_noinfo;
+ iParty->recv_info = party_recv_info;
+ iParty->recv_movemap = party_recv_movemap;
+ iParty->broken = party_broken;
+ iParty->optionchanged = party_optionchanged;
+ iParty->changeoption = party_changeoption;
+ iParty->changeleader = party_changeleader;
+ iParty->send_movemap = party_send_movemap;
+ iParty->send_levelup = party_send_levelup;
+ iParty->send_logout = party_send_logout;
+ iParty->send_message = party_send_message;
+ iParty->recv_message = party_recv_message;
+ iParty->skill_check = party_skill_check;
+ iParty->send_xy_clear = party_send_xy_clear;
+ iParty->exp_share = party_exp_share;
+ iParty->share_loot = party_share_loot;
+ iParty->send_dot_remove = party_send_dot_remove;
+ iParty->sub_count = party_sub_count;
+ iParty->booking_register = party_booking_register;
+ iParty->booking_update = party_booking_update;
+ iParty->booking_search = party_booking_search;
+ iParty->booking_delete = party_booking_delete;
+}
diff --git a/src/map/party.h b/src/map/party.h
index 12fe7a2bc..9956c5b33 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -1,9 +1,7 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
-
#ifndef _PARTY_H_
#define _PARTY_H_
-
#include "../common/mmo.h" // struct party
struct block_list;
struct map_session_data;
@@ -25,7 +23,8 @@ struct party_data {
struct party party;
struct party_member_data data[MAX_PARTY];
uint8 itemc; //For item distribution, position of last picker in party
- unsigned int instance_id;
+ unsigned short *instance;
+ unsigned short instances;
struct {
unsigned monk : 1; //There's at least one monk in party?
unsigned sg : 1; //There's at least one Star Gladiator in party?
@@ -47,49 +46,65 @@ struct party_booking_ad_info {
struct party_booking_detail p_detail;
};
-void do_init_party(void);
-void do_final_party(void);
-struct party_data* party_search(int party_id);
-struct party_data* party_searchname(const char* str);
-int party_getmemberid(struct party_data* p, struct map_session_data* sd);
-struct map_session_data* party_getavailablesd(struct party_data *p);
-int party_create(struct map_session_data *sd,char *name, int item, int item2);
-void party_created(int account_id,int char_id,int fail,int party_id,char *name);
-int party_request_info(int party_id, int char_id);
-int party_invite(struct map_session_data *sd,struct map_session_data *tsd);
-void party_member_joined(struct map_session_data *sd);
-int party_member_added(int party_id,int account_id,int char_id,int flag);
-int party_leave(struct map_session_data *sd);
-int party_removemember(struct map_session_data *sd,int account_id,char *name);
-int party_member_withdraw(int party_id,int account_id,int char_id);
-void party_reply_invite(struct map_session_data *sd,int party_id,int flag);
-int party_recv_noinfo(int party_id, int char_id);
-int party_recv_info(struct party* sp, int char_id);
-int party_recv_movemap(int party_id,int account_id,int char_id, unsigned short map,int online,int lv);
-int party_broken(int party_id);
-int party_optionchanged(int party_id,int account_id,int exp,int item,int flag);
-int party_changeoption(struct map_session_data *sd,int exp,int item);
-bool party_changeleader(struct map_session_data *sd, struct map_session_data *t_sd);
-void party_send_movemap(struct map_session_data *sd);
-void party_send_levelup(struct map_session_data *sd);
-int party_send_logout(struct map_session_data *sd);
-int party_send_message(struct map_session_data *sd,const char *mes,int len);
-int party_recv_message(int party_id,int account_id,const char *mes,int len);
-int party_skill_check(struct map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv);
-int party_send_xy_clear(struct party_data *p);
-int party_exp_share(struct party_data *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny);
-int party_share_loot(struct party_data* p, struct map_session_data* sd, struct item* item_data, int first_charid);
-int party_send_dot_remove(struct map_session_data *sd);
-int party_sub_count(struct block_list *bl, va_list ap);
int party_foreachsamemap(int (*func)(struct block_list *,va_list),struct map_session_data *sd,int range,...);
/*==========================================
* Party Booking in KRO [Spiria]
*------------------------------------------*/
-void party_booking_register(struct map_session_data *sd, short level, short mapid, short* job);
-void party_booking_update(struct map_session_data *sd, short* job);
-void party_booking_search(struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount);
-bool party_booking_delete(struct map_session_data *sd);
+
+/*=====================================
+* Interface : party.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+struct party_interface {
+
+ /* funcs */
+
+ void (*do_init_party) (void);
+ void (*do_final_party) (void);
+ struct party_data* (*search) (int party_id);
+ struct party_data* (*searchname) (const char* str);
+ int (*getmemberid) (struct party_data* p, struct map_session_data* sd);
+ struct map_session_data* (*getavailablesd) (struct party_data *p);
+
+ int (*create) (struct map_session_data *sd,char *name, int item, int item2);
+ void (*created) (int account_id,int char_id,int fail,int party_id,char *name);
+ int (*request_info) (int party_id, int char_id);
+ int (*invite) (struct map_session_data *sd,struct map_session_data *tsd);
+ void (*member_joined) (struct map_session_data *sd);
+ int (*member_added) (int party_id,int account_id,int char_id,int flag);
+ int (*leave) (struct map_session_data *sd);
+ int (*removemember) (struct map_session_data *sd,int account_id,char *name);
+ int (*member_withdraw) (int party_id,int account_id,int char_id);
+ void (*reply_invite) (struct map_session_data *sd,int party_id,int flag);
+ int (*recv_noinfo) (int party_id, int char_id);
+ int (*recv_info) (struct party* sp, int char_id);
+ int (*recv_movemap) (int party_id,int account_id,int char_id, unsigned short map,int online,int lv);
+ int (*broken) (int party_id);
+ int (*optionchanged) (int party_id,int account_id,int exp,int item,int flag);
+ int (*changeoption) (struct map_session_data *sd,int exp,int item);
+ bool (*changeleader) (struct map_session_data *sd, struct map_session_data *t_sd);
+ void (*send_movemap) (struct map_session_data *sd);
+ void (*send_levelup) (struct map_session_data *sd);
+ int (*send_logout) (struct map_session_data *sd);
+ int (*send_message) (struct map_session_data *sd,const char *mes,int len);
+ int (*recv_message) (int party_id,int account_id,const char *mes,int len);
+ int (*skill_check) (struct map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv);
+ int (*send_xy_clear) (struct party_data *p);
+ int (*exp_share) (struct party_data *p,struct block_list *src,unsigned int base_exp,unsigned int job_exp,int zeny);
+ int (*share_loot) (struct party_data* p, struct map_session_data* sd, struct item* item_data, int first_charid);
+ int (*send_dot_remove) (struct map_session_data *sd);
+ int (*sub_count) (struct block_list *bl, va_list ap);
+ void (*booking_register) (struct map_session_data *sd, short level, short mapid, short* job);
+ void (*booking_update) (struct map_session_data *sd, short* job);
+ void (*booking_search) (struct map_session_data *sd, short level, short mapid, short job, unsigned long lastindex, short resultcount);
+ bool (*booking_delete) (struct map_session_data *sd);
+} iParty_s;
+
+struct party_interface *iParty;
+
+void party_defaults(void);
#endif /* _PARTY_H_ */
diff --git a/src/map/path.c b/src/map/path.c
index 3bbd8d20b..8ab63d390 100644
--- a/src/map/path.c
+++ b/src/map/path.c
@@ -167,12 +167,10 @@ int path_blownpos(int16 m,int16 x0,int16 y0,int16 dx,int16 dy,int count)
dy=(dy>0)?1:((dy<0)?-1:0);
}
- while( count > 0 && (dx != 0 || dy != 0) )
- {
- if( !map_getcellp(md,x0+dx,y0+dy,CELL_CHKPASS) )
- {// attempt partial movement
- int fx = ( dx != 0 && map_getcellp(md,x0+dx,y0,CELL_CHKPASS) );
- int fy = ( dy != 0 && map_getcellp(md,x0,y0+dy,CELL_CHKPASS) );
+ while( count > 0 && (dx != 0 || dy != 0) ) {
+ if( !md->getcellp(md,x0+dx,y0+dy,CELL_CHKPASS) ) {// attempt partial movement
+ int fx = ( dx != 0 && md->getcellp(md,x0+dx,y0,CELL_CHKPASS) );
+ int fy = ( dy != 0 && md->getcellp(md,x0,y0+dy,CELL_CHKPASS) );
if( fx && fy )
{
if(rnd()&1)
@@ -225,7 +223,7 @@ bool path_search_long(struct shootpath_data *spd,int16 m,int16 x0,int16 y0,int16
spd->x[0] = x0;
spd->y[0] = y0;
- if (map_getcellp(md,x1,y1,cell))
+ if (md->getcellp(md,x1,y1,cell))
return false;
if (dx > abs(dy)) {
@@ -238,7 +236,7 @@ bool path_search_long(struct shootpath_data *spd,int16 m,int16 x0,int16 y0,int16
while (x0 != x1 || y0 != y1)
{
- if (map_getcellp(md,x0,y0,cell))
+ if (md->getcellp(md,x0,y0,cell))
return false;
wx += dx;
wy += dy;
@@ -290,10 +288,10 @@ bool path_search(struct walkpath_data *wpd,int16 m,int16 x0,int16 y0,int16 x1,in
//Do not check starting cell as that would get you stuck.
if( x0 < 0 || x0 >= md->xs || y0 < 0 || y0 >= md->ys )
#else
- if( x0 < 0 || x0 >= md->xs || y0 < 0 || y0 >= md->ys /*|| map_getcellp(md,x0,y0,cell)*/ )
+ if( x0 < 0 || x0 >= md->xs || y0 < 0 || y0 >= md->ys /*|| md->getcellp(md,x0,y0,cell)*/ )
#endif
return false;
- if( x1 < 0 || x1 >= md->xs || y1 < 0 || y1 >= md->ys || map_getcellp(md,x1,y1,cell) )
+ if( x1 < 0 || x1 >= md->xs || y1 < 0 || y1 >= md->ys || md->getcellp(md,x1,y1,cell) )
return false;
// calculate (sgn(x1-x0), sgn(y1-y0))
@@ -317,7 +315,7 @@ bool path_search(struct walkpath_data *wpd,int16 m,int16 x0,int16 y0,int16 x1,in
if( dx == 0 && dy == 0 )
break; // success
- if( map_getcellp(md,x,y,cell) )
+ if( md->getcellp(md,x,y,cell) )
break; // obstacle = failure
}
@@ -365,29 +363,29 @@ bool path_search(struct walkpath_data *wpd,int16 m,int16 x0,int16 y0,int16 x1,in
// dc[2] : y--
// dc[3] : x++
- if(y < ys && !map_getcellp(md,x ,y+1,cell)) {
+ if(y < ys && !md->getcellp(md,x ,y+1,cell)) {
f |= 1; dc[0] = (y >= y1 ? 20 : 0);
e+=add_path(heap,tp,x ,y+1,dist,rp,cost+dc[0]); // (x, y+1)
}
- if(x > 0 && !map_getcellp(md,x-1,y ,cell)) {
+ if(x > 0 && !md->getcellp(md,x-1,y ,cell)) {
f |= 2; dc[1] = (x <= x1 ? 20 : 0);
e+=add_path(heap,tp,x-1,y ,dist,rp,cost+dc[1]); // (x-1, y )
}
- if(y > 0 && !map_getcellp(md,x ,y-1,cell)) {
+ if(y > 0 && !md->getcellp(md,x ,y-1,cell)) {
f |= 4; dc[2] = (y <= y1 ? 20 : 0);
e+=add_path(heap,tp,x ,y-1,dist,rp,cost+dc[2]); // (x , y-1)
}
- if(x < xs && !map_getcellp(md,x+1,y ,cell)) {
+ if(x < xs && !md->getcellp(md,x+1,y ,cell)) {
f |= 8; dc[3] = (x >= x1 ? 20 : 0);
e+=add_path(heap,tp,x+1,y ,dist,rp,cost+dc[3]); // (x+1, y )
}
- if( (f & (2+1)) == (2+1) && !map_getcellp(md,x-1,y+1,cell))
+ if( (f & (2+1)) == (2+1) && !md->getcellp(md,x-1,y+1,cell))
e+=add_path(heap,tp,x-1,y+1,dist+4,rp,cost+dc[1]+dc[0]-6); // (x-1, y+1)
- if( (f & (2+4)) == (2+4) && !map_getcellp(md,x-1,y-1,cell))
+ if( (f & (2+4)) == (2+4) && !md->getcellp(md,x-1,y-1,cell))
e+=add_path(heap,tp,x-1,y-1,dist+4,rp,cost+dc[1]+dc[2]-6); // (x-1, y-1)
- if( (f & (8+4)) == (8+4) && !map_getcellp(md,x+1,y-1,cell))
+ if( (f & (8+4)) == (8+4) && !md->getcellp(md,x+1,y-1,cell))
e+=add_path(heap,tp,x+1,y-1,dist+4,rp,cost+dc[3]+dc[2]-6); // (x+1, y-1)
- if( (f & (8+1)) == (8+1) && !map_getcellp(md,x+1,y+1,cell))
+ if( (f & (8+1)) == (8+1) && !md->getcellp(md,x+1,y+1,cell))
e+=add_path(heap,tp,x+1,y+1,dist+4,rp,cost+dc[3]+dc[0]-6); // (x+1, y+1)
tp[rp].flag=1;
if(e || heap[0]>=MAX_HEAP-5)
diff --git a/src/map/pc.c b/src/map/pc.c
index 9b1545c51..ad12181ee 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -33,7 +33,7 @@
#include "elemental.h"
#include "npc.h" // fake_nd
#include "pet.h" // pet_unlocktarget()
-#include "party.h" // party_search()
+#include "party.h" // iParty->search()
#include "guild.h" // guild->search(), guild_request_info()
#include "script.h" // script_config
#include "skill.h"
@@ -68,9 +68,6 @@ struct fame_list taekwon_fame_list[MAX_FAME_LIST];
static unsigned short equip_pos[EQI_MAX]={EQP_ACC_L,EQP_ACC_R,EQP_SHOES,EQP_GARMENT,EQP_HEAD_LOW,EQP_HEAD_MID,EQP_HEAD_TOP,EQP_ARMOR,EQP_HAND_L,EQP_HAND_R,EQP_COSTUME_HEAD_TOP,EQP_COSTUME_HEAD_MID,EQP_COSTUME_HEAD_LOW,EQP_COSTUME_GARMENT,EQP_AMMO};
-#define MOTD_LINE_SIZE 128
-static char motd_text[MOTD_LINE_SIZE][CHAT_SIZE_MAX]; // Message of the day buffer [Valaris]
-
//Links related info to the sd->hate_mob[]/sd->feel_map[] entries
const struct sg_data sg_info[MAX_PC_FEELHATE] = {
{ SG_SUN_ANGER, SG_SUN_BLESS, SG_SUN_COMFORT, "PC_FEEL_SUN", "PC_HATE_MOB_SUN", is_day_of_sun },
@@ -107,7 +104,7 @@ static int pc_invincible_timer(int tid, unsigned int tick, int id, intptr_t data
{
struct map_session_data *sd;
- if( (sd=(struct map_session_data *)map_id2sd(id)) == NULL || sd->bl.type!=BL_PC )
+ if( (sd=(struct map_session_data *)iMap->id2sd(id)) == NULL || sd->bl.type!=BL_PC )
return 1;
if(sd->invincible_timer != tid){
@@ -126,8 +123,8 @@ void pc_setinvincibletimer(struct map_session_data* sd, int val) {
val += map[sd->bl.m].invincible_time_inc;
if( sd->invincible_timer != INVALID_TIMER )
- delete_timer(sd->invincible_timer,pc_invincible_timer);
- sd->invincible_timer = add_timer(gettick()+val,pc_invincible_timer,sd->bl.id,0);
+ iTimer->delete_timer(sd->invincible_timer,pc_invincible_timer);
+ sd->invincible_timer = iTimer->add_timer(iTimer->gettick()+val,pc_invincible_timer,sd->bl.id,0);
}
void pc_delinvincibletimer(struct map_session_data* sd)
@@ -136,9 +133,9 @@ void pc_delinvincibletimer(struct map_session_data* sd)
if( sd->invincible_timer != INVALID_TIMER )
{
- delete_timer(sd->invincible_timer,pc_invincible_timer);
+ iTimer->delete_timer(sd->invincible_timer,pc_invincible_timer);
sd->invincible_timer = INVALID_TIMER;
- skill->unit_move(&sd->bl,gettick(),1);
+ skill->unit_move(&sd->bl,iTimer->gettick(),1);
}
}
@@ -147,7 +144,7 @@ static int pc_spiritball_timer(int tid, unsigned int tick, int id, intptr_t data
struct map_session_data *sd;
int i;
- if( (sd=(struct map_session_data *)map_id2sd(id)) == NULL || sd->bl.type!=BL_PC )
+ if( (sd=(struct map_session_data *)iMap->id2sd(id)) == NULL || sd->bl.type!=BL_PC )
return 1;
if( sd->spiritball <= 0 )
@@ -187,15 +184,15 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max)
if( sd->spiritball && sd->spiritball >= max ) {
if(sd->spirit_timer[0] != INVALID_TIMER)
- delete_timer(sd->spirit_timer[0],pc_spiritball_timer);
+ iTimer->delete_timer(sd->spirit_timer[0],pc_spiritball_timer);
sd->spiritball--;
if( sd->spiritball != 0 )
memmove(sd->spirit_timer+0, sd->spirit_timer+1, (sd->spiritball)*sizeof(int));
sd->spirit_timer[sd->spiritball] = INVALID_TIMER;
}
- tid = add_timer(gettick()+interval, pc_spiritball_timer, sd->bl.id, 0);
- ARR_FIND(0, sd->spiritball, i, sd->spirit_timer[i] == INVALID_TIMER || DIFF_TICK(get_timer(tid)->tick, get_timer(sd->spirit_timer[i])->tick) < 0);
+ tid = iTimer->add_timer(iTimer->gettick()+interval, pc_spiritball_timer, sd->bl.id, 0);
+ ARR_FIND(0, sd->spiritball, i, sd->spirit_timer[i] == INVALID_TIMER || DIFF_TICK(iTimer->get_timer(tid)->tick, iTimer->get_timer(sd->spirit_timer[i])->tick) < 0);
if( i != sd->spiritball )
memmove(sd->spirit_timer+i+1, sd->spirit_timer+i, (sd->spiritball-i)*sizeof(int));
sd->spirit_timer[i] = tid;
@@ -229,7 +226,7 @@ int pc_delspiritball(struct map_session_data *sd,int count,int type)
for(i=0;i<count;i++) {
if(sd->spirit_timer[i] != INVALID_TIMER) {
- delete_timer(sd->spirit_timer[i],pc_spiritball_timer);
+ iTimer->delete_timer(sd->spirit_timer[i],pc_spiritball_timer);
sd->spirit_timer[i] = INVALID_TIMER;
}
}
@@ -305,7 +302,7 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) {
// Get total HP of all Royal Guards in party.
for( j = 0; j < i; j++ )
{
- bsd = map_id2sd(b_sd[j]);
+ bsd = iMap->id2sd(b_sd[j]);
if( bsd != NULL )
hp += status_get_hp(&bsd->bl);
}
@@ -316,7 +313,7 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) {
// If a Royal Guard have full HP, give more HP to others that haven't full HP.
for( j = 0; j < i; j++ )
{
- bsd = map_id2sd(b_sd[j]);
+ bsd = iMap->id2sd(b_sd[j]);
if( bsd != NULL && (tmp_hp = hp - status_get_max_hp(&bsd->bl)) > 0 )
{
extra_hp += tmp_hp;
@@ -329,7 +326,7 @@ int pc_banding(struct map_session_data *sd, uint16 skill_lv) {
for( j = 0; j < i; j++ )
{
- bsd = map_id2sd(b_sd[j]);
+ bsd = iMap->id2sd(b_sd[j]);
if( bsd != NULL )
{
status_set_hp(&bsd->bl,hp,0); // Set hp
@@ -418,7 +415,7 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) {
*------------------------------------------*/
static int pc_inventory_rental_end(int tid, unsigned int tick, int id, intptr_t data)
{
- struct map_session_data *sd = map_id2sd(id);
+ struct map_session_data *sd = iMap->id2sd(id);
if( sd == NULL )
return 0;
if( tid != sd->rental_timer )
@@ -427,7 +424,7 @@ static int pc_inventory_rental_end(int tid, unsigned int tick, int id, intptr_t
return 0;
}
- pc_inventory_rentals(sd);
+ iPc->inventory_rentals(sd);
return 1;
}
@@ -435,7 +432,7 @@ int pc_inventory_rental_clear(struct map_session_data *sd)
{
if( sd->rental_timer != INVALID_TIMER )
{
- delete_timer(sd->rental_timer, pc_inventory_rental_end);
+ iTimer->delete_timer(sd->rental_timer, pc_inventory_rental_end);
sd->rental_timer = INVALID_TIMER;
}
@@ -460,7 +457,7 @@ void pc_inventory_rentals(struct map_session_data *sd)
status_change_end(&sd->bl,SC_ALL_RIDING,INVALID_TIMER);
}
clif->rental_expired(sd->fd, i, sd->status.inventory[i].nameid);
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
+ iPc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
} else {
expire_tick = (unsigned int)(sd->status.inventory[i].expire_time - time(NULL)) * 1000;
clif->rental_time(sd->fd, sd->status.inventory[i].nameid, (int)(expire_tick / 1000));
@@ -470,7 +467,7 @@ void pc_inventory_rentals(struct map_session_data *sd)
}
if( c > 0 ) // min(next_tick,3600000) 1 hour each timer to keep announcing to the owner, and to avoid a but with rental time > 15 days
- sd->rental_timer = add_timer(gettick() + min(next_tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
+ sd->rental_timer = iTimer->add_timer(iTimer->gettick() + min(next_tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
else
sd->rental_timer = INVALID_TIMER;
}
@@ -485,15 +482,15 @@ void pc_inventory_rental_add(struct map_session_data *sd, int seconds)
if( sd->rental_timer != INVALID_TIMER )
{
const struct TimerData * td;
- td = get_timer(sd->rental_timer);
- if( DIFF_TICK(td->tick, gettick()) > tick )
+ td = iTimer->get_timer(sd->rental_timer);
+ if( DIFF_TICK(td->tick, iTimer->gettick()) > tick )
{ // Update Timer as this one ends first than the current one
- pc_inventory_rental_clear(sd);
- sd->rental_timer = add_timer(gettick() + tick, pc_inventory_rental_end, sd->bl.id, 0);
+ iPc->inventory_rental_clear(sd);
+ sd->rental_timer = iTimer->add_timer(iTimer->gettick() + tick, pc_inventory_rental_end, sd->bl.id, 0);
}
}
else
- sd->rental_timer = add_timer(gettick() + min(tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
+ sd->rental_timer = iTimer->add_timer(iTimer->gettick() + min(tick,3600000), pc_inventory_rental_end, sd->bl.id, 0);
}
/**
@@ -521,10 +518,9 @@ int pc_makesavestatus(struct map_session_data *sd)
#else
sd->status.option = sd->sc.option&(OPTION_INVISIBLE|OPTION_CART|OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR);
#endif
- if (sd->sc.data[SC_JAILED])
- { //When Jailed, do not move last point.
+ if (sd->sc.data[SC_JAILED]) { //When Jailed, do not move last point.
if(pc_isdead(sd)){
- pc_setrestartvalue(sd,0);
+ iPc->setrestartvalue(sd,0);
} else {
sd->status.hp = sd->battle_status.hp;
sd->status.sp = sd->battle_status.sp;
@@ -536,7 +532,7 @@ int pc_makesavestatus(struct map_session_data *sd)
}
if(pc_isdead(sd)){
- pc_setrestartvalue(sd,0);
+ iPc->setrestartvalue(sd,0);
memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point));
} else {
sd->status.hp = sd->battle_status.hp;
@@ -546,13 +542,25 @@ int pc_makesavestatus(struct map_session_data *sd)
sd->status.last_point.y = sd->bl.y;
}
- if(map[sd->bl.m].flag.nosave){
+ if(map[sd->bl.m].flag.nosave || map[sd->bl.m].instance_id >= 0){
struct map_data *m=&map[sd->bl.m];
if(m->save.map)
memcpy(&sd->status.last_point,&m->save,sizeof(sd->status.last_point));
else
memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point));
}
+ if( sd->status.last_point.map == 0 ) {
+ sd->status.last_point.map = 1;
+ sd->status.last_point.x = 0;
+ sd->status.last_point.y = 0;
+ }
+
+ if( sd->status.save_point.map == 0 ) {
+ sd->status.save_point.map = 1;
+ sd->status.save_point.x = 0;
+ sd->status.save_point.y = 0;
+ }
+
return 0;
}
@@ -573,7 +581,7 @@ int pc_setnewpc(struct map_session_data *sd, int account_id, int char_id, int lo
sd->client_tick = client_tick;
sd->state.active = 0; //to be set to 1 after player is fully authed and loaded.
sd->bl.type = BL_PC;
- sd->canlog_tick = gettick();
+ sd->canlog_tick = iTimer->gettick();
//Required to prevent homunculus copuing a base speed of 0.
sd->battle_status.speed = sd->base_status.speed = DEFAULT_WALK_SPEED;
return 0;
@@ -595,7 +603,7 @@ int pc_equippoint(struct map_session_data *sd,int n)
if(sd->inventory_data[n]->look == W_DAGGER ||
sd->inventory_data[n]->look == W_1HSWORD ||
sd->inventory_data[n]->look == W_1HAXE) {
- if(ep == EQP_HAND_R && (pc_checkskill(sd,AS_LEFT) > 0 || (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN ||
+ if(ep == EQP_HAND_R && (iPc->checkskill(sd,AS_LEFT) > 0 || (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN ||
(sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO))//Kagerou and Oboro can dual wield daggers. [Rytech]
return EQP_ARMS;
}
@@ -760,10 +768,10 @@ bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd
return false; // Both parents need to be in the same party
// Parents need to have their ring equipped
- if( !pc_isequipped(p1_sd, WEDDING_RING_M) && !pc_isequipped(p1_sd, WEDDING_RING_F) )
+ if( !iPc->isequipped(p1_sd, WEDDING_RING_M) && !iPc->isequipped(p1_sd, WEDDING_RING_F) )
return false;
- if( !pc_isequipped(p2_sd, WEDDING_RING_M) && !pc_isequipped(p2_sd, WEDDING_RING_F) )
+ if( !iPc->isequipped(p2_sd, WEDDING_RING_M) && !iPc->isequipped(p2_sd, WEDDING_RING_F) )
return false;
// Already adopted a baby
@@ -797,15 +805,15 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd,
int job, joblevel;
unsigned int jobexp;
- if( !pc_can_Adopt(p1_sd, p2_sd, b_sd) )
+ if( !iPc->can_Adopt(p1_sd, p2_sd, b_sd) )
return false;
// Preserve current job levels and progress
joblevel = b_sd->status.job_level;
jobexp = b_sd->status.job_exp;
- job = pc_mapid2jobid(b_sd->class_|JOBL_BABY, b_sd->status.sex);
- if( job != -1 && !pc_jobchange(b_sd, job, 0) )
+ job = iPc->mapid2jobid(b_sd->class_|JOBL_BABY, b_sd->status.sex);
+ if( job != -1 && !iPc->jobchange(b_sd, job, 0) )
{ // Success, proceed to configure parents and baby skills
p1_sd->status.child = b_sd->status.char_id;
p2_sd->status.child = b_sd->status.char_id;
@@ -819,12 +827,12 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd,
clif->updatestatus(b_sd, SP_JOBEXP);
// Baby Skills
- pc_skill(b_sd, WE_BABY, 1, 0);
- pc_skill(b_sd, WE_CALLPARENT, 1, 0);
+ iPc->skill(b_sd, WE_BABY, 1, 0);
+ iPc->skill(b_sd, WE_CALLPARENT, 1, 0);
// Parents Skills
- pc_skill(p1_sd, WE_CALLBABY, 1, 0);
- pc_skill(p2_sd, WE_CALLBABY, 1, 0);
+ iPc->skill(p1_sd, WE_CALLBABY, 1, 0);
+ iPc->skill(p2_sd, WE_CALLBABY, 1, 0);
return true;
}
@@ -908,10 +916,9 @@ int pc_isequip(struct map_session_data *sd,int n)
* No problem with the session id
* set the status that has been sent from char server
*------------------------------------------*/
-bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers)
-{
+bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers) {
int i;
- unsigned long tick = gettick();
+ unsigned long tick = iTimer->gettick();
uint32 ip = session[sd->fd]->client_addr;
sd->login_id2 = login_id2;
@@ -928,7 +935,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
}
//Set the map-server used job id. [Skotlex]
- i = pc_jobid2mapid(sd->status.class_);
+ i = iPc->jobid2mapid(sd->status.class_);
if (i == -1) { //Invalid class?
ShowError("pc_authok: Invalid class %d for player %s (%d:%d). Class was changed to novice.\n", sd->status.class_, sd->status.name, sd->status.account_id, sd->status.char_id);
sd->status.class_ = JOB_NOVICE;
@@ -998,10 +1005,10 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
if (!(battle_config.display_skill_fail&2))
sd->state.showdelay = 1;
- pc_setinventorydata(sd);
+ iPc->setinventorydata(sd);
pc_setequipindex(sd);
- if( sd->status.option & OPTION_INVISIBLE && !pc_can_use_command(sd, "@hide") )
+ if( sd->status.option & OPTION_INVISIBLE && !iPc->can_use_command(sd, "@hide") )
sd->status.option &=~ OPTION_INVISIBLE;
status_change_init(&sd->bl);
@@ -1017,6 +1024,19 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sd->disguise = -1;
+ sd->instance = NULL;
+ sd->instances = 0;
+
+ sd->bg_queue.arena = NULL;
+ sd->bg_queue.ready = 0;
+ sd->bg_queue.client_has_bg_data = 0;
+ sd->bg_queue.type = 0;
+
+ sd->queues = NULL;
+ sd->queues_count = 0;
+
+ sd->state.dialog = 0;
+
// Event Timers
for( i = 0; i < MAX_EVENTTIMER; i++ )
sd->eventtimer[i] = INVALID_TIMER;
@@ -1027,11 +1047,11 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sd->hate_mob[i] = -1;
//warp player
- if ((i=pc_setpos(sd,sd->status.last_point.map, sd->status.last_point.x, sd->status.last_point.y, CLR_OUTSIGHT)) != 0) {
+ if ((i=iPc->setpos(sd,sd->status.last_point.map, sd->status.last_point.x, sd->status.last_point.y, CLR_OUTSIGHT)) != 0) {
ShowError ("Last_point_map %s - id %d not found (error code %d)\n", mapindex_id2name(sd->status.last_point.map), sd->status.last_point.map, i);
// try warping to a default map instead (church graveyard)
- if (pc_setpos(sd, mapindex_name2id(MAP_PRONTERA), 273, 354, CLR_OUTSIGHT) != 0) {
+ if (iPc->setpos(sd, mapindex_name2id(MAP_PRONTERA), 273, 354, CLR_OUTSIGHT) != 0) {
// if we fail again
clif->authfail_fd(sd->fd, 0);
return false;
@@ -1067,26 +1087,18 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
sprintf(buf,"Unknown Version");
clif->message(sd->fd, buf);
}
-
- // Message of the Day [Valaris]
- for(i=0; motd_text[i][0] && i < MOTD_LINE_SIZE; i++) {
- if (battle_config.motd_type)
- clif->disp_onlyself(sd,motd_text[i],strlen(motd_text[i]));
- else
- clif->message(sd->fd, motd_text[i]);
- }
-
+
// message of the limited time of the account
if (expiration_time != 0) { // don't display if it's unlimited or unknow value
char tmpstr[1024];
strftime(tmpstr, sizeof(tmpstr) - 1, msg_txt(501), localtime(&expiration_time)); // "Your account time limit is: %d-%m-%Y %H:%M:%S."
- clif->wis_message(sd->fd, wisp_server_name, tmpstr, strlen(tmpstr)+1);
+ clif->wis_message(sd->fd, iMap->wisp_server_name, tmpstr, strlen(tmpstr)+1);
}
/**
* Fixes login-without-aura glitch (the screen won't blink at this point, don't worry :P)
**/
- clif->changemap(sd,sd->mapindex,sd->bl.x,sd->bl.y);
+ clif->changemap(sd,sd->bl.m,sd->bl.x,sd->bl.y);
}
/**
@@ -1097,7 +1109,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim
/**
* Check if player have any item cooldowns on
**/
- pc_itemcd_do(sd,true);
+ iPc->itemcd_do(sd,true);
/* [Ind/Hercules] */
sd->sc_display = NULL;
@@ -1171,7 +1183,7 @@ int pc_reg_received(struct map_session_data *sd)
for(i=0;i<MAX_PC_FEELHATE;i++) { //for now - someone need to make reading from txt/sql
if ((j = pc_readglobalreg(sd,sg_info[i].feel_var))!=0) {
sd->feel_map[i].index = j;
- sd->feel_map[i].m = map_mapindex2mapid(j);
+ sd->feel_map[i].m = iMap->mapindex2mapid(j);
} else {
sd->feel_map[i].index = 0;
sd->feel_map[i].m = -1;
@@ -1179,7 +1191,7 @@ int pc_reg_received(struct map_session_data *sd)
sd->hate_mob[i] = pc_readglobalreg(sd,sg_info[i].hate_var)-1;
}
- if ((i = pc_checkskill(sd,RG_PLAGIARISM)) > 0) {
+ if ((i = iPc->checkskill(sd,RG_PLAGIARISM)) > 0) {
sd->cloneskill_id = pc_readglobalreg(sd,"CLONE_SKILL");
if (sd->cloneskill_id > 0 && (idx = skill->get_index(sd->cloneskill_id))) {
sd->status.skill[idx].id = sd->cloneskill_id;
@@ -1189,7 +1201,7 @@ int pc_reg_received(struct map_session_data *sd)
sd->status.skill[idx].flag = SKILL_FLAG_PLAGIARIZED;
}
}
- if ((i = pc_checkskill(sd,SC_REPRODUCE)) > 0) {
+ if ((i = iPc->checkskill(sd,SC_REPRODUCE)) > 0) {
sd->reproduceskill_id = pc_readglobalreg(sd,"REPRODUCE_SKILL");
if( sd->reproduceskill_id > 0 && (idx = skill->get_index(sd->reproduceskill_id))) {
sd->status.skill[idx].id = sd->reproduceskill_id;
@@ -1205,7 +1217,7 @@ int pc_reg_received(struct map_session_data *sd)
sd->state.active = 1;
if (sd->status.party_id)
- party_member_joined(sd);
+ iParty->member_joined(sd);
if (sd->status.guild_id)
guild->member_joined(sd);
@@ -1221,12 +1233,12 @@ int pc_reg_received(struct map_session_data *sd)
if( sd->status.ele_id > 0 )
intif_elemental_request(sd->status.ele_id, sd->status.char_id);
- map_addiddb(&sd->bl);
- map_delnickdb(sd->status.char_id, sd->status.name);
+ iMap->addiddb(&sd->bl);
+ iMap->delnickdb(sd->status.char_id, sd->status.name);
if (!chrif_auth_finished(sd))
ShowError("pc_reg_received: Failed to properly remove player %d:%d from logging db!\n", sd->status.account_id, sd->status.char_id);
- pc_load_combo(sd);
+ iPc->load_combo(sd);
status_calc_pc(sd,1);
chrif_scdata_request(sd->status.account_id, sd->status.char_id);
@@ -1239,7 +1251,7 @@ int pc_reg_received(struct map_session_data *sd)
clif->pLoadEndAck(sd->fd, sd);
}
- pc_inventory_rentals(sd);
+ iPc->inventory_rentals(sd);
if( sd->sc.option & OPTION_INVISIBLE ) {
sd->vd.class_ = INVISIBLE_CLASS;
@@ -1248,12 +1260,14 @@ int pc_reg_received(struct map_session_data *sd)
map[sd->bl.m].users_pvp--;
if( map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER ) {// unregister the player for ranking
- delete_timer( sd->pvp_timer, pc_calc_pvprank_timer );
+ iTimer->delete_timer( sd->pvp_timer, iPc->calc_pvprank_timer );
sd->pvp_timer = INVALID_TIMER;
}
clif->changeoption(&sd->bl);
}
+ if( npc->motd ) /* [Ind/Hercules] */
+ run_script(npc->motd->u.scr.script, 0, sd->bl.id, fake_nd->bl.id);
return 1;
}
@@ -1265,7 +1279,7 @@ static int pc_calc_skillpoint(struct map_session_data* sd)
nullpo_ret(sd);
for(i=1;i<MAX_SKILL;i++){
- if( (skill_lv = pc_checkskill2(sd,i)) > 0) {
+ if( (skill_lv = iPc->checkskill2(sd,i)) > 0) {
inf2 = skill_db[i].inf2;
if((!(inf2&INF2_QUEST_SKILL) || battle_config.quest_skill_learn) &&
!(inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL)) //Do not count wedding/link skills. [Skotlex]
@@ -1291,14 +1305,14 @@ int pc_calc_skilltree(struct map_session_data *sd)
int c=0;
nullpo_ret(sd);
- i = pc_calc_skilltree_normalize_job(sd);
- c = pc_mapid2jobid(i, sd->status.sex);
+ i = iPc->calc_skilltree_normalize_job(sd);
+ c = iPc->mapid2jobid(i, sd->status.sex);
if( c == -1 )
{ //Unable to normalize job??
ShowError("pc_calc_skilltree: Unable to normalize job %d for character %s (%d:%d)\n", i, sd->status.name, sd->status.account_id, sd->status.char_id);
return 1;
}
- c = pc_class2idx(c);
+ c = iPc->class2idx(c);
for( i = 0; i < MAX_SKILL; i++ ) {
if( sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED && sd->status.skill[i].flag != SKILL_FLAG_PERM_GRANTED ) //Don't touch these
@@ -1396,7 +1410,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
else if (sd->status.skill[idx2].flag >= SKILL_FLAG_REPLACED_LV_0) //Real lerned level
k = sd->status.skill[idx2].flag - SKILL_FLAG_REPLACED_LV_0;
else
- k = pc_checkskill2(sd,idx2);
+ k = iPc->checkskill2(sd,idx2);
if (k < skill_tree[c][i].need[j].lv) {
f = 0;
break;
@@ -1429,7 +1443,7 @@ int pc_calc_skilltree(struct map_session_data *sd)
} while(flag);
//
- if( c > 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && sd->status.skill_point == 0 && pc_famerank(sd->status.char_id, MAPID_TAEKWON) )
+ if( c > 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && sd->status.skill_point == 0 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON) )
{
/* Taekwon Ranger Bonus Skill Tree
============================================
@@ -1465,13 +1479,13 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill_id)
if(battle_config.skillfree)
return; //Function serves no purpose if this is set
- i = pc_calc_skilltree_normalize_job(sd);
- c = pc_mapid2jobid(i, sd->status.sex);
+ i = iPc->calc_skilltree_normalize_job(sd);
+ c = iPc->mapid2jobid(i, sd->status.sex);
if (c == -1) { //Unable to normalize job??
ShowError("pc_check_skilltree: Unable to normalize job %d for character %s (%d:%d)\n", i, sd->status.name, sd->status.account_id, sd->status.char_id);
return;
}
- c = pc_class2idx(c);
+ c = iPc->class2idx(c);
do {
flag = 0;
for( i = 0; i < MAX_SKILL_TREE && (id=skill_tree[c][i].id)>0; i++ ) {
@@ -1488,7 +1502,7 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill_id)
else if( sd->status.skill[idx2].flag >= SKILL_FLAG_REPLACED_LV_0) //Real lerned level
k = sd->status.skill[idx2].flag - SKILL_FLAG_REPLACED_LV_0;
else
- k = pc_checkskill2(sd,idx2);
+ k = iPc->checkskill2(sd,idx2);
if( k < skill_tree[c][i].need[j].lv ) {
f = 0;
break;
@@ -1543,7 +1557,7 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd)
skill_point = pc_calc_skillpoint(sd);
- novice_skills = max_level[pc_class2idx(JOB_NOVICE)][1] - 1;
+ novice_skills = max_level[iPc->class2idx(JOB_NOVICE)][1] - 1;
// limit 1st class and above to novice job levels
if(skill_point < novice_skills)
@@ -1560,7 +1574,7 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd)
{
// if neither 2nd nor 3rd jobchange levels are known, we have to assume a default for 2nd
if (!sd->change_level_3rd)
- sd->change_level_2nd = max_level[pc_class2idx(pc_mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex))][1];
+ sd->change_level_2nd = max_level[iPc->class2idx(iPc->mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex))][1];
else
sd->change_level_2nd = 1 + skill_point + sd->status.skill_point
- (sd->status.job_level - 1)
@@ -1651,8 +1665,12 @@ int pc_disguise(struct map_session_data *sd, int class_) {
}
if (sd->bl.prev != NULL) {
- pc_stop_walking(sd, 0);
- clif->clearunit_area(&sd->bl, CLR_OUTSIGHT);
+ if( class_ == -1 && sd->disguise == sd->status.class_ ) {
+ clif->clearunit_single(-sd->bl.id,CLR_OUTSIGHT,sd->fd);
+ } else if ( class_ != sd->status.class_ ) {
+ pc_stop_walking(sd, 0);
+ clif->clearunit_area(&sd->bl, CLR_OUTSIGHT);
+ }
}
if (class_ == -1) {
@@ -1895,7 +1913,7 @@ int pc_delautobonus(struct map_session_data* sd, struct s_autobonus *autobonus,c
}
else
{ // Logout / Unequipped an item with an activated bonus
- delete_timer(autobonus[i].active,pc_endautobonus);
+ iTimer->delete_timer(autobonus[i].active,iPc->endautobonus);
autobonus[i].active = INVALID_TIMER;
}
}
@@ -1923,7 +1941,7 @@ int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus)
script_run_autobonus(autobonus->other_script,sd->bl.id,sd->equip_index[j]);
}
- autobonus->active = add_timer(gettick()+autobonus->duration, pc_endautobonus, sd->bl.id, (intptr_t)autobonus);
+ autobonus->active = iTimer->add_timer(iTimer->gettick()+autobonus->duration, iPc->endautobonus, sd->bl.id, (intptr_t)autobonus);
sd->state.autobonus |= autobonus->pos;
status_calc_pc(sd,0);
@@ -1932,7 +1950,7 @@ int pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus)
int pc_endautobonus(int tid, unsigned int tick, int id, intptr_t data)
{
- struct map_session_data *sd = map_id2sd(id);
+ struct map_session_data *sd = iMap->id2sd(id);
struct s_autobonus *autobonus = (struct s_autobonus *)data;
nullpo_ret(sd);
@@ -3538,7 +3556,7 @@ int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip)
// remember the card id to insert
nameid = sd->status.inventory[idx_card].nameid;
- if( pc_delitem(sd,idx_card,1,1,0,LOG_TYPE_OTHER) == 1 )
+ if( iPc->delitem(sd,idx_card,1,1,0,LOG_TYPE_OTHER) == 1 )
{// failed
clif->insert_card(sd,idx_equip,idx_card,1);
}
@@ -3563,9 +3581,9 @@ int pc_insert_card(struct map_session_data* sd, int idx_card, int idx_equip)
int pc_modifybuyvalue(struct map_session_data *sd,int orig_value)
{
int skill,val = orig_value,rate1 = 0,rate2 = 0;
- if((skill=pc_checkskill(sd,MC_DISCOUNT))>0) // merchant discount
+ if((skill=iPc->checkskill(sd,MC_DISCOUNT))>0) // merchant discount
rate1 = 5+skill*2-((skill==10)? 1:0);
- if((skill=pc_checkskill(sd,RG_COMPULSION))>0) // rogue discount
+ if((skill=iPc->checkskill(sd,RG_COMPULSION))>0) // rogue discount
rate2 = 5+skill*4;
if(rate1 < rate2) rate1 = rate2;
if(rate1)
@@ -3582,7 +3600,7 @@ int pc_modifybuyvalue(struct map_session_data *sd,int orig_value)
int pc_modifysellvalue(struct map_session_data *sd,int orig_value)
{
int skill,val = orig_value,rate = 0;
- if((skill=pc_checkskill(sd,MC_OVERCHARGE))>0) //OverCharge
+ if((skill=iPc->checkskill(sd,MC_OVERCHARGE))>0) //OverCharge
rate = 5+skill*2-((skill==10)? 1:0);
if(rate)
val = (int)((double)orig_value*(double)(100+rate)/100.);
@@ -3871,7 +3889,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l
if( i >= MAX_INVENTORY )
{
- i = pc_search_inventory(sd,0);
+ i = iPc->search_inventory(sd,0);
if( i < 0 )
return 4;
@@ -3894,17 +3912,17 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l
clif->updatestatus(sd,SP_WEIGHT);
//Auto-equip
if(data->flag.autoequip)
- pc_equipitem(sd, i, data->equip);
+ iPc->equipitem(sd, i, data->equip);
/* rental item check */
if( item_data->expire_time ) {
if( time(NULL) > item_data->expire_time ) {
clif->rental_expired(sd->fd, i, sd->status.inventory[i].nameid);
- pc_delitem(sd, i, sd->status.inventory[i].amount, 1, 0, LOG_TYPE_OTHER);
+ iPc->delitem(sd, i, sd->status.inventory[i].amount, 1, 0, LOG_TYPE_OTHER);
} else {
int seconds = (int)( item_data->expire_time - time(NULL) );
clif->rental_time(sd->fd, sd->status.inventory[i].nameid, seconds);
- pc_inventory_rental_add(sd, seconds);
+ iPc->inventory_rental_add(sd, seconds);
}
}
@@ -3934,7 +3952,7 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type, short reas
sd->weight -= sd->inventory_data[n]->weight*amount ;
if( sd->status.inventory[n].amount <= 0 ){
if(sd->status.inventory[n].equip)
- pc_unequipitem(sd,n,3);
+ iPc->unequipitem(sd,n,3);
memset(&sd->status.inventory[n],0,sizeof(sd->status.inventory[0]));
sd->inventory_data[n] = NULL;
}
@@ -3966,7 +3984,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
sd->status.inventory[n].amount <= 0 ||
sd->status.inventory[n].amount < amount ||
sd->state.trading || sd->state.vending ||
- !sd->inventory_data[n] //pc_delitem would fail on this case.
+ !sd->inventory_data[n] //iPc->delitem would fail on this case.
)
return 0;
@@ -3976,16 +3994,16 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
return 0; //Can't drop items in nodrop mapflag maps.
}
- if( !pc_candrop(sd,&sd->status.inventory[n]) )
+ if( !iPc->candrop(sd,&sd->status.inventory[n]) )
{
clif->message (sd->fd, msg_txt(263));
return 0;
}
- if (!map_addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2))
+ if (!iMap->addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2))
return 0;
- pc_delitem(sd, n, amount, 1, 0, LOG_TYPE_PICKDROP_PLAYER);
+ iPc->delitem(sd, n, amount, 1, 0, LOG_TYPE_PICKDROP_PLAYER);
clif->dropitem(sd, n, amount);
return 1;
}
@@ -3999,7 +4017,7 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount)
int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
{
int flag=0;
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
struct map_session_data *first_sd = NULL,*second_sd = NULL,*third_sd = NULL;
struct party_data *p=NULL;
@@ -4010,11 +4028,11 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
return 0; // Distance is too far
if (sd->status.party_id)
- p = party_search(sd->status.party_id);
+ p = iParty->search(sd->status.party_id);
if(fitem->first_get_charid > 0 && fitem->first_get_charid != sd->status.char_id)
{
- first_sd = map_charid2sd(fitem->first_get_charid);
+ first_sd = iMap->charid2sd(fitem->first_get_charid);
if(DIFF_TICK(tick,fitem->first_get_tick) < 0) {
if (!(p && p->party.item&1 &&
first_sd && first_sd->status.party_id == sd->status.party_id
@@ -4024,7 +4042,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
else
if(fitem->second_get_charid > 0 && fitem->second_get_charid != sd->status.char_id)
{
- second_sd = map_charid2sd(fitem->second_get_charid);
+ second_sd = iMap->charid2sd(fitem->second_get_charid);
if(DIFF_TICK(tick, fitem->second_get_tick) < 0) {
if(!(p && p->party.item&1 &&
((first_sd && first_sd->status.party_id == sd->status.party_id) ||
@@ -4035,7 +4053,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
else
if(fitem->third_get_charid > 0 && fitem->third_get_charid != sd->status.char_id)
{
- third_sd = map_charid2sd(fitem->third_get_charid);
+ third_sd = iMap->charid2sd(fitem->third_get_charid);
if(DIFF_TICK(tick,fitem->third_get_tick) < 0) {
if(!(p && p->party.item&1 &&
((first_sd && first_sd->status.party_id == sd->status.party_id) ||
@@ -4049,7 +4067,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
}
//This function takes care of giving the item to whoever should have it, considering party-share options.
- if ((flag = party_share_loot(p,sd,&fitem->item_data, fitem->first_get_charid))) {
+ if ((flag = iParty->share_loot(p,sd,&fitem->item_data, fitem->first_get_charid))) {
clif->additem(sd,0,0,flag);
return 1;
}
@@ -4057,7 +4075,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem)
//Display pickup animation.
pc_stop_attack(sd);
clif->takeitem(&sd->bl,&fitem->bl);
- map_clearflooritem(&fitem->bl);
+ iMap->clearflooritem(&fitem->bl);
return 1;
}
@@ -4085,7 +4103,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
if( !item->script ) //if it has no script, you can't really consume it!
return 0;
- if( (item->item_usage.flag&NOUSE_SITTING) && (pc_issit(sd) == 1) && (pc_get_group_level(sd) < item->item_usage.override) ) {
+ if( (item->item_usage.flag&NOUSE_SITTING) && (pc_issit(sd) == 1) && (iPc->get_group_level(sd) < item->item_usage.override) ) {
clif->msgtable(sd->fd,664);
//clif->colormes(sd->fd,COLOR_WHITE,msg_txt(1474));
return 0; // You cannot use this item while sitting.
@@ -4230,7 +4248,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
*------------------------------------------*/
int pc_useitem(struct map_session_data *sd,int n)
{
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
int amount, nameid, i;
struct script_code *script;
@@ -4250,7 +4268,7 @@ int pc_useitem(struct map_session_data *sd,int n)
if( !pc_isUseitem(sd,n) )
return 0;
- // Store information for later use before it is lost (via pc_delitem) [Paradox924X]
+ // Store information for later use before it is lost (via iPc->delitem) [Paradox924X]
nameid = sd->inventory_data[n]->nameid;
if (nameid != ITEMID_NAUTHIZ && sd->sc.opt1 > 0 && sd->sc.opt1 != OPT1_STONEWAIT && sd->sc.opt1 != OPT1_BURNING)
@@ -4330,7 +4348,7 @@ int pc_useitem(struct map_session_data *sd,int n)
if( map[sd->bl.m].zone->disabled_items[i] == nameid ) {
if( battle_config.item_restricted_consumption_type ) {
clif->useitemack(sd,n,sd->status.inventory[n].amount-1,true);
- pc_delitem(sd,n,1,1,0,LOG_TYPE_CONSUME);
+ iPc->delitem(sd,n,1,1,0,LOG_TYPE_CONSUME);
}
return 0;
}
@@ -4349,12 +4367,12 @@ int pc_useitem(struct map_session_data *sd,int n)
else {
if( sd->status.inventory[n].expire_time == 0 ) {
clif->useitemack(sd,n,amount-1,true);
- pc_delitem(sd,n,1,1,0,LOG_TYPE_CONSUME); // Rental Usable Items are not deleted until expiration
+ iPc->delitem(sd,n,1,1,0,LOG_TYPE_CONSUME); // Rental Usable Items are not deleted until expiration
} else
clif->useitemack(sd,n,0,false);
}
if(sd->status.inventory[n].card[0]==CARD0_CREATE &&
- pc_famerank(MakeDWord(sd->status.inventory[n].card[2],sd->status.inventory[n].card[3]), MAPID_ALCHEMIST))
+ iPc->famerank(MakeDWord(sd->status.inventory[n].card[2],sd->status.inventory[n].card[3]), MAPID_ALCHEMIST))
{
potion_flag = 2; // Famous player's potions have 50% more efficiency
if (sd->sc.data[SC_SPIRIT] && sd->sc.data[SC_SPIRIT]->val2 == SL_ROGUE)
@@ -4394,7 +4412,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun
return 1;
}
- if( !itemdb_cancartstore(item_data, pc_get_group_level(sd)) )
+ if( !itemdb_cancartstore(item_data, iPc->get_group_level(sd)) )
{ // Check item trade restrictions [Skotlex]
clif->message (sd->fd, msg_txt(264));
return 1;
@@ -4489,8 +4507,8 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount)
if( item_data->nameid == 0 || amount < 1 || item_data->amount < amount || sd->state.vending )
return 1;
- if( pc_cart_additem(sd,item_data,amount,LOG_TYPE_NONE) == 0 )
- return pc_delitem(sd,idx,amount,0,5,LOG_TYPE_NONE);
+ if( iPc->cart_additem(sd,item_data,amount,LOG_TYPE_NONE) == 0 )
+ return iPc->delitem(sd,idx,amount,0,5,LOG_TYPE_NONE);
return 1;
}
@@ -4517,7 +4535,7 @@ int pc_cartitem_amount(struct map_session_data* sd, int idx, int amount)
/*==========================================
* Retrieve an item at index idx from cart.
* Return:
- * 0 = player not found or (FIXME) succes (from pc_cart_delitem)
+ * 0 = player not found or (FIXME) succes (from iPc->cart_delitem)
* 1 = failure
*------------------------------------------*/
int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount)
@@ -4534,8 +4552,8 @@ int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount)
if(item_data->nameid==0 || amount < 1 || item_data->amount<amount || sd->state.vending )
return 1;
- if((flag = pc_additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0)
- return pc_cart_delitem(sd,idx,amount,0,LOG_TYPE_NONE);
+ if((flag = iPc->additem(sd,item_data,amount,LOG_TYPE_NONE)) == 0)
+ return iPc->cart_delitem(sd,idx,amount,0,LOG_TYPE_NONE);
clif->additem(sd,0,0,flag);
return 1;
@@ -4618,7 +4636,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil
tmp_item.nameid = itemid;
tmp_item.amount = 1;
tmp_item.identify = itemdb_isidentified2(data);
- flag = pc_additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER);
+ flag = iPc->additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER);
//TODO: Should we disable stealing when the item you stole couldn't be added to your inventory? Perhaps players will figure out a way to exploit this behaviour otherwise?
md->state.steal_flag = UCHAR_MAX; //you can't steal from this mob any more
@@ -4665,13 +4683,13 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target)
return 0;
// FIXME: This formula is either custom or outdated.
- skill = pc_checkskill(sd,RG_STEALCOIN)*10;
+ skill = iPc->checkskill(sd,RG_STEALCOIN)*10;
rate = skill + (sd->status.base_level - md->level)*3 + sd->battle_status.dex*2 + sd->battle_status.luk*2;
if(rnd()%1000 < rate)
{
int amount = md->level*10 + rnd()%100;
- pc_getzeny(sd, amount, LOG_TYPE_STEAL, NULL);
+ iPc->getzeny(sd, amount, LOG_TYPE_STEAL, NULL);
md->state.steal_coin_flag = 1;
return 1;
}
@@ -4685,36 +4703,62 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target)
* 1 - Invalid map index.
* 2 - Map not in this map-server, and failed to locate alternate map-server.
*------------------------------------------*/
-int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype)
-{
- struct party_data *p;
+int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype) {
int16 m;
nullpo_ret(sd);
- if( !mapindex || !mapindex_id2name(mapindex) )
- {
+ if( !mapindex || !mapindex_id2name(mapindex) ) {
ShowDebug("pc_setpos: Passed mapindex(%d) is invalid!\n", mapindex);
return 1;
}
- if( pc_isdead(sd) )
- { //Revive dead people before warping them
- pc_setstand(sd);
- pc_setrestartvalue(sd,1);
+ if( pc_isdead(sd) ) { //Revive dead people before warping them
+ iPc->setstand(sd);
+ iPc->setrestartvalue(sd,1);
}
+ m = iMap->mapindex2mapid(mapindex);
- m = map_mapindex2mapid(mapindex);
- if( map[m].flag.src4instance && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id )
- {
- // Request the mapid of this src map into the instance of the party
- int im = instance_map2imap(m, p->instance_id);
- if( im < 0 )
- ; // Player will enter the src map for instances
- else
- { // Changes destiny to the instance map, not the source map
- m = im;
- mapindex = map_id2index(m);
+ if( map[m].flag.src4instance ) {
+ struct party_data *p;
+ bool stop = false;
+ int i = 0, j = 0;
+
+ if( sd->instances ) {
+ for( i = 0; i < sd->instances; i++ ) {
+ ARR_FIND(0, instances[sd->instance[i]].num_map, j, map[instances[sd->instance[i]].map[j]].instance_src_map == m && !map[instances[sd->instance[i]].map[j]].cName);
+ if( j != instances[sd->instance[i]].num_map )
+ break;
+ }
+ if( i != sd->instances ) {
+ m = instances[sd->instance[i]].map[j];
+ mapindex = map[m].index;
+ stop = true;
+ }
+ }
+ if ( !stop && sd->status.party_id && (p = iParty->search(sd->status.party_id)) && p->instances ) {
+ for( i = 0; i < p->instances; i++ ) {
+ ARR_FIND(0, instances[p->instance[i]].num_map, j, map[instances[p->instance[i]].map[j]].instance_src_map == m && !map[instances[p->instance[i]].map[j]].cName);
+ if( j != instances[p->instance[i]].num_map )
+ break;
+ }
+ if( i != p->instances ) {
+ m = instances[p->instance[i]].map[j];
+ mapindex = map[m].index;
+ stop = true;
+ }
+ }
+ if ( !stop && sd->status.guild_id && sd->guild && sd->guild->instances ) {
+ for( i = 0; i < sd->guild->instances; i++ ) {
+ ARR_FIND(0, instances[sd->guild->instance[i]].num_map, j, map[instances[sd->guild->instance[i]].map[j]].instance_src_map == m && !map[instances[sd->guild->instance[i]].map[j]].cName);
+ if( j != instances[sd->guild->instance[i]].num_map )
+ break;
+ }
+ if( i != sd->guild->instances ) {
+ m = instances[sd->guild->instance[i]].map[j];
+ mapindex = map[m].index;
+ stop = true;
+ }
}
}
@@ -4723,6 +4767,17 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
if( sd->state.changemap ) { // Misc map-changing settings
int i;
sd->state.pmap = sd->bl.m;
+
+ for( i = 0; i < sd->queues_count; i++ ) {
+ struct hQueue *queue;
+ if( (queue = script->queue(sd->queues[i])) && queue->onMapChange[0] != '\0' ) {
+ iPc->setregstr(sd, add_str("QMapChangeTo"), map[m].name);
+ npc_event(sd, queue->onMapChange, 0);
+ }
+ }
+
+ if( map[m].cell == (struct mapcell *)0xdeadbeaf )
+ iMap->cellfromcache(&map[m]);
if (sd->sc.count) { // Cancel some map related stuff.
if (sd->sc.data[SC_JAILED])
return 1; //You may not get out!
@@ -4735,8 +4790,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
if (sd->sc.data[SC_KNOWLEDGE]) {
struct status_change_entry *sce = sd->sc.data[SC_KNOWLEDGE];
if (sce->timer != INVALID_TIMER)
- delete_timer(sce->timer, status_change_timer);
- sce->timer = add_timer(gettick() + skill->get_time(SG_KNOWLEDGE, sce->val1), status_change_timer, sd->bl.id, SC_KNOWLEDGE);
+ iTimer->delete_timer(sce->timer, status_change_timer);
+ sce->timer = iTimer->add_timer(iTimer->gettick() + skill->get_time(SG_KNOWLEDGE, sce->val1), status_change_timer, sd->bl.id, SC_KNOWLEDGE);
}
status_change_end(&sd->bl, SC_PROPERTYWALK, INVALID_TIMER);
status_change_end(&sd->bl, SC_CLOAKING, INVALID_TIMER);
@@ -4744,12 +4799,12 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
}
for( i = 0; i < EQI_MAX; i++ ) {
if( sd->equip_index[ i ] >= 0 )
- if( !pc_isequip( sd , sd->equip_index[ i ] ) )
- pc_unequipitem( sd , sd->equip_index[ i ] , 2 );
+ if( !iPc->isequip( sd , sd->equip_index[ i ] ) )
+ iPc->unequipitem( sd , sd->equip_index[ i ] , 2 );
}
if (battle_config.clear_unit_onwarp&BL_PC)
skill->clear_unitgroup(&sd->bl);
- party_send_dot_remove(sd); //minimap dot fix [Kevin]
+ iParty->send_dot_remove(sd); //minimap dot fix [Kevin]
guild->send_dot_remove(sd);
bg_send_dot_remove(sd);
if (sd->regen.state.gc)
@@ -4766,12 +4821,11 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
}
- if( m < 0 )
- {
+ if( m < 0 ) {
uint32 ip;
uint16 port;
//if can't find any map-servers, just abort setting position.
- if(!sd->mapindex || map_mapname2ipport(mapindex,&ip,&port))
+ if(!sd->mapindex || iMap->mapname2ipport(mapindex,&ip,&port))
return 2;
if (sd->npc_id)
@@ -4782,7 +4836,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
sd->mapindex = mapindex;
sd->bl.x=x;
sd->bl.y=y;
- pc_clean_skilltree(sd);
+ iPc->clean_skilltree(sd);
chrif_save(sd,2);
chrif_changemapserver(sd, ip, (short)port);
@@ -4792,28 +4846,26 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
return 0;
}
- if( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys )
- {
+ if( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys ) {
ShowError("pc_setpos: attempt to place player %s (%d:%d) on invalid coordinates (%s-%d,%d)\n", sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(mapindex),x,y);
x = y = 0; // make it random
}
- if( x == 0 && y == 0 )
- {// pick a random walkable cell
+ if( x == 0 && y == 0 ) {// pick a random walkable cell
do {
x=rnd()%(map[m].xs-2)+1;
y=rnd()%(map[m].ys-2)+1;
- } while(map_getcell(m,x,y,CELL_CHKNOPASS));
+ } while(iMap->getcell(m,x,y,CELL_CHKNOPASS));
}
- if (sd->state.vending && map_getcell(m,x,y,CELL_CHKNOVENDING)) {
+ if (sd->state.vending && iMap->getcell(m,x,y,CELL_CHKNOVENDING)) {
clif->message (sd->fd, msg_txt(204)); // "You can't open a shop on this cell."
vending->close(sd);
}
if(sd->bl.prev != NULL){
unit_remove_map_pc(sd,clrtype);
- clif->changemap(sd,map[m].index,x,y); // [MouseJstr]
+ clif->changemap(sd,m,x,y); // [MouseJstr]
} else if(sd->state.active)
//Tag player for rewarping after map-loading is done. [Skotlex]
sd->state.rewarp = 1;
@@ -4823,31 +4875,27 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
sd->bl.x = sd->ud.to_x = x;
sd->bl.y = sd->ud.to_y = y;
- if( sd->status.guild_id > 0 && map[m].flag.gvg_castle )
- { // Increased guild castle regen [Valaris]
+ if( sd->status.guild_id > 0 && map[m].flag.gvg_castle ) { // Increased guild castle regen [Valaris]
struct guild_castle *gc = guild->mapindex2gc(sd->mapindex);
if(gc && gc->guild_id == sd->status.guild_id)
sd->regen.state.gc = 1;
}
- if( sd->status.pet_id > 0 && sd->pd && sd->pd->pet.intimate > 0 )
- {
+ if( sd->status.pet_id > 0 && sd->pd && sd->pd->pet.intimate > 0 ) {
sd->pd->bl.m = m;
sd->pd->bl.x = sd->pd->ud.to_x = x;
sd->pd->bl.y = sd->pd->ud.to_y = y;
sd->pd->ud.dir = sd->ud.dir;
}
- if( homun_alive(sd->hd) )
- {
+ if( homun_alive(sd->hd) ) {
sd->hd->bl.m = m;
sd->hd->bl.x = sd->hd->ud.to_x = x;
sd->hd->bl.y = sd->hd->ud.to_y = y;
sd->hd->ud.dir = sd->ud.dir;
}
- if( sd->md )
- {
+ if( sd->md ) {
sd->md->bl.m = m;
sd->md->bl.x = sd->md->ud.to_x = x;
sd->md->bl.y = sd->md->ud.to_y = y;
@@ -4861,7 +4909,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
* Warp player sd to random location on current map.
* May fail if no walkable cell found (1000 attempts).
* Return:
- * 0 = fail or FIXME success (from pc_setpos)
+ * 0 = fail or FIXME success (from iPc->setpos)
* x(1|2) = fail
*------------------------------------------*/
int pc_randomwarp(struct map_session_data *sd, clr_type type)
@@ -4879,10 +4927,10 @@ int pc_randomwarp(struct map_session_data *sd, clr_type type)
do{
x=rnd()%(map[m].xs-2)+1;
y=rnd()%(map[m].ys-2)+1;
- }while(map_getcell(m,x,y,CELL_CHKNOPASS) && (i++)<1000 );
+ }while(iMap->getcell(m,x,y,CELL_CHKNOPASS) && (i++)<1000 );
if (i < 1000)
- return pc_setpos(sd,map[sd->bl.m].index,x,y,type);
+ return iPc->setpos(sd,map[sd->bl.m].index,x,y,type);
return 0;
}
@@ -4908,7 +4956,7 @@ int pc_memo(struct map_session_data* sd, int pos)
return 0; // invalid input
// check required skill level
- skill = pc_checkskill(sd, AL_WARP);
+ skill = iPc->checkskill(sd, AL_WARP);
if( skill < 1 ) {
clif->skill_memomessage(sd,2); // "You haven't learned Warp."
return 0;
@@ -5554,7 +5602,7 @@ int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data)
struct map_session_data *sd;
struct block_list *tbl;
- sd = map_id2sd(id);
+ sd = iMap->id2sd(id);
nullpo_ret(sd);
if (sd->followtimer != tid){
@@ -5564,11 +5612,11 @@ int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data)
}
sd->followtimer = INVALID_TIMER;
- tbl = map_id2bl(sd->followtarget);
+ tbl = iMap->id2bl(sd->followtarget);
if (tbl == NULL || pc_isdead(sd) || status_isdead(tbl))
{
- pc_stop_following(sd);
+ iPc->stop_following(sd);
return 0;
}
@@ -5581,9 +5629,9 @@ int pc_follow_timer(int tid, unsigned int tick, int id, intptr_t data)
if (!check_distance_bl(&sd->bl, tbl, 5))
unit_walktobl(&sd->bl, tbl, 5, 0);
} else
- pc_setpos(sd, map_id2index(tbl->m), tbl->x, tbl->y, CLR_TELEPORT);
+ iPc->setpos(sd, map_id2index(tbl->m), tbl->x, tbl->y, CLR_TELEPORT);
}
- sd->followtimer = add_timer(
+ sd->followtimer = iTimer->add_timer(
tick + 1000, // increase time a bit to loosen up map's load
pc_follow_timer, sd->bl.id, 0);
return 0;
@@ -5594,7 +5642,7 @@ int pc_stop_following (struct map_session_data *sd)
nullpo_ret(sd);
if (sd->followtimer != INVALID_TIMER) {
- delete_timer(sd->followtimer,pc_follow_timer);
+ iTimer->delete_timer(sd->followtimer,pc_follow_timer);
sd->followtimer = INVALID_TIMER;
}
sd->followtarget = -1;
@@ -5607,20 +5655,20 @@ int pc_stop_following (struct map_session_data *sd)
int pc_follow(struct map_session_data *sd,int target_id)
{
- struct block_list *bl = map_id2bl(target_id);
+ struct block_list *bl = iMap->id2bl(target_id);
if (bl == NULL /*|| bl->type != BL_PC*/)
return 1;
if (sd->followtimer != INVALID_TIMER)
- pc_stop_following(sd);
+ iPc->stop_following(sd);
sd->followtarget = target_id;
- pc_follow_timer(INVALID_TIMER, gettick(), sd->bl.id, 0);
+ pc_follow_timer(INVALID_TIMER, iTimer->gettick(), sd->bl.id, 0);
return 0;
}
int pc_checkbaselevelup(struct map_session_data *sd) {
- unsigned int next = pc_nextbaseexp(sd);
+ unsigned int next = iPc->nextbaseexp(sd);
if (!next || sd->status.base_exp < next)
return 0;
@@ -5631,11 +5679,11 @@ int pc_checkbaselevelup(struct map_session_data *sd) {
if(!battle_config.multi_level_up && sd->status.base_exp > next-1)
sd->status.base_exp = next-1;
- next = pc_gets_status_point(sd->status.base_level);
+ next = iPc->gets_status_point(sd->status.base_level);
sd->status.base_level ++;
sd->status.status_point += next;
- } while ((next=pc_nextbaseexp(sd)) > 0 && sd->status.base_exp >= next);
+ } while ((next=iPc->nextbaseexp(sd)) > 0 && sd->status.base_exp >= next);
if (battle_config.pet_lv_rate && sd->pd) //<Skotlex> update pet's level
status_calc_pet(sd->pd,0);
@@ -5663,9 +5711,9 @@ int pc_checkbaselevelup(struct map_session_data *sd) {
npc_script_event(sd, NPCE_BASELVUP); //LORDALFA - LVLUPEVENT
if(sd->status.party_id)
- party_send_levelup(sd);
+ iParty->send_levelup(sd);
- pc_baselevelchanged(sd);
+ iPc->baselevelchanged(sd);
return 1;
}
@@ -5675,7 +5723,7 @@ void pc_baselevelchanged(struct map_session_data *sd) {
for( i = 0; i < EQI_MAX; i++ ) {
if( sd->equip_index[i] >= 0 ) {
if( sd->inventory_data[ sd->equip_index[i] ]->elvmax && sd->status.base_level > (unsigned int)sd->inventory_data[ sd->equip_index[i] ]->elvmax )
- pc_unequipitem(sd, sd->equip_index[i], 3);
+ iPc->unequipitem(sd, sd->equip_index[i], 3);
}
}
#endif
@@ -5683,7 +5731,7 @@ void pc_baselevelchanged(struct map_session_data *sd) {
}
int pc_checkjoblevelup(struct map_session_data *sd)
{
- unsigned int next = pc_nextjobexp(sd);
+ unsigned int next = iPc->nextjobexp(sd);
nullpo_ret(sd);
if(!next || sd->status.job_exp < next)
@@ -5698,7 +5746,7 @@ int pc_checkjoblevelup(struct map_session_data *sd)
sd->status.job_level ++;
sd->status.skill_point ++;
- } while ((next=pc_nextjobexp(sd)) > 0 && sd->status.job_exp >= next);
+ } while ((next=iPc->nextjobexp(sd)) > 0 && sd->status.job_exp >= next);
clif->updatestatus(sd,SP_JOBLEVEL);
clif->updatestatus(sd,SP_JOBEXP);
@@ -5706,7 +5754,7 @@ int pc_checkjoblevelup(struct map_session_data *sd)
clif->updatestatus(sd,SP_SKILLPOINT);
status_calc_pc(sd,0);
clif->misceffect(&sd->bl,1);
- if (pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd))
+ if (iPc->checkskill(sd, SG_DEVIL) && !iPc->nextjobexp(sd))
clif->status_change(&sd->bl,SI_DEVIL, 1, 0, 0, 0, 1); //Permanent blind effect from SG_DEVIL.
npc_script_event(sd, NPCE_JOBLVUP);
@@ -5761,8 +5809,8 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
if(src) pc_calcexp(sd, &base_exp, &job_exp, src);
- nextb = pc_nextbaseexp(sd);
- nextj = pc_nextjobexp(sd);
+ nextb = iPc->nextbaseexp(sd);
+ nextj = iPc->nextjobexp(sd);
if(sd->state.showexp || battle_config.max_exp_gain_rate){
if (nextb > 0)
@@ -5788,22 +5836,22 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
//Cap exp to the level up requirement of the previous level when you are at max level, otherwise cap at UINT_MAX (this is required for some S. Novice bonuses). [Skotlex]
if (base_exp) {
- nextb = nextb?UINT_MAX:pc_thisbaseexp(sd);
+ nextb = nextb?UINT_MAX:iPc->thisbaseexp(sd);
if(sd->status.base_exp > nextb - base_exp)
sd->status.base_exp = nextb;
else
sd->status.base_exp += base_exp;
- pc_checkbaselevelup(sd);
+ iPc->checkbaselevelup(sd);
clif->updatestatus(sd,SP_BASEEXP);
}
if (job_exp) {
- nextj = nextj?UINT_MAX:pc_thisjobexp(sd);
+ nextj = nextj?UINT_MAX:iPc->thisjobexp(sd);
if(sd->status.job_exp > nextj - job_exp)
sd->status.job_exp = nextj;
else
sd->status.job_exp += job_exp;
- pc_checkjoblevelup(sd);
+ iPc->checkjoblevelup(sd);
clif->updatestatus(sd,SP_JOBEXP);
}
@@ -5826,12 +5874,12 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int
*------------------------------------------*/
unsigned int pc_maxbaselv(struct map_session_data *sd)
{
- return max_level[pc_class2idx(sd->status.class_)][0];
+ return max_level[iPc->class2idx(sd->status.class_)][0];
}
unsigned int pc_maxjoblv(struct map_session_data *sd)
{
- return max_level[pc_class2idx(sd->status.class_)][1];
+ return max_level[iPc->class2idx(sd->status.class_)][1];
}
/*==========================================
@@ -5843,19 +5891,19 @@ unsigned int pc_nextbaseexp(struct map_session_data *sd)
{
nullpo_ret(sd);
- if(sd->status.base_level>=pc_maxbaselv(sd) || sd->status.base_level<=0)
+ if(sd->status.base_level>=iPc->maxbaselv(sd) || sd->status.base_level<=0)
return 0;
- return exp_table[pc_class2idx(sd->status.class_)][0][sd->status.base_level-1];
+ return exp_table[iPc->class2idx(sd->status.class_)][0][sd->status.base_level-1];
}
//Base exp needed for this level.
unsigned int pc_thisbaseexp(struct map_session_data *sd)
{
- if(sd->status.base_level>pc_maxbaselv(sd) || sd->status.base_level<=1)
+ if(sd->status.base_level>iPc->maxbaselv(sd) || sd->status.base_level<=1)
return 0;
- return exp_table[pc_class2idx(sd->status.class_)][0][sd->status.base_level-2];
+ return exp_table[iPc->class2idx(sd->status.class_)][0][sd->status.base_level-2];
}
@@ -5871,17 +5919,17 @@ unsigned int pc_nextjobexp(struct map_session_data *sd)
{
nullpo_ret(sd);
- if(sd->status.job_level>=pc_maxjoblv(sd) || sd->status.job_level<=0)
+ if(sd->status.job_level>=iPc->maxjoblv(sd) || sd->status.job_level<=0)
return 0;
- return exp_table[pc_class2idx(sd->status.class_)][1][sd->status.job_level-1];
+ return exp_table[iPc->class2idx(sd->status.class_)][1][sd->status.job_level-1];
}
//Job exp needed for this level.
unsigned int pc_thisjobexp(struct map_session_data *sd)
{
- if(sd->status.job_level>pc_maxjoblv(sd) || sd->status.job_level<=1)
+ if(sd->status.job_level>iPc->maxjoblv(sd) || sd->status.job_level<=1)
return 0;
- return exp_table[pc_class2idx(sd->status.class_)][1][sd->status.job_level-2];
+ return exp_table[iPc->class2idx(sd->status.class_)][1][sd->status.job_level-2];
}
/// Returns the value of the specified stat.
@@ -5972,7 +6020,7 @@ int pc_statusup(struct map_session_data* sd, int type)
nullpo_ret(sd);
// check conditions
- need = pc_need_status_point(sd,type,1);
+ need = iPc->need_status_point(sd,type,1);
if( type < SP_STR || type > SP_LUK || need < 0 || need > sd->status.status_point )
{
clif->statusupack(sd,type,0,0);
@@ -5994,7 +6042,7 @@ int pc_statusup(struct map_session_data* sd, int type)
status_calc_pc(sd,0);
// update increase cost indicator
- if( need != pc_need_status_point(sd,type,1) )
+ if( need != iPc->need_status_point(sd,type,1) )
clif->updatestatus(sd, SP_USTR + type-SP_STR);
// update statpoint count
@@ -6025,7 +6073,7 @@ int pc_statusup2(struct map_session_data* sd, int type, int val)
return 1;
}
- need = pc_need_status_point(sd,type,1);
+ need = iPc->need_status_point(sd,type,1);
// set new value
max = pc_maxparameter(sd);
@@ -6034,7 +6082,7 @@ int pc_statusup2(struct map_session_data* sd, int type, int val)
status_calc_pc(sd,0);
// update increase cost indicator
- if( need != pc_need_status_point(sd,type,1) )
+ if( need != iPc->need_status_point(sd,type,1) )
clif->updatestatus(sd, SP_USTR + type-SP_STR);
// update stat value
@@ -6075,8 +6123,8 @@ int pc_skillup(struct map_session_data *sd,uint16 skill_id) {
sd->status.skill_point--;
if( !skill_db[index].inf )
status_calc_pc(sd,0); // Only recalculate for passive skills.
- else if( sd->status.skill_point == 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc_famerank(sd->status.char_id, MAPID_TAEKWON) )
- pc_calc_skilltree(sd); // Required to grant all TK Ranger skills.
+ else if( sd->status.skill_point == 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON) )
+ iPc->calc_skilltree(sd); // Required to grant all TK Ranger skills.
else
pc_check_skilltree(sd, skill_id); // Check if a new skill can Lvlup
@@ -6125,8 +6173,8 @@ int pc_allskillup(struct map_session_data *sd)
}
} else {
int inf2;
- for(i=0;i < MAX_SKILL_TREE && (id=skill_tree[pc_class2idx(sd->status.class_)][i].id)>0;i++){
- int idx = skill_tree[pc_class2idx(sd->status.class_)][i].idx;
+ for(i=0;i < MAX_SKILL_TREE && (id=skill_tree[iPc->class2idx(sd->status.class_)][i].id)>0;i++){
+ int idx = skill_tree[iPc->class2idx(sd->status.class_)][i].idx;
inf2 = skill_db[idx].inf2;
if (
(inf2&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) ||
@@ -6156,7 +6204,7 @@ int pc_resetlvl(struct map_session_data* sd,int type)
nullpo_ret(sd);
if (type != 3) //Also reset skills
- pc_resetskill(sd, 0);
+ iPc->resetskill(sd, 0);
if(type == 1){
sd->status.skill_point=0;
@@ -6176,8 +6224,8 @@ int pc_resetlvl(struct map_session_data* sd,int type)
if(sd->status.class_ == JOB_NOVICE_HIGH) {
sd->status.status_point=100; // not 88 [celest]
// give platinum skills upon changing
- pc_skill(sd,142,1,0);
- pc_skill(sd,143,1,0);
+ iPc->skill(sd,142,1,0);
+ iPc->skill(sd,143,1,0);
}
}
@@ -6222,12 +6270,12 @@ int pc_resetlvl(struct map_session_data* sd,int type)
for(i=0;i<EQI_MAX;i++) { // unequip items that can't be equipped by base 1 [Valaris]
if(sd->equip_index[i] >= 0)
- if(!pc_isequip(sd,sd->equip_index[i]))
- pc_unequipitem(sd,sd->equip_index[i],2);
+ if(!iPc->isequip(sd,sd->equip_index[i]))
+ iPc->unequipitem(sd,sd->equip_index[i],2);
}
if ((type == 1 || type == 2 || type == 3) && sd->status.party_id)
- party_send_levelup(sd);
+ iParty->send_levelup(sd);
status_calc_pc(sd,0);
clif->skillinfoblock(sd);
@@ -6255,12 +6303,12 @@ int pc_resetstate(struct map_session_data* sd)
else
{
int add=0;
- add += pc_need_status_point(sd, SP_STR, 1-pc_getstat(sd, SP_STR));
- add += pc_need_status_point(sd, SP_AGI, 1-pc_getstat(sd, SP_AGI));
- add += pc_need_status_point(sd, SP_VIT, 1-pc_getstat(sd, SP_VIT));
- add += pc_need_status_point(sd, SP_INT, 1-pc_getstat(sd, SP_INT));
- add += pc_need_status_point(sd, SP_DEX, 1-pc_getstat(sd, SP_DEX));
- add += pc_need_status_point(sd, SP_LUK, 1-pc_getstat(sd, SP_LUK));
+ add += iPc->need_status_point(sd, SP_STR, 1-pc_getstat(sd, SP_STR));
+ add += iPc->need_status_point(sd, SP_AGI, 1-pc_getstat(sd, SP_AGI));
+ add += iPc->need_status_point(sd, SP_VIT, 1-pc_getstat(sd, SP_VIT));
+ add += iPc->need_status_point(sd, SP_INT, 1-pc_getstat(sd, SP_INT));
+ add += iPc->need_status_point(sd, SP_DEX, 1-pc_getstat(sd, SP_DEX));
+ add += iPc->need_status_point(sd, SP_LUK, 1-pc_getstat(sd, SP_LUK));
sd->status.status_point+=add;
}
@@ -6318,35 +6366,35 @@ int pc_resetskill(struct map_session_data* sd, int flag)
/**
* It has been confirmed on official server that when you reset skills with a ranked tweakwon your skills are not reset (because you have all of them anyway)
**/
- if( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc_famerank(sd->status.char_id, MAPID_TAEKWON) )
+ if( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON) )
return 0;
- if( pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd) ) //Remove perma blindness due to skill-reset. [Skotlex]
+ if( iPc->checkskill(sd, SG_DEVIL) && !iPc->nextjobexp(sd) ) //Remove perma blindness due to skill-reset. [Skotlex]
clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL);
i = sd->sc.option;
- if( i&OPTION_RIDING && (!pc_checkskill(sd, KN_RIDING) || (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT) )
+ if( i&OPTION_RIDING && (!iPc->checkskill(sd, KN_RIDING) || (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT) )
i &= ~OPTION_RIDING;
- if( i&OPTION_FALCON && pc_checkskill(sd, HT_FALCON) )
+ if( i&OPTION_FALCON && iPc->checkskill(sd, HT_FALCON) )
i &= ~OPTION_FALCON;
- if( i&OPTION_DRAGON && pc_checkskill(sd, RK_DRAGONTRAINING) )
+ if( i&OPTION_DRAGON && iPc->checkskill(sd, RK_DRAGONTRAINING) )
i &= ~OPTION_DRAGON;
- if( i&OPTION_WUG && pc_checkskill(sd, RA_WUGMASTERY) )
+ if( i&OPTION_WUG && iPc->checkskill(sd, RA_WUGMASTERY) )
i &= ~OPTION_WUG;
- if( i&OPTION_WUGRIDER && pc_checkskill(sd, RA_WUGRIDER) )
+ if( i&OPTION_WUGRIDER && iPc->checkskill(sd, RA_WUGRIDER) )
i &= ~OPTION_WUGRIDER;
if( i&OPTION_MADOGEAR && ( sd->class_&MAPID_THIRDMASK ) == MAPID_MECHANIC )
i &= ~OPTION_MADOGEAR;
#ifndef NEW_CARTS
- if( i&OPTION_CART && pc_checkskill(sd, MC_PUSHCART) )
+ if( i&OPTION_CART && iPc->checkskill(sd, MC_PUSHCART) )
i &= ~OPTION_CART;
#else
if( sd->sc.data[SC_PUSH_CART] )
- pc_setcart(sd, 0);
+ iPc->setcart(sd, 0);
#endif
if( i != sd->sc.option )
- pc_setoption(sd, i);
+ iPc->setoption(sd, i);
- if( homun_alive(sd->hd) && pc_checkskill(sd, AM_CALLHOMUN) )
+ if( homun_alive(sd->hd) && iPc->checkskill(sd, AM_CALLHOMUN) )
homun->vaporize(sd, 0);
}
@@ -6496,19 +6544,19 @@ void pc_respawn(struct map_session_data* sd, clr_type clrtype)
if( sd->bg_id && bg_member_respawn(sd) )
return; // member revived by battleground
- pc_setstand(sd);
- pc_setrestartvalue(sd,3);
- if( pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, clrtype) )
+ iPc->setstand(sd);
+ iPc->setrestartvalue(sd,3);
+ if( iPc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, clrtype) )
clif->resurrection(&sd->bl, 1); //If warping fails, send a normal stand up packet.
}
static int pc_respawn_timer(int tid, unsigned int tick, int id, intptr_t data)
{
- struct map_session_data *sd = map_id2sd(id);
+ struct map_session_data *sd = iMap->id2sd(id);
if( sd != NULL )
{
sd->pvp_point=0;
- pc_respawn(sd,CLR_OUTSIGHT);
+ iPc->respawn(sd,CLR_OUTSIGHT);
}
return 0;
@@ -6527,7 +6575,7 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h
return;
if( pc_issit(sd) ) {
- pc_setstand(sd);
+ iPc->setstand(sd);
skill->sit(sd,0);
}
@@ -6540,20 +6588,19 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h
if( sd->status.ele_id > 0 )
elemental_set_target(sd,src);
- sd->canlog_tick = gettick();
+ sd->canlog_tick = iTimer->gettick();
}
/*==========================================
* Invoked when a player has negative current hp
*------------------------------------------*/
-int pc_dead(struct map_session_data *sd,struct block_list *src)
-{
+int pc_dead(struct map_session_data *sd,struct block_list *src) {
int i=0,j=0,k=0;
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
for(k = 0; k < 5; k++)
if (sd->devotion[k]){
- struct map_session_data *devsd = map_id2sd(sd->devotion[k]);
+ struct map_session_data *devsd = iMap->id2sd(sd->devotion[k]);
if (devsd)
status_change_end(&devsd->bl, SC_DEVOTION, INVALID_TIMER);
sd->devotion[k] = 0;
@@ -6590,18 +6637,28 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
duel_reject(sd->duel_invite, sd);
}
+ if (sd->npc_id && sd->st && sd->st->state != RUN)
+ npc_event_dequeue(sd);
+
pc_setglobalreg(sd,"PC_DIE_COUNTER",sd->die_counter+1);
- pc_setparam(sd, SP_KILLERRID, src?src->id:0);
+ iPc->setparam(sd, SP_KILLERRID, src?src->id:0);
- if( sd->bg_id ) {
+ if( sd->bg_id ) {/* TODO: purge when bgqueue is deemed ok */
struct battleground_data *bg;
if( (bg = bg_team_search(sd->bg_id)) != NULL && bg->die_event[0] )
npc_event(sd, bg->die_event, 0);
}
-
+
+ for( i = 0; i < sd->queues_count; i++ ) {
+ struct hQueue *queue;
+ if( (queue = script->queue(sd->queues[i])) && queue->onDeath[0] != '\0' )
+ npc_event(sd, queue->onDeath, 0);
+ }
+
+ npc_script_event(sd,NPCE_DIE);
+
// Clear anything NPC-related when you die and was interacting with one.
- if (sd->npc_id)
- {
+ if (sd->npc_id) {
if (sd->state.using_fake_npc) {
clif->clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
sd->state.using_fake_npc = 0;
@@ -6616,9 +6673,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
sd->st->state = END;
}
- npc_script_event(sd,NPCE_DIE);
-
- /* e.g. not killed thru pc_damage */
+ /* e.g. not killed thru iPc->damage */
if( pc_issit(sd) ) {
clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_SIT);
}
@@ -6633,50 +6688,50 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
sd->hp_loss.tick = sd->sp_loss.tick = sd->hp_regen.tick = sd->sp_regen.tick = 0;
if ( sd && sd->spiritball )
- pc_delspiritball(sd,sd->spiritball,0);
+ iPc->delspiritball(sd,sd->spiritball,0);
for(i = 1; i < 5; i++)
- pc_del_talisman(sd, sd->talisman[i], i);
+ iPc->del_talisman(sd, sd->talisman[i], i);
- if (src)
- switch (src->type) {
- case BL_MOB:
- {
- struct mob_data *md=(struct mob_data *)src;
- if(md->target_id==sd->bl.id)
- mob_unlocktarget(md,tick);
- if(battle_config.mobs_level_up && md->status.hp &&
- (unsigned int)md->level < pc_maxbaselv(sd) &&
- !md->guardian_data && !md->special_state.ai// Guardians/summons should not level. [Skotlex]
- ) { // monster level up [Valaris]
- clif->misceffect(&md->bl,0);
- md->level++;
- status_calc_mob(md, 0);
- status_percent_heal(src,10,0);
-
- if( battle_config.show_mob_info&4 )
- {// update name with new level
- clif->charnameack(0, &md->bl);
+ if (src) {
+ switch (src->type) {
+ case BL_MOB:
+ {
+ struct mob_data *md=(struct mob_data *)src;
+ if(md->target_id==sd->bl.id)
+ mob_unlocktarget(md,tick);
+ if(battle_config.mobs_level_up && md->status.hp &&
+ (unsigned int)md->level < iPc->maxbaselv(sd) &&
+ !md->guardian_data && !md->special_state.ai// Guardians/summons should not level. [Skotlex]
+ ) { // monster level up [Valaris]
+ clif->misceffect(&md->bl,0);
+ md->level++;
+ status_calc_mob(md, 0);
+ status_percent_heal(src,10,0);
+
+ if( battle_config.show_mob_info&4 )
+ {// update name with new level
+ clif->charnameack(0, &md->bl);
+ }
+ }
+ src = battle->get_master(src); // Maybe Player Summon
}
+ break;
+ case BL_PET: //Pass on to master...
+ src = &((TBL_PET*)src)->msd->bl;
+ break;
+ case BL_HOM:
+ src = &((TBL_HOM*)src)->master->bl;
+ break;
+ case BL_MER:
+ src = &((TBL_MER*)src)->master->bl;
+ break;
}
- src = battle->get_master(src); // Maybe Player Summon
- }
- break;
- case BL_PET: //Pass on to master...
- src = &((TBL_PET*)src)->msd->bl;
- break;
- case BL_HOM:
- src = &((TBL_HOM*)src)->master->bl;
- break;
- case BL_MER:
- src = &((TBL_MER*)src)->master->bl;
- break;
}
- if (src && src->type == BL_PC)
- {
+ if (src && src->type == BL_PC) {
struct map_session_data *ssd = (struct map_session_data *)src;
- pc_setparam(ssd, SP_KILLEDRID, sd->bl.id);
+ iPc->setparam(ssd, SP_KILLEDRID, sd->bl.id);
npc_script_event(ssd, NPCE_KILLPC);
if (battle_config.pk_mode&2) {
@@ -6720,24 +6775,24 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
item_tmp.card[1]=0;
item_tmp.card[2]=GetWord(sd->status.char_id,0); // CharId
item_tmp.card[3]=GetWord(sd->status.char_id,1);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
// activate Steel body if a super novice dies at 99+% exp [celest]
if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && !sd->state.snovice_dead_flag)
{
- unsigned int next = pc_nextbaseexp(sd);
- if( next == 0 ) next = pc_thisbaseexp(sd);
+ unsigned int next = iPc->nextbaseexp(sd);
+ if( next == 0 ) next = iPc->thisbaseexp(sd);
if( get_percentage(sd->status.base_exp,next) >= 99 ) {
sd->state.snovice_dead_flag = 1;
- pc_setstand(sd);
+ iPc->setstand(sd);
status_percent_heal(&sd->bl, 100, 100);
clif->resurrection(&sd->bl, 1);
if(battle_config.pc_invincible_time)
- pc_setinvincibletimer(sd, battle_config.pc_invincible_time);
+ iPc->setinvincibletimer(sd, battle_config.pc_invincible_time);
sc_start(&sd->bl,status_skill2sc(MO_STEELBODY),100,1,skill->get_time(MO_STEELBODY,1));
if(map_flag_gvg(sd->bl.m))
- pc_respawn_timer(INVALID_TIMER, gettick(), sd->bl.id, 0);
+ pc_respawn_timer(INVALID_TIMER, iTimer->gettick(), sd->bl.id, 0);
return 0;
}
}
@@ -6752,7 +6807,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
if (battle_config.death_penalty_base > 0) {
switch (battle_config.death_penalty_type) {
case 1:
- base_penalty = (unsigned int) ((double)pc_nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000);
+ base_penalty = (unsigned int) ((double)iPc->nextbaseexp(sd) * (double)battle_config.death_penalty_base/10000);
break;
case 2:
base_penalty = (unsigned int) ((double)sd->status.base_exp * (double)battle_config.death_penalty_base/10000);
@@ -6770,7 +6825,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
base_penalty = 0;
switch (battle_config.death_penalty_type) {
case 1:
- base_penalty = (unsigned int) ((double)pc_nextjobexp(sd) * (double)battle_config.death_penalty_job/10000);
+ base_penalty = (unsigned int) ((double)iPc->nextjobexp(sd) * (double)battle_config.death_penalty_job/10000);
break;
case 2:
base_penalty = (unsigned int) ((double)sd->status.job_exp * (double)battle_config.death_penalty_job/10000);
@@ -6787,13 +6842,13 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
{
base_penalty = (unsigned int)((double)sd->status.zeny * (double)battle_config.zeny_penalty / 10000.);
if(base_penalty)
- pc_payzeny(sd, base_penalty, LOG_TYPE_PICKDROP_PLAYER, NULL);
+ iPc->payzeny(sd, base_penalty, LOG_TYPE_PICKDROP_PLAYER, NULL);
}
}
if(map[sd->bl.m].flag.pvp_nightmaredrop)
{ // Moved this outside so it works when PVP isn't enabled and during pk mode [Ancyker]
- for(j=0;j<MAX_DROP_PER_MAP;j++){
+ for(j=0;j<map[sd->bl.m].drop_list_count;j++){
int id = map[sd->bl.m].drop_list[j].drop_id;
int type = map[sd->bl.m].drop_list[j].drop_type;
int per = map[sd->bl.m].drop_list[j].drop_per;
@@ -6819,8 +6874,8 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
int n = eq_n[rnd()%eq_num];
if(rnd()%10000 < per){
if(sd->status.inventory[n].equip)
- pc_unequipitem(sd,n,3);
- pc_dropitem(sd,n,1);
+ iPc->unequipitem(sd,n,3);
+ iPc->dropitem(sd,n,1);
}
}
}
@@ -6832,8 +6887,8 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
|| (type == 2 && sd->status.inventory[i].equip)
|| type == 3) ){
if(sd->status.inventory[i].equip)
- pc_unequipitem(sd,i,3);
- pc_dropitem(sd,i,1);
+ iPc->unequipitem(sd,i,3);
+ iPc->dropitem(sd,i,1);
break;
}
}
@@ -6854,14 +6909,14 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
}
if( sd->pvp_point < 0 )
{
- add_timer(tick+1000, pc_respawn_timer,sd->bl.id,0);
+ iTimer->add_timer(tick+1000, pc_respawn_timer,sd->bl.id,0);
return 1|8;
}
}
//GvG
if( map_flag_gvg(sd->bl.m) )
{
- add_timer(tick+1000, pc_respawn_timer, sd->bl.id, 0);
+ iTimer->add_timer(tick+1000, pc_respawn_timer, sd->bl.id, 0);
return 1|8;
}
else if( sd->bg_id )
@@ -6869,7 +6924,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
struct battleground_data *bg = bg_team_search(sd->bg_id);
if( bg && bg->mapindex > 0 )
{ // Respawn by BG
- add_timer(tick+1000, pc_respawn_timer, sd->bl.id, 0);
+ iTimer->add_timer(tick+1000, pc_respawn_timer, sd->bl.id, 0);
return 1|8;
}
}
@@ -6877,7 +6932,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src)
//Reset "can log out" tick.
if( battle_config.prevent_logout )
- sd->canlog_tick = gettick() - battle_config.prevent_logout;
+ sd->canlog_tick = iTimer->gettick() - battle_config.prevent_logout;
return 1;
}
@@ -6885,9 +6940,9 @@ void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp) {
if(hp) clif->updatestatus(sd,SP_HP);
if(sp) clif->updatestatus(sd,SP_SP);
- pc_setstand(sd);
+ iPc->setstand(sd);
if(battle_config.pc_invincible_time > 0)
- pc_setinvincibletimer(sd, battle_config.pc_invincible_time);
+ iPc->setinvincibletimer(sd, battle_config.pc_invincible_time);
if( sd->state.gmaster_flag ) {
guild->aura_refresh(sd,GD_LEADERSHIP,guild->checkskill(sd->state.gmaster_flag,GD_LEADERSHIP));
@@ -6914,16 +6969,16 @@ int pc_readparam(struct map_session_data* sd,int type)
case SP_BASELEVEL: val = sd->status.base_level; break;
case SP_JOBLEVEL: val = sd->status.job_level; break;
case SP_CLASS: val = sd->status.class_; break;
- case SP_BASEJOB: val = pc_mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex); break; //Base job, extracting upper type.
+ case SP_BASEJOB: val = iPc->mapid2jobid(sd->class_&MAPID_UPPERMASK, sd->status.sex); break; //Base job, extracting upper type.
case SP_UPPER: val = sd->class_&JOBL_UPPER?1:(sd->class_&JOBL_BABY?2:0); break;
- case SP_BASECLASS: val = pc_mapid2jobid(sd->class_&MAPID_BASEMASK, sd->status.sex); break; //Extract base class tree. [Skotlex]
+ case SP_BASECLASS: val = iPc->mapid2jobid(sd->class_&MAPID_BASEMASK, sd->status.sex); break; //Extract base class tree. [Skotlex]
case SP_SEX: val = sd->status.sex; break;
case SP_WEIGHT: val = sd->weight; break;
case SP_MAXWEIGHT: val = sd->max_weight; break;
case SP_BASEEXP: val = sd->status.base_exp; break;
case SP_JOBEXP: val = sd->status.job_exp; break;
- case SP_NEXTBASEEXP: val = pc_nextbaseexp(sd); break;
- case SP_NEXTJOBEXP: val = pc_nextjobexp(sd); break;
+ case SP_NEXTBASEEXP: val = iPc->nextbaseexp(sd); break;
+ case SP_NEXTJOBEXP: val = iPc->nextjobexp(sd); break;
case SP_HP: val = sd->battle_status.hp; break;
case SP_MAXHP: val = sd->battle_status.max_hp; break;
case SP_SP: val = sd->battle_status.sp; break;
@@ -7059,12 +7114,12 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
switch(type){
case SP_BASELEVEL:
- if ((unsigned int)val > pc_maxbaselv(sd)) //Capping to max
- val = pc_maxbaselv(sd);
+ if ((unsigned int)val > iPc->maxbaselv(sd)) //Capping to max
+ val = iPc->maxbaselv(sd);
if ((unsigned int)val > sd->status.base_level) {
int stat=0;
for (i = 0; i < (int)((unsigned int)val - sd->status.base_level); i++)
- stat += pc_gets_status_point(sd->status.base_level + i);
+ stat += iPc->gets_status_point(sd->status.base_level + i);
sd->status.status_point += stat;
}
sd->status.base_level = (unsigned int)val;
@@ -7076,12 +7131,12 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
status_calc_pc(sd, 0);
if(sd->status.party_id)
{
- party_send_levelup(sd);
+ iParty->send_levelup(sd);
}
break;
case SP_JOBLEVEL:
if ((unsigned int)val >= sd->status.job_level) {
- if ((unsigned int)val > pc_maxjoblv(sd)) val = pc_maxjoblv(sd);
+ if ((unsigned int)val > iPc->maxjoblv(sd)) val = iPc->maxjoblv(sd);
sd->status.skill_point += val - sd->status.job_level;
clif->updatestatus(sd, SP_SKILLPOINT);
}
@@ -7105,15 +7160,15 @@ int pc_setparam(struct map_session_data *sd,int type,int val)
sd->status.zeny = cap_value(val, 0, MAX_ZENY);
break;
case SP_BASEEXP:
- if(pc_nextbaseexp(sd) > 0) {
+ if(iPc->nextbaseexp(sd) > 0) {
sd->status.base_exp = val;
- pc_checkbaselevelup(sd);
+ iPc->checkbaselevelup(sd);
}
break;
case SP_JOBEXP:
- if(pc_nextjobexp(sd) > 0) {
+ if(iPc->nextjobexp(sd) > 0) {
sd->status.job_exp = val;
- pc_checkjoblevelup(sd);
+ iPc->checkjoblevelup(sd);
}
break;
case SP_SEX:
@@ -7228,8 +7283,8 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
if(hp) {
int i;
bonus = 100 + (sd->battle_status.vit<<1)
- + pc_checkskill(sd,SM_RECOVERY)*10
- + pc_checkskill(sd,AM_LEARNINGPOTION)*5;
+ + iPc->checkskill(sd,SM_RECOVERY)*10
+ + iPc->checkskill(sd,AM_LEARNINGPOTION)*5;
// A potion produced by an Alchemist in the Fame Top 10 gets +50% effect [DracoRPG]
if (potion_flag > 1)
bonus += bonus*(potion_flag-1)*50/100;
@@ -7254,8 +7309,8 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
}
if(sp) {
bonus = 100 + (sd->battle_status.int_<<1)
- + pc_checkskill(sd,MG_SRECOVERY)*10
- + pc_checkskill(sd,AM_LEARNINGPOTION)*5;
+ + iPc->checkskill(sd,MG_SRECOVERY)*10
+ + iPc->checkskill(sd,AM_LEARNINGPOTION)*5;
if (potion_flag > 1)
bonus += bonus*(potion_flag-1)*50/100;
if(bonus != 100)
@@ -7352,7 +7407,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
return 1;
//Normalize job.
- b_class = pc_jobid2mapid(job);
+ b_class = iPc->jobid2mapid(job);
if (b_class == -1)
return 1;
switch (upper) {
@@ -7365,7 +7420,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
}
//This will automatically adjust bard/dancer classes to the correct gender
//That is, if you try to jobchange into dancer, it will turn you to bard.
- job = pc_mapid2jobid(b_class, sd->status.sex);
+ job = iPc->mapid2jobid(b_class, sd->status.sex);
if (job == -1)
return 1;
@@ -7410,7 +7465,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
}
if ( (b_class&MAPID_UPPERMASK) != (sd->class_&MAPID_UPPERMASK) ) { //Things to remove when changing class tree.
- const int class_ = pc_class2idx(sd->status.class_);
+ const int class_ = iPc->class2idx(sd->status.class_);
short id;
for(i = 0; i < MAX_SKILL_TREE && (id = skill_tree[class_][i].id) > 0; i++) {
//Remove status specific to your current tree skills.
@@ -7422,19 +7477,19 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
if( (sd->class_&MAPID_UPPERMASK) == MAPID_STAR_GLADIATOR && (b_class&MAPID_UPPERMASK) != MAPID_STAR_GLADIATOR) {
/* going off star glad lineage, reset feel to not store no-longer-used vars in the database */
- pc_resetfeel(sd);
+ iPc->resetfeel(sd);
}
sd->status.class_ = job;
- fame_flag = pc_famerank(sd->status.char_id,sd->class_&MAPID_UPPERMASK);
+ fame_flag = iPc->famerank(sd->status.char_id,sd->class_&MAPID_UPPERMASK);
sd->class_ = (unsigned short)b_class;
sd->status.job_level=1;
sd->status.job_exp=0;
- if (sd->status.base_level > pc_maxbaselv(sd)) {
- sd->status.base_level = pc_maxbaselv(sd);
+ if (sd->status.base_level > iPc->maxbaselv(sd)) {
+ sd->status.base_level = iPc->maxbaselv(sd);
sd->status.base_exp=0;
- pc_resetstate(sd);
+ iPc->resetstate(sd);
clif->updatestatus(sd,SP_STATUSPOINT);
clif->updatestatus(sd,SP_BASELEVEL);
clif->updatestatus(sd,SP_BASEEXP);
@@ -7447,14 +7502,14 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
for(i=0;i<EQI_MAX;i++) {
if(sd->equip_index[i] >= 0)
- if(!pc_isequip(sd,sd->equip_index[i]))
- pc_unequipitem(sd,sd->equip_index[i],2); // unequip invalid item for class
+ if(!iPc->isequip(sd,sd->equip_index[i]))
+ iPc->unequipitem(sd,sd->equip_index[i],2); // unequip invalid item for class
}
//Change look, if disguised, you need to undisguise
//to correctly calculate new job sprite without
if (sd->disguise != -1)
- pc_disguise(sd, -1);
+ iPc->disguise(sd, -1);
status_set_viewdata(&sd->bl, job);
clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_); // move sprite update to prevent client crashes with incompatible equipment [Valaris]
@@ -7462,7 +7517,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color);
//Update skill tree.
- pc_calc_skilltree(sd);
+ iPc->calc_skilltree(sd);
clif->skillinfoblock(sd);
if (sd->ed)
@@ -7470,41 +7525,41 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
if (sd->state.vending)
vending->close(sd);
- map_foreachinmap(jobchange_killclone, sd->bl.m, BL_MOB, sd->bl.id);
+ iMap->foreachinmap(jobchange_killclone, sd->bl.m, BL_MOB, sd->bl.id);
//Remove peco/cart/falcon
i = sd->sc.option;
- if( i&OPTION_RIDING && !pc_checkskill(sd, KN_RIDING) )
+ if( i&OPTION_RIDING && !iPc->checkskill(sd, KN_RIDING) )
i&=~OPTION_RIDING;
- if( i&OPTION_FALCON && !pc_checkskill(sd, HT_FALCON) )
+ if( i&OPTION_FALCON && !iPc->checkskill(sd, HT_FALCON) )
i&=~OPTION_FALCON;
- if( i&OPTION_DRAGON && !pc_checkskill(sd,RK_DRAGONTRAINING) )
+ if( i&OPTION_DRAGON && !iPc->checkskill(sd,RK_DRAGONTRAINING) )
i&=~OPTION_DRAGON;
- if( i&OPTION_WUGRIDER && !pc_checkskill(sd,RA_WUGMASTERY) )
+ if( i&OPTION_WUGRIDER && !iPc->checkskill(sd,RA_WUGMASTERY) )
i&=~OPTION_WUGRIDER;
- if( i&OPTION_WUG && !pc_checkskill(sd,RA_WUGMASTERY) )
+ if( i&OPTION_WUG && !iPc->checkskill(sd,RA_WUGMASTERY) )
i&=~OPTION_WUG;
if( i&OPTION_MADOGEAR ) //You do not need a skill for this.
i&=~OPTION_MADOGEAR;
#ifndef NEW_CARTS
- if( i&OPTION_CART && !pc_checkskill(sd, MC_PUSHCART) )
+ if( i&OPTION_CART && !iPc->checkskill(sd, MC_PUSHCART) )
i&=~OPTION_CART;
#else
- if( sd->sc.data[SC_PUSH_CART] && !pc_checkskill(sd, MC_PUSHCART) )
- pc_setcart(sd, 0);
+ if( sd->sc.data[SC_PUSH_CART] && !iPc->checkskill(sd, MC_PUSHCART) )
+ iPc->setcart(sd, 0);
#endif
if(i != sd->sc.option)
- pc_setoption(sd, i);
+ iPc->setoption(sd, i);
- if(homun_alive(sd->hd) && !pc_checkskill(sd, AM_CALLHOMUN))
+ if(homun_alive(sd->hd) && !iPc->checkskill(sd, AM_CALLHOMUN))
homun->vaporize(sd, 0);
if(sd->status.manner < 0)
clif->changestatus(sd,SP_MANNER,sd->status.manner);
status_calc_pc(sd,0);
- pc_checkallowskill(sd);
- pc_equiplookall(sd);
+ iPc->checkallowskill(sd);
+ iPc->equiplookall(sd);
//if you were previously famous, not anymore.
if (fame_flag) {
@@ -7551,7 +7606,13 @@ int pc_changelook(struct map_session_data *sd,int type,int val)
switch(type){
case LOOK_BASE:
- sd->vd.class_ = val;
+ status_set_viewdata(&sd->bl, val);
+ clif->changelook(&sd->bl,LOOK_BASE,sd->vd.class_);
+ clif->changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
+ if (sd->vd.cloth_color)
+ clif->changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color);
+ clif->skillinfoblock(sd);
+ return 0;
break;
case LOOK_HAIR: //Use the battle_config limits! [Skotlex]
val = cap_value(val, MIN_HAIR_STYLE, MAX_HAIR_STYLE);
@@ -7616,7 +7677,7 @@ int pc_setoption(struct map_session_data *sd,int type)
sd->sc.option=type;
clif->changeoption(&sd->bl);
- if( (type&OPTION_RIDING && !(p_type&OPTION_RIDING)) || (type&OPTION_DRAGON && !(p_type&OPTION_DRAGON) && pc_checkskill(sd,RK_DRAGONTRAINING) > 0) ) {
+ if( (type&OPTION_RIDING && !(p_type&OPTION_RIDING)) || (type&OPTION_DRAGON && !(p_type&OPTION_DRAGON) && iPc->checkskill(sd,RK_DRAGONTRAINING) > 0) ) {
// Mounting
clif->sc_load(&sd->bl,sd->bl.id,AREA,SI_RIDING, 0, 0, 0);
status_calc_pc(sd,0);
@@ -7630,11 +7691,11 @@ int pc_setoption(struct map_session_data *sd,int type)
if( type&OPTION_CART && !( p_type&OPTION_CART ) ) { //Cart On
clif->cartlist(sd);
clif->updatestatus(sd, SP_CARTINFO);
- if(pc_checkskill(sd, MC_PUSHCART) < 10)
+ if(iPc->checkskill(sd, MC_PUSHCART) < 10)
status_calc_pc(sd,0); //Apply speed penalty.
} else if( !( type&OPTION_CART ) && p_type&OPTION_CART ){ //Cart Off
clif->clearcart(sd->fd);
- if(pc_checkskill(sd, MC_PUSHCART) < 10)
+ if(iPc->checkskill(sd, MC_PUSHCART) < 10)
status_calc_pc(sd,0); //Remove speed penalty.
}
#endif
@@ -7708,7 +7769,7 @@ int pc_setcart(struct map_session_data *sd,int type) {
if( type < 0 || type > MAX_CARTS )
return 1;// Never trust the values sent by the client! [Skotlex]
- if( pc_checkskill(sd,MC_PUSHCART) <= 0 && type != 0 )
+ if( iPc->checkskill(sd,MC_PUSHCART) <= 0 && type != 0 )
return 1;// Push cart is required
if( type == 0 && pc_iscarton(sd) )
@@ -7735,14 +7796,14 @@ int pc_setcart(struct map_session_data *sd,int type) {
break;
}
- if(pc_checkskill(sd, MC_PUSHCART) < 10)
+ if(iPc->checkskill(sd, MC_PUSHCART) < 10)
status_calc_pc(sd,0); //Recalc speed penalty.
#else
// Update option
option = sd->sc.option;
option &= ~OPTION_CART;// clear cart bits
option |= cart[type]; // set cart
- pc_setoption(sd, option);
+ iPc->setoption(sd, option);
#endif
return 0;
@@ -7754,10 +7815,10 @@ int pc_setcart(struct map_session_data *sd,int type) {
int pc_setfalcon(TBL_PC* sd, int flag)
{
if( flag ){
- if( pc_checkskill(sd,HT_FALCON)>0 ) // add falcon if he have the skill
- pc_setoption(sd,sd->sc.option|OPTION_FALCON);
+ if( iPc->checkskill(sd,HT_FALCON)>0 ) // add falcon if he have the skill
+ iPc->setoption(sd,sd->sc.option|OPTION_FALCON);
} else if( pc_isfalcon(sd) ){
- pc_setoption(sd,sd->sc.option&~OPTION_FALCON); // remove falcon
+ iPc->setoption(sd,sd->sc.option&~OPTION_FALCON); // remove falcon
}
return 0;
@@ -7769,10 +7830,10 @@ int pc_setfalcon(TBL_PC* sd, int flag)
int pc_setriding(TBL_PC* sd, int flag)
{
if( flag ){
- if( pc_checkskill(sd,KN_RIDING) > 0 ) // add peco
- pc_setoption(sd, sd->sc.option|OPTION_RIDING);
+ if( iPc->checkskill(sd,KN_RIDING) > 0 ) // add peco
+ iPc->setoption(sd, sd->sc.option|OPTION_RIDING);
} else if( pc_isriding(sd) ){
- pc_setoption(sd, sd->sc.option&~OPTION_RIDING);
+ iPc->setoption(sd, sd->sc.option&~OPTION_RIDING);
}
return 0;
@@ -7784,10 +7845,10 @@ int pc_setriding(TBL_PC* sd, int flag)
int pc_setmadogear(TBL_PC* sd, int flag)
{
if( flag ){
- if( pc_checkskill(sd,NC_MADOLICENCE) > 0 )
- pc_setoption(sd, sd->sc.option|OPTION_MADOGEAR);
+ if( iPc->checkskill(sd,NC_MADOLICENCE) > 0 )
+ iPc->setoption(sd, sd->sc.option|OPTION_MADOGEAR);
} else if( pc_ismadogear(sd) ){
- pc_setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
+ iPc->setoption(sd, sd->sc.option&~OPTION_MADOGEAR);
}
return 0;
@@ -7800,9 +7861,9 @@ int pc_candrop(struct map_session_data *sd, struct item *item)
{
if( item && item->expire_time )
return 0;
- if( !pc_can_give_items(sd) ) //check if this GM level can drop items
+ if( !iPc->can_give_items(sd) ) //check if this GM level can drop items
return 0;
- return (itemdb_isdropable(item, pc_get_group_level(sd)));
+ return (itemdb_isdropable(item, iPc->get_group_level(sd)));
}
/*==========================================
@@ -8146,7 +8207,7 @@ int pc_setregistry_str(struct map_session_data *sd,const char *reg,const char *v
*------------------------------------------*/
static int pc_eventtimer(int tid, unsigned int tick, int id, intptr_t data)
{
- struct map_session_data *sd=map_id2sd(id);
+ struct map_session_data *sd=iMap->id2sd(id);
char *p = (char *)data;
int i;
if(sd==NULL)
@@ -8178,7 +8239,7 @@ int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name)
if( i == MAX_EVENTTIMER )
return 0;
- sd->eventtimer[i] = add_timer(gettick()+tick, pc_eventtimer, sd->bl.id, (intptr_t)aStrdup(name));
+ sd->eventtimer[i] = iTimer->add_timer(iTimer->gettick()+tick, pc_eventtimer, sd->bl.id, (intptr_t)aStrdup(name));
sd->eventcount++;
return 1;
@@ -8200,13 +8261,13 @@ int pc_deleventtimer(struct map_session_data *sd,const char *name)
// find the named event timer
ARR_FIND( 0, MAX_EVENTTIMER, i,
sd->eventtimer[i] != INVALID_TIMER &&
- (p = (char *)(get_timer(sd->eventtimer[i])->data)) != NULL &&
+ (p = (char *)(iTimer->get_timer(sd->eventtimer[i])->data)) != NULL &&
strcmp(p, name) == 0
);
if( i == MAX_EVENTTIMER )
return 0; // not found
- delete_timer(sd->eventtimer[i],pc_eventtimer);
+ iTimer->delete_timer(sd->eventtimer[i],pc_eventtimer);
sd->eventtimer[i] = INVALID_TIMER;
sd->eventcount--;
aFree(p);
@@ -8225,8 +8286,8 @@ int pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick)
for(i=0;i<MAX_EVENTTIMER;i++)
if( sd->eventtimer[i] != INVALID_TIMER && strcmp(
- (char *)(get_timer(sd->eventtimer[i])->data), name)==0 ){
- addtick_timer(sd->eventtimer[i],tick);
+ (char *)(iTimer->get_timer(sd->eventtimer[i])->data), name)==0 ){
+ iTimer->addtick_timer(sd->eventtimer[i],tick);
break;
}
@@ -8247,8 +8308,8 @@ int pc_cleareventtimer(struct map_session_data *sd)
for(i=0;i<MAX_EVENTTIMER;i++)
if( sd->eventtimer[i] != INVALID_TIMER ){
- char *p = (char *)(get_timer(sd->eventtimer[i])->data);
- delete_timer(sd->eventtimer[i],pc_eventtimer);
+ char *p = (char *)(iTimer->get_timer(sd->eventtimer[i])->data);
+ iTimer->delete_timer(sd->eventtimer[i],pc_eventtimer);
sd->eventtimer[i] = INVALID_TIMER;
sd->eventcount--;
if (p) aFree(p);
@@ -8425,19 +8486,19 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
return 0;
}
- if( DIFF_TICK(sd->canequip_tick,gettick()) > 0 )
+ if( DIFF_TICK(sd->canequip_tick,iTimer->gettick()) > 0 )
{
clif->equipitemack(sd,n,0,0);
return 0;
}
id = sd->inventory_data[n];
- pos = pc_equippoint(sd,n); //With a few exceptions, item should go in all specified slots.
+ pos = iPc->equippoint(sd,n); //With a few exceptions, item should go in all specified slots.
if(battle_config.battle_log)
ShowInfo("equip %d(%d) %x:%x\n",sd->status.inventory[n].nameid,n,id?id->equip:0,req_pos);
- if(!pc_isequip(sd,n) || !(pos&req_pos) || sd->status.inventory[n].equip != 0 || sd->status.inventory[n].attribute==1 ) { // [Valaris]
- // FIXME: pc_isequip: equip level failure uses 2 instead of 0
+ if(!iPc->isequip(sd,n) || !(pos&req_pos) || sd->status.inventory[n].equip != 0 || sd->status.inventory[n].attribute==1 ) { // [Valaris]
+ // FIXME: iPc->isequip: equip level failure uses 2 instead of 0
clif->equipitemack(sd,n,0,0); // fail
return 0;
}
@@ -8473,7 +8534,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
for(i=0;i<EQI_MAX;i++) {
if(pos & equip_pos[i]) {
if(sd->equip_index[i] >= 0) //Slot taken, remove item from there.
- pc_unequipitem(sd,sd->equip_index[i],2);
+ iPc->unequipitem(sd,sd->equip_index[i],2);
sd->equip_index[i] = n;
}
@@ -8515,21 +8576,21 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
}
//Added check to prevent sending the same look on multiple slots ->
//causes client to redraw item on top of itself. (suggested by Lupus)
- if(pos & EQP_HEAD_LOW && pc_checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1) {
+ if(pos & EQP_HEAD_LOW && iPc->checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1) {
if(id && !(pos&(EQP_HEAD_TOP|EQP_HEAD_MID)))
sd->status.head_bottom = id->look;
else
sd->status.head_bottom = 0;
clif->changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
}
- if(pos & EQP_HEAD_TOP && pc_checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1) {
+ if(pos & EQP_HEAD_TOP && iPc->checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1) {
if(id)
sd->status.head_top = id->look;
else
sd->status.head_top = 0;
clif->changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
}
- if(pos & EQP_HEAD_MID && pc_checkequip(sd,EQP_COSTUME_HEAD_MID) == -1) {
+ if(pos & EQP_HEAD_MID && iPc->checkequip(sd,EQP_COSTUME_HEAD_MID) == -1) {
if(id && !(pos&EQP_HEAD_TOP))
sd->status.head_mid = id->look;
else
@@ -8560,7 +8621,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
if(pos & EQP_SHOES)
clif->changelook(&sd->bl,LOOK_SHOES,0);
- if( pos&EQP_GARMENT && pc_checkequip(sd,EQP_COSTUME_GARMENT) == -1 ) {
+ if( pos&EQP_GARMENT && iPc->checkequip(sd,EQP_COSTUME_GARMENT) == -1 ) {
sd->status.robe = id ? id->look : 0;
clif->changelook(&sd->bl, LOOK_ROBE, sd->status.robe);
}
@@ -8571,7 +8632,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
}
- pc_checkallowskill(sd); //Check if status changes should be halted.
+ iPc->checkallowskill(sd); //Check if status changes should be halted.
iflag = sd->npc_item_flag;
/* check for combos (MUST be before status_calc_pc) */
@@ -8651,7 +8712,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) {
}
if(battle_config.battle_log)
- ShowInfo("unequip %d %x:%x\n",n,pc_equippoint(sd,n),sd->status.inventory[n].equip);
+ ShowInfo("unequip %d %x:%x\n",n,iPc->equippoint(sd,n),sd->status.inventory[n].equip);
if(!sd->status.inventory[n].equip){ //Nothing to unequip
clif->unequipitemack(sd,n,0,0);
@@ -8675,44 +8736,44 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) {
pc_calcweapontype(sd);
clif->changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
}
- if(sd->status.inventory[n].equip & EQP_HEAD_LOW && pc_checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1 ) {
+ if(sd->status.inventory[n].equip & EQP_HEAD_LOW && iPc->checkequip(sd,EQP_COSTUME_HEAD_LOW) == -1 ) {
sd->status.head_bottom = 0;
clif->changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
}
- if(sd->status.inventory[n].equip & EQP_HEAD_TOP && pc_checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1 ) {
+ if(sd->status.inventory[n].equip & EQP_HEAD_TOP && iPc->checkequip(sd,EQP_COSTUME_HEAD_TOP) == -1 ) {
sd->status.head_top = 0;
clif->changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
}
- if(sd->status.inventory[n].equip & EQP_HEAD_MID && pc_checkequip(sd,EQP_COSTUME_HEAD_MID) == -1 ) {
+ if(sd->status.inventory[n].equip & EQP_HEAD_MID && iPc->checkequip(sd,EQP_COSTUME_HEAD_MID) == -1 ) {
sd->status.head_mid = 0;
clif->changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
}
if(sd->status.inventory[n].equip & EQP_COSTUME_HEAD_TOP) {
- sd->status.head_top = ( pc_checkequip(sd,EQP_HEAD_TOP) >= 0 ) ? sd->inventory_data[pc_checkequip(sd,EQP_HEAD_TOP)]->look : 0;
+ sd->status.head_top = ( iPc->checkequip(sd,EQP_HEAD_TOP) >= 0 ) ? sd->inventory_data[iPc->checkequip(sd,EQP_HEAD_TOP)]->look : 0;
clif->changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
}
if(sd->status.inventory[n].equip & EQP_COSTUME_HEAD_MID) {
- sd->status.head_mid = ( pc_checkequip(sd,EQP_HEAD_MID) >= 0 ) ? sd->inventory_data[pc_checkequip(sd,EQP_HEAD_MID)]->look : 0;
+ sd->status.head_mid = ( iPc->checkequip(sd,EQP_HEAD_MID) >= 0 ) ? sd->inventory_data[iPc->checkequip(sd,EQP_HEAD_MID)]->look : 0;
clif->changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
}
if(sd->status.inventory[n].equip & EQP_COSTUME_HEAD_LOW) {
- sd->status.head_bottom = ( pc_checkequip(sd,EQP_HEAD_LOW) >= 0 ) ? sd->inventory_data[pc_checkequip(sd,EQP_HEAD_LOW)]->look : 0;
+ sd->status.head_bottom = ( iPc->checkequip(sd,EQP_HEAD_LOW) >= 0 ) ? sd->inventory_data[iPc->checkequip(sd,EQP_HEAD_LOW)]->look : 0;
clif->changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
}
if(sd->status.inventory[n].equip & EQP_SHOES)
clif->changelook(&sd->bl,LOOK_SHOES,0);
- if( sd->status.inventory[n].equip&EQP_GARMENT && pc_checkequip(sd,EQP_COSTUME_GARMENT) == -1 ) {
+ if( sd->status.inventory[n].equip&EQP_GARMENT && iPc->checkequip(sd,EQP_COSTUME_GARMENT) == -1 ) {
sd->status.robe = 0;
clif->changelook(&sd->bl, LOOK_ROBE, 0);
}
if(sd->status.inventory[n].equip & EQP_COSTUME_GARMENT) {
- sd->status.robe = ( pc_checkequip(sd,EQP_GARMENT) >= 0 ) ? sd->inventory_data[pc_checkequip(sd,EQP_GARMENT)]->look : 0;
+ sd->status.robe = ( iPc->checkequip(sd,EQP_GARMENT) >= 0 ) ? sd->inventory_data[iPc->checkequip(sd,EQP_GARMENT)]->look : 0;
clif->changelook(&sd->bl,LOOK_ROBE,sd->status.robe);
}
@@ -8757,7 +8818,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) {
}
if(flag&1 || status_cacl) {
- pc_checkallowskill(sd);
+ iPc->checkallowskill(sd);
status_calc_pc(sd,0);
}
@@ -8808,7 +8869,7 @@ int pc_checkitem(struct map_session_data *sd)
if( id && !itemdb_available(id) ) {
ShowWarning("Removed invalid/disabled item id %d from inventory (amount=%d, char_id=%d).\n", id, sd->status.inventory[i].amount, sd->status.char_id);
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
+ iPc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_OTHER);
}
}
@@ -8817,7 +8878,7 @@ int pc_checkitem(struct map_session_data *sd)
if( id && !itemdb_available(id) ) {
ShowWarning("Removed invalid/disabled item id %d from cart (amount=%d, char_id=%d).\n", id, sd->status.cart[i].amount, sd->status.char_id);
- pc_cart_delitem(sd, i, sd->status.cart[i].amount, 0, LOG_TYPE_OTHER);
+ iPc->cart_delitem(sd, i, sd->status.cart[i].amount, 0, LOG_TYPE_OTHER);
}
}
}
@@ -8830,8 +8891,8 @@ int pc_checkitem(struct map_session_data *sd)
if( !sd->status.inventory[i].equip )
continue;
- if( sd->status.inventory[i].equip&~pc_equippoint(sd,i) ) {
- pc_unequipitem(sd, i, 2);
+ if( sd->status.inventory[i].equip&~iPc->equippoint(sd,i) ) {
+ iPc->unequipitem(sd, i, 2);
calc_flag = 1;
continue;
}
@@ -8839,7 +8900,7 @@ int pc_checkitem(struct map_session_data *sd)
}
if( calc_flag && sd->state.active ) {
- pc_checkallowskill(sd);
+ iPc->checkallowskill(sd);
status_calc_pc(sd,0);
}
@@ -8866,7 +8927,7 @@ int pc_calc_pvprank_sub(struct block_list *bl,va_list ap)
return 0;
}
/*==========================================
- * Calculate new rank beetween all present players (map_foreachinarea)
+ * Calculate new rank beetween all present players (iMap->foreachinarea)
* and display result
*------------------------------------------*/
int pc_calc_pvprank(struct map_session_data *sd)
@@ -8876,7 +8937,7 @@ int pc_calc_pvprank(struct map_session_data *sd)
m=&map[sd->bl.m];
old=sd->pvp_rank;
sd->pvp_rank=1;
- map_foreachinmap(pc_calc_pvprank_sub,sd->bl.m,BL_PC,sd);
+ iMap->foreachinmap(pc_calc_pvprank_sub,sd->bl.m,BL_PC,sd);
if(old!=sd->pvp_rank || sd->pvp_lastusers!=m->users_pvp)
clif->pvpset(sd,sd->pvp_rank,sd->pvp_lastusers=m->users_pvp,0);
return sd->pvp_rank;
@@ -8888,7 +8949,7 @@ int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr_t data)
{
struct map_session_data *sd;
- sd=map_id2sd(id);
+ sd=iMap->id2sd(id);
if(sd==NULL)
return 0;
sd->pvp_timer = INVALID_TIMER;
@@ -8898,8 +8959,8 @@ int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
- if( pc_calc_pvprank(sd) > 0 )
- sd->pvp_timer = add_timer(gettick()+PVP_CALCRANK_INTERVAL,pc_calc_pvprank_timer,id,data);
+ if( iPc->calc_pvprank(sd) > 0 )
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+PVP_CALCRANK_INTERVAL,iPc->calc_pvprank_timer,id,data);
return 0;
}
@@ -8946,13 +9007,13 @@ int pc_divorce(struct map_session_data *sd)
struct map_session_data *p_sd;
int i;
- if( sd == NULL || !pc_ismarried(sd) )
+ if( sd == NULL || !iPc->ismarried(sd) )
return -1;
if( !sd->status.partner_id )
return -1; // Char is not married
- if( (p_sd = map_charid2sd(sd->status.partner_id)) == NULL )
+ if( (p_sd = iMap->charid2sd(sd->status.partner_id)) == NULL )
{ // Lets char server do the divorce
if( chrif_divorce(sd->status.char_id, sd->status.partner_id) )
return -1; // No char server connected
@@ -8966,9 +9027,9 @@ int pc_divorce(struct map_session_data *sd)
for( i = 0; i < MAX_INVENTORY; i++ )
{
if( sd->status.inventory[i].nameid == WEDDING_RING_M || sd->status.inventory[i].nameid == WEDDING_RING_F )
- pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
+ iPc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
if( p_sd->status.inventory[i].nameid == WEDDING_RING_M || p_sd->status.inventory[i].nameid == WEDDING_RING_F )
- pc_delitem(p_sd, i, 1, 0, 0, LOG_TYPE_OTHER);
+ iPc->delitem(p_sd, i, 1, 0, 0, LOG_TYPE_OTHER);
}
clif->divorced(sd, p_sd->status.name);
@@ -8982,9 +9043,9 @@ int pc_divorce(struct map_session_data *sd)
*------------------------------------------*/
struct map_session_data *pc_get_partner(struct map_session_data *sd)
{
- if (sd && pc_ismarried(sd))
+ if (sd && iPc->ismarried(sd))
// charid2sd returns NULL if not found
- return map_charid2sd(sd->status.partner_id);
+ return iMap->charid2sd(sd->status.partner_id);
return NULL;
}
@@ -8996,7 +9057,7 @@ struct map_session_data *pc_get_father (struct map_session_data *sd)
{
if (sd && sd->class_&JOBL_BABY && sd->status.father > 0)
// charid2sd returns NULL if not found
- return map_charid2sd(sd->status.father);
+ return iMap->charid2sd(sd->status.father);
return NULL;
}
@@ -9008,7 +9069,7 @@ struct map_session_data *pc_get_mother (struct map_session_data *sd)
{
if (sd && sd->class_&JOBL_BABY && sd->status.mother > 0)
// charid2sd returns NULL if not found
- return map_charid2sd(sd->status.mother);
+ return iMap->charid2sd(sd->status.mother);
return NULL;
}
@@ -9018,9 +9079,9 @@ struct map_session_data *pc_get_mother (struct map_session_data *sd)
*------------------------------------------*/
struct map_session_data *pc_get_child (struct map_session_data *sd)
{
- if (sd && pc_ismarried(sd) && sd->status.child > 0)
+ if (sd && iPc->ismarried(sd) && sd->status.child > 0)
// charid2sd returns NULL if not found
- return map_charid2sd(sd->status.child);
+ return iMap->charid2sd(sd->status.child);
return NULL;
}
@@ -9137,19 +9198,19 @@ int pc_autosave(int tid, unsigned int tick, int id, intptr_t data)
}
mapit->free(iter);
- interval = autosave_interval/(map_usercount()+1);
- if(interval < minsave_interval)
- interval = minsave_interval;
- add_timer(gettick()+interval,pc_autosave,0,0);
+ interval = iMap->autosave_interval/(iMap->usercount()+1);
+ if(interval < iMap->minsave_interval)
+ interval = iMap->minsave_interval;
+ iTimer->add_timer(iTimer->gettick()+interval,pc_autosave,0,0);
return 0;
}
static int pc_daynight_timer_sub(struct map_session_data *sd,va_list ap)
{
- if (sd->state.night != night_flag && map[sd->bl.m].flag.nightenabled) { //Night/day state does not match.
- clif->status_change(&sd->bl, SI_NIGHT, night_flag, 0, 0, 0, 0); //New night effect by dynamix [Skotlex]
- sd->state.night = night_flag;
+ if (sd->state.night != iMap->night_flag && map[sd->bl.m].flag.nightenabled) { //Night/day state does not match.
+ clif->status_change(&sd->bl, SI_NIGHT, iMap->night_flag, 0, 0, 0, 0); //New night effect by dynamix [Skotlex]
+ sd->state.night = iMap->night_flag;
return 1;
}
return 0;
@@ -9165,11 +9226,11 @@ int map_day_timer(int tid, unsigned int tick, int id, intptr_t data)
if (data == 0 && battle_config.day_duration <= 0) // if we want a day
return 0;
- if (!night_flag)
+ if (!iMap->night_flag)
return 0; //Already day.
- night_flag = 0; // 0=day, 1=night [Yor]
- map_foreachpc(pc_daynight_timer_sub);
+ iMap->night_flag = 0; // 0=day, 1=night [Yor]
+ iMap->map_foreachpc(pc_daynight_timer_sub);
strcpy(tmp_soutput, (data == 0) ? msg_txt(502) : msg_txt(60)); // The day has arrived!
intif_broadcast(tmp_soutput, strlen(tmp_soutput) + 1, 0);
return 0;
@@ -9186,11 +9247,11 @@ int map_night_timer(int tid, unsigned int tick, int id, intptr_t data)
if (data == 0 && battle_config.night_duration <= 0) // if we want a night
return 0;
- if (night_flag)
+ if (iMap->night_flag)
return 0; //Already nigth.
- night_flag = 1; // 0=day, 1=night [Yor]
- map_foreachpc(pc_daynight_timer_sub);
+ iMap->night_flag = 1; // 0=day, 1=night [Yor]
+ iMap->map_foreachpc(pc_daynight_timer_sub);
strcpy(tmp_soutput, (data == 0) ? msg_txt(503) : msg_txt(59)); // The night has fallen...
intif_broadcast(tmp_soutput, strlen(tmp_soutput) + 1, 0);
return 0;
@@ -9216,7 +9277,7 @@ void pc_overheat(struct map_session_data *sd, int val) {
if( !pc_ismadogear(sd) || sd->sc.data[SC_OVERHEAT] )
return; // already burning
- skill = cap_value(pc_checkskill(sd,NC_MAINFRAME),0,4);
+ skill = cap_value(iPc->checkskill(sd,NC_MAINFRAME),0,4);
if( sd->sc.data[SC_OVERHEAT_LIMITPOINT] ) {
heat += sd->sc.data[SC_OVERHEAT_LIMITPOINT]->val1;
status_change_end(&sd->bl,SC_OVERHEAT_LIMITPOINT,INVALID_TIMER);
@@ -9257,7 +9318,7 @@ static int pc_talisman_timer(int tid, unsigned int tick, int id, intptr_t data)
struct map_session_data *sd;
int i, type;
- if( (sd=(struct map_session_data *)map_id2sd(id)) == NULL || sd->bl.type!=BL_PC )
+ if( (sd=(struct map_session_data *)iMap->id2sd(id)) == NULL || sd->bl.type!=BL_PC )
return 1;
ARR_FIND(1, 5, type, sd->talisman[type] > 0);
@@ -9300,15 +9361,15 @@ int pc_add_talisman(struct map_session_data *sd,int interval,int max,int type)
if( sd->talisman[type] && sd->talisman[type] >= max )
{
if(sd->talisman_timer[type][0] != INVALID_TIMER)
- delete_timer(sd->talisman_timer[type][0],pc_talisman_timer);
+ iTimer->delete_timer(sd->talisman_timer[type][0],pc_talisman_timer);
sd->talisman[type]--;
if( sd->talisman[type] != 0 )
memmove(sd->talisman_timer[type]+0, sd->talisman_timer[type]+1, (sd->talisman[type])*sizeof(int));
sd->talisman_timer[type][sd->talisman[type]] = INVALID_TIMER;
}
- tid = add_timer(gettick()+interval, pc_talisman_timer, sd->bl.id, 0);
- ARR_FIND(0, sd->talisman[type], i, sd->talisman_timer[type][i] == INVALID_TIMER || DIFF_TICK(get_timer(tid)->tick, get_timer(sd->talisman_timer[type][i])->tick) < 0);
+ tid = iTimer->add_timer(iTimer->gettick()+interval, pc_talisman_timer, sd->bl.id, 0);
+ ARR_FIND(0, sd->talisman[type], i, sd->talisman_timer[type][i] == INVALID_TIMER || DIFF_TICK(iTimer->get_timer(tid)->tick,iTimer->get_timer(sd->talisman_timer[type][i])->tick) < 0);
if( i != sd->talisman[type] )
memmove(sd->talisman_timer[type]+i+1, sd->talisman_timer[type]+i, (sd->talisman[type]-i)*sizeof(int));
sd->talisman_timer[type][i] = tid;
@@ -9339,7 +9400,7 @@ int pc_del_talisman(struct map_session_data *sd,int count,int type)
for(i = 0; i < count; i++) {
if(sd->talisman_timer[type][i] != INVALID_TIMER) {
- delete_timer(sd->talisman_timer[type][i],pc_talisman_timer);
+ iTimer->delete_timer(sd->talisman_timer[type][i],pc_talisman_timer);
sd->talisman_timer[type][i] = INVALID_TIMER;
}
}
@@ -9470,7 +9531,7 @@ static bool pc_readdb_skilltree(char* fields[], int columns, int current)
ShowWarning("pc_readdb_skilltree: Invalid job class %d specified.\n", class_);
return false;
}
- idx = pc_class2idx(class_);
+ idx = iPc->class2idx(class_);
//This is to avoid adding two lines for the same skill. [Skotlex]
ARR_FIND( 0, MAX_SKILL_TREE, skill_idx, skill_tree[idx][skill_idx].id == 0 || skill_tree[idx][skill_idx].id == skill_id );
@@ -9540,7 +9601,7 @@ int pc_readdb(void)
memset(exp_table,0,sizeof(exp_table));
memset(max_level,0,sizeof(max_level));
- sprintf(line, "%s/"DBPATH"exp.txt", db_path);
+ sprintf(line, "%s/"DBPATH"exp.txt", iMap->db_path);
fp=fopen(line, "r");
if(fp==NULL){
@@ -9577,7 +9638,7 @@ int pc_readdb(void)
maxlv = MAX_LEVEL;
}
count++;
- job = jobs[0] = pc_class2idx(job_id);
+ job = jobs[0] = iPc->class2idx(job_id);
//We send one less and then one more because the last entry in the exp array should hold 0.
max_level[job][type] = pc_split_atoui(split[3], exp_table[job][type],',',maxlv-1)+1;
//Reverse check in case the array has a bunch of trailing zeros... [Skotlex]
@@ -9602,7 +9663,7 @@ int pc_readdb(void)
ShowError("pc_readdb: Invalid job ID %d.\n", job_id);
continue;
}
- job = pc_class2idx(job_id);
+ job = iPc->class2idx(job_id);
memcpy(exp_table[job][type], exp_table[jobs[0]][type], sizeof(exp_table[0][0]));
max_level[job][type] = maxlv;
// ShowDebug("%s - Class %d: %u\n", type?"Job":"Base", job_id, max_level[job][type]);
@@ -9613,20 +9674,20 @@ int pc_readdb(void)
if (!pcdb_checkid(i)) continue;
if (i == JOB_WEDDING || i == JOB_XMAS || i == JOB_SUMMER)
continue; //Classes that do not need exp tables.
- j = pc_class2idx(i);
+ j = iPc->class2idx(i);
if (!max_level[j][0])
- ShowWarning("Class %s (%d) does not has a base exp table.\n", job_name(i), i);
+ ShowWarning("Class %s (%d) does not has a base exp table.\n", iPc->job_name(i), i);
if (!max_level[j][1])
- ShowWarning("Class %s (%d) does not has a job exp table.\n", job_name(i), i);
+ ShowWarning("Class %s (%d) does not has a job exp table.\n", iPc->job_name(i), i);
}
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,db_path,"exp.txt");
+ ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,iMap->db_path,"exp.txt");
count = 0;
// Reset and read skilltree
memset(skill_tree,0,sizeof(skill_tree));
- sv->readdb(db_path, DBPATH"skill_tree.txt", ',', 3+MAX_PC_SKILL_REQUIRE*2, 4+MAX_PC_SKILL_REQUIRE*2, -1, &pc_readdb_skilltree);
+ sv->readdb(iMap->db_path, DBPATH"skill_tree.txt", ',', 3+MAX_PC_SKILL_REQUIRE*2, 4+MAX_PC_SKILL_REQUIRE*2, -1, &pc_readdb_skilltree);
#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
- sv->readdb(db_path, "re/level_penalty.txt", ',', 4, 4, -1, &pc_readdb_levelpenalty);
+ sv->readdb(iMap->db_path, "re/level_penalty.txt", ',', 4, 4, -1, &pc_readdb_levelpenalty);
for( k=1; k < 3; k++ ){ // fill in the blanks
for( j = 0; j < RC_MAX; j++ ){
int tmp = 0;
@@ -9648,7 +9709,7 @@ int pc_readdb(void)
for(k=0;k<ELE_MAX;k++)
attr_fix_table[i][j][k]=100;
- sprintf(line, "%s/"DBPATH"attr_fix.txt", db_path);
+ sprintf(line, "%s/"DBPATH"attr_fix.txt", iMap->db_path);
fp=fopen(line,"r");
if(fp==NULL){
@@ -9692,13 +9753,13 @@ int pc_readdb(void)
}
}
fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,db_path,"attr_fix.txt");
+ ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,iMap->db_path,"attr_fix.txt");
count = 0;
// reset then read statspoint
memset(statp,0,sizeof(statp));
i=1;
- sprintf(line, "%s/"DBPATH"statpoint.txt", db_path);
+ sprintf(line, "%s/"DBPATH"statpoint.txt", iMap->db_path);
fp=fopen(line,"r");
if(fp == NULL){
ShowWarning("Can't read '"CL_WHITE"%s"CL_RESET"'... Generating DB.\n",line);
@@ -9719,79 +9780,19 @@ int pc_readdb(void)
}
fclose(fp);
- ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,db_path,"statpoint.txt");
+ ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s/"DBPATH"%s"CL_RESET"'.\n",count,iMap->db_path,"statpoint.txt");
}
// generate the remaining parts of the db if necessary
k = battle_config.use_statpoint_table; //save setting
- battle_config.use_statpoint_table = 0; //temporarily disable to force pc_gets_status_point use default values
+ battle_config.use_statpoint_table = 0; //temporarily disable to force iPc->gets_status_point use default values
statp[0] = 45; // seed value
for (; i <= MAX_LEVEL; i++)
- statp[i] = statp[i-1] + pc_gets_status_point(i-1);
+ statp[i] = statp[i-1] + iPc->gets_status_point(i-1);
battle_config.use_statpoint_table = k; //restore setting
return 0;
}
-// Read MOTD on startup. [Valaris]
-int pc_read_motd(void)
-{
- FILE* fp;
-
- // clear old MOTD
- memset(motd_text, 0, sizeof(motd_text));
-
- // read current MOTD
- if( ( fp = fopen(motd_txt, "r") ) != NULL )
- {
- char* buf, * ptr;
- unsigned int lines = 0, entries = 0;
- size_t len;
-
- while( entries < MOTD_LINE_SIZE && fgets(motd_text[entries], sizeof(motd_text[entries]), fp) )
- {
- lines++;
-
- buf = motd_text[entries];
-
- if( buf[0] == '/' && buf[1] == '/' )
- {
- continue;
- }
-
- len = strlen(buf);
-
- while( len && ( buf[len-1] == '\r' || buf[len-1] == '\n' ) )
- {// strip trailing EOL characters
- len--;
- }
-
- if( len )
- {
- buf[len] = 0;
-
- if( ( ptr = strstr(buf, " :") ) != NULL && ptr-buf >= NAME_LENGTH )
- {// crashes newer clients
- ShowWarning("Found sequence '"CL_WHITE" :"CL_RESET"' on line '"CL_WHITE"%u"CL_RESET"' in '"CL_WHITE"%s"CL_RESET"'. This can cause newer clients to crash.\n", lines, motd_txt);
- }
- }
- else
- {// empty line
- buf[0] = ' ';
- buf[1] = 0;
- }
- entries++;
- }
- fclose(fp);
-
- ShowStatus("Done reading '"CL_WHITE"%u"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", entries, motd_txt);
- }
- else
- {
- ShowWarning("File '"CL_WHITE"%s"CL_RESET"' not found.\n", motd_txt);
- }
-
- return 0;
-}
void pc_itemcd_do(struct map_session_data *sd, bool load) {
int i,cursor = 0;
struct item_cd* cd = NULL;
@@ -9802,7 +9803,7 @@ void pc_itemcd_do(struct map_session_data *sd, bool load) {
return;
}
for(i = 0; i < MAX_ITEMDELAYS; i++) {
- if( cd->nameid[i] && DIFF_TICK(gettick(),cd->tick[i]) < 0 ) {
+ if( cd->nameid[i] && DIFF_TICK(iTimer->gettick(),cd->tick[i]) < 0 ) {
sd->item_delay[cursor].tick = cd->tick[i];
sd->item_delay[cursor].nameid = cd->nameid[i];
cursor++;
@@ -9816,7 +9817,7 @@ void pc_itemcd_do(struct map_session_data *sd, bool load) {
idb_put( itemcd_db, sd->status.char_id, cd );
}
for(i = 0; i < MAX_ITEMDELAYS; i++) {
- if( sd->item_delay[i].nameid && DIFF_TICK(gettick(),sd->item_delay[i].tick) < 0 ) {
+ if( sd->item_delay[i].nameid && DIFF_TICK(iTimer->gettick(),sd->item_delay[i].tick) < 0 ) {
cd->tick[cursor] = sd->item_delay[i].tick;
cd->nameid[cursor] = sd->item_delay[i].nameid;
cursor++;
@@ -9825,6 +9826,7 @@ void pc_itemcd_do(struct map_session_data *sd, bool load) {
}
return;
}
+
/*==========================================
* pc Init/Terminate
*------------------------------------------*/
@@ -9842,33 +9844,32 @@ int do_init_pc(void) {
itemcd_db = idb_alloc(DB_OPT_RELEASE_DATA);
- pc_readdb();
- pc_read_motd(); // Read MOTD [Valaris]
+ iPc->readdb();
- add_timer_func_list(pc_invincible_timer, "pc_invincible_timer");
- add_timer_func_list(pc_eventtimer, "pc_eventtimer");
- add_timer_func_list(pc_inventory_rental_end, "pc_inventory_rental_end");
- add_timer_func_list(pc_calc_pvprank_timer, "pc_calc_pvprank_timer");
- add_timer_func_list(pc_autosave, "pc_autosave");
- add_timer_func_list(pc_spiritball_timer, "pc_spiritball_timer");
- add_timer_func_list(pc_follow_timer, "pc_follow_timer");
- add_timer_func_list(pc_endautobonus, "pc_endautobonus");
- add_timer_func_list(pc_talisman_timer, "pc_talisman_timer");
+ iTimer->add_timer_func_list(pc_invincible_timer, "pc_invincible_timer");
+ iTimer->add_timer_func_list(pc_eventtimer, "pc_eventtimer");
+ iTimer->add_timer_func_list(pc_inventory_rental_end, "pc_inventory_rental_end");
+ iTimer->add_timer_func_list(iPc->calc_pvprank_timer, "iPc->calc_pvprank_timer");
+ iTimer->add_timer_func_list(pc_autosave, "pc_autosave");
+ iTimer->add_timer_func_list(pc_spiritball_timer, "pc_spiritball_timer");
+ iTimer->add_timer_func_list(pc_follow_timer, "pc_follow_timer");
+ iTimer->add_timer_func_list(iPc->endautobonus, "iPc->endautobonus");
+ iTimer->add_timer_func_list(pc_talisman_timer, "pc_talisman_timer");
- add_timer(gettick() + autosave_interval, pc_autosave, 0, 0);
+ iTimer->add_timer(iTimer->gettick() + iMap->autosave_interval, pc_autosave, 0, 0);
// 0=day, 1=night [Yor]
- night_flag = battle_config.night_at_start ? 1 : 0;
+ iMap->night_flag = battle_config.night_at_start ? 1 : 0;
if (battle_config.day_duration > 0 && battle_config.night_duration > 0) {
int day_duration = battle_config.day_duration;
int night_duration = battle_config.night_duration;
// add night/day timer [Yor]
- add_timer_func_list(map_day_timer, "map_day_timer");
- add_timer_func_list(map_night_timer, "map_night_timer");
+ iTimer->add_timer_func_list(iPc->map_day_timer, "iPc->map_day_timer");
+ iTimer->add_timer_func_list(iPc->map_night_timer, "iPc->map_night_timer");
- day_timer_tid = add_timer_interval(gettick() + (night_flag ? 0 : day_duration) + night_duration, map_day_timer, 0, 0, day_duration + night_duration);
- night_timer_tid = add_timer_interval(gettick() + day_duration + (night_flag ? night_duration : 0), map_night_timer, 0, 0, day_duration + night_duration);
+ iPc->day_timer_tid = iTimer->add_timer_interval(iTimer->gettick() + (iMap->night_flag ? 0 : day_duration) + night_duration, iPc->map_day_timer, 0, 0, day_duration + night_duration);
+ iPc->night_timer_tid = iTimer->add_timer_interval(iTimer->gettick() + day_duration + (iMap->night_flag ? night_duration : 0), iPc->map_night_timer, 0, 0, day_duration + night_duration);
}
do_init_pc_groups();
@@ -9877,3 +9878,218 @@ int do_init_pc(void) {
return 0;
}
+
+/*=====================================
+* Default Functions : pc.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+void pc_defaults(void) {
+ iPc = &iPc_s;
+
+ /* vars */
+ // timer for night.day
+ iPc->day_timer_tid = day_timer_tid;
+ iPc->night_timer_tid = night_timer_tid;
+
+ /* funcs */
+
+ iPc->class2idx = pc_class2idx;
+ iPc->get_group_level = pc_get_group_level;
+ iPc->can_give_items = pc_can_give_items;
+
+ iPc->can_use_command = pc_can_use_command;
+
+ iPc->setrestartvalue = pc_setrestartvalue;
+ iPc->makesavestatus = pc_makesavestatus;
+ iPc->respawn = pc_respawn;
+ iPc->setnewpc = pc_setnewpc;
+ iPc->authok = pc_authok;
+ iPc->authfail = pc_authfail;
+ iPc->reg_received = pc_reg_received;
+
+ iPc->isequip = pc_isequip;
+ iPc->equippoint = pc_equippoint;
+ iPc->setinventorydata = pc_setinventorydata;
+
+ iPc->checkskill = pc_checkskill;
+ iPc->checkskill2 = pc_checkskill2;
+ iPc->checkallowskill = pc_checkallowskill;
+ iPc->checkequip = pc_checkequip;
+
+ iPc->calc_skilltree = pc_calc_skilltree;
+ iPc->calc_skilltree_normalize_job = pc_calc_skilltree_normalize_job;
+ iPc->clean_skilltree = pc_clean_skilltree;
+
+ iPc->setpos = pc_setpos;
+ iPc->setsavepoint = pc_setsavepoint;
+ iPc->randomwarp = pc_randomwarp;
+ iPc->memo = pc_memo;
+
+ iPc->checkadditem = pc_checkadditem;
+ iPc->inventoryblank = pc_inventoryblank;
+ iPc->search_inventory = pc_search_inventory;
+ iPc->payzeny = pc_payzeny;
+ iPc->additem = pc_additem;
+ iPc->getzeny = pc_getzeny;
+ iPc->delitem = pc_delitem;
+ // Special Shop System
+ iPc->paycash = pc_paycash;
+ iPc->getcash = pc_getcash;
+
+ iPc->cart_additem = pc_cart_additem;
+ iPc->cart_delitem = pc_cart_delitem;
+ iPc->putitemtocart = pc_putitemtocart;
+ iPc->getitemfromcart = pc_getitemfromcart;
+ iPc->cartitem_amount = pc_cartitem_amount;
+
+ iPc->takeitem = pc_takeitem;
+ iPc->dropitem = pc_dropitem;
+
+ iPc->isequipped = pc_isequipped;
+ iPc->can_Adopt = pc_can_Adopt;
+ iPc->adoption = pc_adoption;
+
+ iPc->updateweightstatus = pc_updateweightstatus;
+
+ iPc->addautobonus = pc_addautobonus;
+ iPc->exeautobonus = pc_exeautobonus;
+ iPc->endautobonus = pc_endautobonus;
+ iPc->delautobonus = pc_delautobonus;
+
+ iPc->bonus = pc_bonus;
+ iPc->bonus2 = pc_bonus2;
+ iPc->bonus3 = pc_bonus3;
+ iPc->bonus4 = pc_bonus4;
+ iPc->bonus5 = pc_bonus5;
+ iPc->skill = pc_skill;
+
+ iPc->insert_card = pc_insert_card;
+
+ iPc->steal_item = pc_steal_item;
+ iPc->steal_coin = pc_steal_coin;
+
+ iPc->modifybuyvalue = pc_modifybuyvalue;
+ iPc->modifysellvalue = pc_modifysellvalue;
+
+ iPc->follow = pc_follow; // [MouseJstr]
+ iPc->stop_following = pc_stop_following;
+
+ iPc->maxbaselv = pc_maxbaselv;
+ iPc->maxjoblv = pc_maxjoblv;
+ iPc->checkbaselevelup = pc_checkbaselevelup;
+ iPc->checkjoblevelup = pc_checkjoblevelup;
+ iPc->gainexp = pc_gainexp;
+ iPc->nextbaseexp = pc_nextbaseexp;
+ iPc->thisbaseexp = pc_thisbaseexp;
+ iPc->nextjobexp = pc_nextjobexp;
+ iPc->thisjobexp = pc_thisjobexp;
+ iPc->gets_status_point = pc_gets_status_point;
+ iPc->need_status_point = pc_need_status_point;
+ iPc->statusup = pc_statusup;
+ iPc->statusup2 = pc_statusup2;
+ iPc->skillup = pc_skillup;
+ iPc->allskillup = pc_allskillup;
+ iPc->resetlvl = pc_resetlvl;
+ iPc->resetstate = pc_resetstate;
+ iPc->resetskill = pc_resetskill;
+ iPc->resetfeel = pc_resetfeel;
+ iPc->resethate = pc_resethate;
+ iPc->equipitem = pc_equipitem;
+ iPc->unequipitem = pc_unequipitem;
+ iPc->checkitem = pc_checkitem;
+ iPc->useitem = pc_useitem;
+
+ iPc->skillatk_bonus = pc_skillatk_bonus;
+ iPc->skillheal_bonus = pc_skillheal_bonus;
+ iPc->skillheal2_bonus = pc_skillheal2_bonus;
+
+ iPc->damage = pc_damage;
+ iPc->dead = pc_dead;
+ iPc->revive = pc_revive;
+ iPc->heal = pc_heal;
+ iPc->itemheal = pc_itemheal;
+ iPc->percentheal = pc_percentheal;
+ iPc->jobchange = pc_jobchange;
+ iPc->setoption = pc_setoption;
+ iPc->setcart = pc_setcart;
+ iPc->setfalcon = pc_setfalcon;
+ iPc->setriding = pc_setriding;
+ iPc->setmadogear = pc_setmadogear;
+ iPc->changelook = pc_changelook;
+ iPc->equiplookall = pc_equiplookall;
+
+ iPc->readparam = pc_readparam;
+ iPc->setparam = pc_setparam;
+ iPc->readreg = pc_readreg;
+ iPc->setreg = pc_setreg;
+ iPc->readregstr = pc_readregstr;
+ iPc->setregstr = pc_setregstr;
+ iPc->readregistry = pc_readregistry;
+ iPc->setregistry = pc_setregistry;
+ iPc->readregistry_str = pc_readregistry_str;
+ iPc->setregistry_str = pc_setregistry_str;
+
+ iPc->addeventtimer = pc_addeventtimer;
+ iPc->deleventtimer = pc_deleventtimer;
+ iPc->cleareventtimer = pc_cleareventtimer;
+ iPc->addeventtimercount = pc_addeventtimercount;
+
+ iPc->calc_pvprank = pc_calc_pvprank;
+ iPc->calc_pvprank_timer = pc_calc_pvprank_timer;
+
+ iPc->ismarried = pc_ismarried;
+ iPc->marriage = pc_marriage;
+ iPc->divorce = pc_divorce;
+ iPc->get_partner = pc_get_partner;
+ iPc->get_father = pc_get_father;
+ iPc->get_mother = pc_get_mother;
+ iPc->get_child = pc_get_child;
+
+ iPc->bleeding = pc_bleeding;
+ iPc->regen = pc_regen;
+
+ iPc->setstand = pc_setstand;
+ iPc->candrop = pc_candrop;
+
+ iPc->jobid2mapid = pc_jobid2mapid; // Skotlex
+ iPc->mapid2jobid = pc_mapid2jobid; // Skotlex
+
+ iPc->job_name = job_name;
+
+ iPc->setinvincibletimer = pc_setinvincibletimer;
+ iPc->delinvincibletimer = pc_delinvincibletimer;
+
+ iPc->addspiritball = pc_addspiritball;
+ iPc->delspiritball = pc_delspiritball;
+ iPc->addfame = pc_addfame;
+ iPc->famerank = pc_famerank;
+ iPc->set_hate_mob = pc_set_hate_mob;
+
+ iPc->readdb = pc_readdb;
+ iPc->do_init_pc = do_init_pc;
+ iPc->do_final_pc = do_final_pc;
+ iPc->map_day_timer = map_day_timer; // by [yor]
+ iPc->map_night_timer = map_night_timer; // by [yor]
+ // Rental System
+ iPc->inventory_rentals = pc_inventory_rentals;
+ iPc->inventory_rental_clear = pc_inventory_rental_clear;
+ iPc->inventory_rental_add = pc_inventory_rental_add;
+
+ iPc->disguise = pc_disguise;
+ iPc->isautolooting = pc_isautolooting;
+
+ iPc->overheat = pc_overheat;
+
+ iPc->banding = pc_banding;
+
+ iPc->itemcd_do = pc_itemcd_do;
+
+ iPc->load_combo = pc_load_combo;
+
+ iPc->add_talisman = pc_add_talisman;
+ iPc->del_talisman = pc_del_talisman;
+
+ iPc->baselevelchanged = pc_baselevelchanged;
+ iPc->level_penalty_mod = pc_level_penalty_mod;
+}
diff --git a/src/map/pc.h b/src/map/pc.h
index 014f93d99..91f7750b3 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -1,15 +1,14 @@
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-
#ifndef _PC_H_
#define _PC_H_
-
#include "../common/mmo.h" // JOB_*, MAX_FAME_LIST, struct fame_list, struct mmo_charstatus
#include "../common/ers.h"
#include "../common/timer.h" // INVALID_TIMER
#include "atcommand.h" // AtCommandType
#include "battle.h" // battle_config
+#include "battleground.h"
#include "buyingstore.h" // struct s_buyingstore
#include "itemdb.h" // MAX_ITEMGROUP
#include "map.h" // RC_MAX
@@ -21,11 +20,9 @@
#include "mob.h"
#include "log.h"
#include "pc_groups.h"
-
#define MAX_PC_BONUS 10
#define MAX_PC_SKILL_REQUIRE 5
#define MAX_PC_FEELHATE 3
-
//Equip indexes constants. (eg: sd->equip_index[EQI_AMMO] returns the index
//where the arrows are equipped)
enum equip_index {
@@ -46,7 +43,6 @@ enum equip_index {
EQI_AMMO,
EQI_MAX
};
-
struct weapon_data {
int atkmods[3];
// all the variables except atkmods get zero'ed in each call of status_calc_pc
@@ -62,46 +58,38 @@ struct weapon_data {
int addrace[RC_MAX];
int addrace2[RC2_MAX];
int addsize[3];
-
struct drain_data {
short rate;
short per;
short value;
unsigned type:1;
} hp_drain[RC_MAX], sp_drain[RC_MAX];
-
struct {
short class_, rate;
} add_dmg[MAX_PC_BONUS];
-
struct {
short flag, rate;
unsigned char ele;
} addele2[MAX_PC_BONUS];
};
-
struct s_autospell {
short id, lv, rate, card_id, flag;
bool lock; // bAutoSpellOnSkill: blocks autospell from triggering again, while being executed
};
-
struct s_addeffect {
enum sc_type id;
short rate, arrow_rate;
unsigned char flag;
};
-
struct s_addeffectonskill {
enum sc_type id;
short rate, skill;
unsigned char target;
};
-
struct s_add_drop {
short id, group;
int race, rate;
};
-
struct s_autobonus {
short rate,atk_type;
unsigned int duration;
@@ -109,13 +97,11 @@ struct s_autobonus {
int active;
unsigned short pos;
};
-
enum npc_timeout_type {
NPCT_INPUT = 0,
NPCT_MENU = 1,
NPCT_WAIT = 2,
};
-
struct map_session_data {
struct block_list bl;
struct unit_data ud;
@@ -173,6 +159,7 @@ struct map_session_data {
unsigned int prevend : 1;//used to flag wheather you've spent 40sp to open the vending or not.
unsigned int warping : 1;//states whether you're in the middle of a warp processing
unsigned int permanent_speed : 1; // When 1, speed cannot be changed through status_calc_pc().
+ unsigned int dialog : 1;
} state;
struct {
unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
@@ -194,7 +181,6 @@ struct map_session_data {
struct mmo_charstatus status;
struct registry save_reg;
-
struct item_data* inventory_data[MAX_INVENTORY]; // direct pointers to itemdb entries (faster than doing item_id lookups)
short equip_index[EQI_MAX];
unsigned int weight,max_weight;
@@ -212,21 +198,16 @@ struct map_session_data {
int npc_timer_id; //For player attached npc timers. [Skotlex]
unsigned int chatID;
time_t idletime;
-
struct{
int npc_id;
unsigned int timeout;
} progressbar; //Progress Bar [Inkfish]
-
struct{
char name[NAME_LENGTH];
} ignore[MAX_IGNORE_LIST];
-
int followtimer; // [MouseJstr]
int followtarget;
-
time_t emotionlasttime; // to limit flood with emotion packets
-
short skillitem,skillitemlv;
uint16 skill_id_old,skill_lv_old;
uint16 skill_id_dance,skill_lv_dance;
@@ -234,7 +215,6 @@ struct map_session_data {
unsigned char blockskill[MAX_SKILL];
int cloneskill_id, reproduceskill_id;
int menuskill_id, menuskill_val, menuskill_val2;
-
int invincible_timer;
unsigned int canlog_tick;
unsigned int canuseitem_tick; // [Skotlex]
@@ -245,17 +225,13 @@ struct map_session_data {
unsigned int cansendmail_tick; // [Mail System Flood Protection]
unsigned int ks_floodprotect_tick; // [Kill Steal Protection]
unsigned int bloodylust_tick; // bloodylust player timer [out/in re full-heal protection]
-
struct {
short nameid;
unsigned int tick;
} item_delay[MAX_ITEMDELAYS]; // [Paradox924X]
-
short weapontype1,weapontype2;
short disguise; // [Valaris]
-
struct weapon_data right_weapon, left_weapon;
-
// here start arrays to be globally zeroed at the beginning of status_calc_pc()
int param_bonus[6],param_equip[6]; //Stores card/equipment bonuses.
int subele[ELE_MAX];
@@ -287,7 +263,6 @@ struct map_session_data {
struct s_autospell autospell[15], autospell2[15], autospell3[15];
struct s_addeffect addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS];
struct s_addeffectonskill addeff3[MAX_PC_BONUS];
-
struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills.
unsigned short id;
short val;
@@ -337,7 +312,6 @@ struct map_session_data {
int itemhealrate2; // [Epoque] Increase heal rate of all healing items.
int shieldmdef;//royal guard's
unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex]
-
short splash_range, splash_add_range;
short add_steal_rate;
short add_heal_rate, add_heal2_rate;
@@ -352,24 +326,18 @@ struct map_session_data {
int ematk; // matk bonus from equipment
// int eatk; // atk bonus from equipment
} bonus;
-
// zeroed vars end here.
-
int castrate,delayrate,hprate,sprate,dsprate;
int hprecov_rate,sprecov_rate;
int matk_rate;
int critical_rate,hit_rate,flee_rate,flee2_rate,def_rate,def2_rate,mdef_rate,mdef2_rate;
-
int itemid;
short itemindex; //Used item's index in sd->inventory [Skotlex]
-
short catch_target_class; // pet catching, stores a pet class to catch (short now) [zzo]
-
short spiritball, spiritball_old;
int spirit_timer[MAX_SPIRITBALL];
short talisman[ELE_POISON+1]; // There are actually 5 talisman Fire, Ice, Wind, Earth & Poison maybe because its color violet.
int talisman_timer[ELE_POISON+1][10];
-
unsigned char potion_success_counter; //Potion successes in row counter
unsigned char mission_count; //Stores the bounty kill count for TK_MISSION
short mission_mobid; //Stores the target mob_id for TK_MISSION
@@ -377,10 +345,8 @@ struct map_session_data {
int devotion[5]; //Stores the account IDs of chars devoted to.
int reg_num; //Number of registries (type numeric)
int regstr_num; //Number of registries (type string)
-
struct script_reg *reg;
struct script_regstr *regstr;
-
int trade_partner;
struct {
struct {
@@ -388,7 +354,6 @@ struct map_session_data {
} item[10];
int zeny, weight;
} deal;
-
bool party_creating; // whether the char is requesting party creation
bool party_joining; // whether the char is accepting party invitation
int party_invite, party_invite_account; // for handling party invitation (holds party id and account id)
@@ -399,16 +364,13 @@ struct map_session_data {
short guild_x,guild_y; // For guildmate position display. [Skotlex] should be short [zzo]
int guildspy; // [Syrus22]
int partyspy; // [Syrus22]
-
unsigned int vended_id;
unsigned int vender_id;
int vend_num;
char message[MESSAGE_SIZE];
struct s_vending vending[MAX_VENDING];
-
unsigned int buyer_id; // uid of open buying store
struct s_buyingstore buyingstore;
-
struct s_search_store_info searchstore;
struct pet_data *pd;
@@ -419,7 +381,7 @@ struct map_session_data {
struct{
int m; //-1 - none, other: map index corresponding to map name.
unsigned short index; //map index
- }feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars
+ } feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars
short hate_mob[3];
int pvp_timer;
@@ -519,6 +481,20 @@ struct map_session_data {
struct sc_display_entry **sc_display;
unsigned char sc_display_count;
+ unsigned short *instance;
+ unsigned short instances;
+
+ /* Possible Thanks to Yommy~! */
+ struct {
+ unsigned int ready : 1;/* did he accept the 'match is about to start, enter' dialog? */
+ unsigned int client_has_bg_data : 1; /* flags whether the client has the "in queue" window (aka the client knows it is in a queue) */
+ struct bg_arena *arena;
+ enum bg_queue_types type;
+ } bg_queue;
+
+ int *queues;
+ unsigned int queues_count;
+
// temporary debugging of bug #3504
const char* delunit_prevfile;
int delunit_prevline;
@@ -702,189 +678,54 @@ enum equip_pos {
)
#endif
-int pc_class2idx(int class_);
-int pc_get_group_level(struct map_session_data *sd);
#define pc_get_group_id(sd) ( (sd)->group_id )
-int pc_getrefinebonus(int lv,int type);
-bool pc_can_give_items(struct map_session_data *sd);
-bool pc_can_use_command(struct map_session_data *sd, const char *command);
#define pc_has_permission(sd, permission) ( ((sd)->permissions&permission) != 0 )
#define pc_should_log_commands(sd) ( (sd)->group_log_command != false )
-int pc_setrestartvalue(struct map_session_data *sd,int type);
-int pc_makesavestatus(struct map_session_data *);
-void pc_respawn(struct map_session_data* sd, clr_type clrtype);
-int pc_setnewpc(struct map_session_data*,int,int,int,unsigned int,int,int);
-bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers);
-void pc_authfail(struct map_session_data *);
-int pc_reg_received(struct map_session_data *sd);
-int pc_isequip(struct map_session_data *sd,int n);
-int pc_equippoint(struct map_session_data *sd,int n);
-int pc_setinventorydata(struct map_session_data *sd);
-int pc_checkskill(struct map_session_data *sd,uint16 skill_id);
-int pc_checkskill2(struct map_session_data *sd,uint16 index);
-int pc_checkallowskill(struct map_session_data *sd);
-int pc_checkequip(struct map_session_data *sd,int pos);
-int pc_calc_skilltree(struct map_session_data *sd);
-int pc_calc_skilltree_normalize_job(struct map_session_data *sd);
-int pc_clean_skilltree(struct map_session_data *sd);
#define pc_checkoverhp(sd) ((sd)->battle_status.hp == (sd)->battle_status.max_hp)
#define pc_checkoversp(sd) ((sd)->battle_status.sp == (sd)->battle_status.max_sp)
-int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype);
-int pc_setsavepoint(struct map_session_data*,short,int,int);
-int pc_randomwarp(struct map_session_data *sd,clr_type type);
-int pc_memo(struct map_session_data* sd, int pos);
-
-int pc_checkadditem(struct map_session_data*,int,int);
-int pc_inventoryblank(struct map_session_data*);
-int pc_search_inventory(struct map_session_data *sd,int item_id);
-int pc_payzeny(struct map_session_data*,int, enum e_log_pick_type type, struct map_session_data*);
-int pc_additem(struct map_session_data*,struct item*,int,e_log_pick_type);
-int pc_getzeny(struct map_session_data*,int, enum e_log_pick_type, struct map_session_data*);
-int pc_delitem(struct map_session_data*,int,int,int,short,e_log_pick_type);
-
-// Special Shop System
-int pc_paycash(struct map_session_data *sd, int price, int points);
-int pc_getcash(struct map_session_data *sd, int cash, int points);
-
-int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type);
-int pc_cart_delitem(struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type);
-int pc_putitemtocart(struct map_session_data *sd,int idx,int amount);
-int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount);
-int pc_cartitem_amount(struct map_session_data *sd,int idx,int amount);
-
-int pc_takeitem(struct map_session_data*,struct flooritem_data*);
-int pc_dropitem(struct map_session_data*,int,int);
-
-bool pc_isequipped(struct map_session_data *sd, int nameid);
-bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd );
-bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
-
-int pc_updateweightstatus(struct map_session_data *sd);
-
-int pc_addautobonus(struct s_autobonus *bonus,char max,const char *script,short rate,unsigned int dur,short atk_type,const char *o_script,unsigned short pos,bool onskill);
-int pc_exeautobonus(struct map_session_data* sd,struct s_autobonus *bonus);
-int pc_endautobonus(int tid, unsigned int tick, int id, intptr_t data);
-int pc_delautobonus(struct map_session_data* sd,struct s_autobonus *bonus,char max,bool restore);
-
-int pc_bonus(struct map_session_data*,int,int);
-int pc_bonus2(struct map_session_data *sd,int,int,int);
-int pc_bonus3(struct map_session_data *sd,int,int,int,int);
-int pc_bonus4(struct map_session_data *sd,int,int,int,int,int);
-int pc_bonus5(struct map_session_data *sd,int,int,int,int,int,int);
-int pc_skill(struct map_session_data* sd, int id, int level, int flag);
-
-int pc_insert_card(struct map_session_data *sd,int idx_card,int idx_equip);
-
-int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skill_lv);
-int pc_steal_coin(struct map_session_data *sd,struct block_list *bl);
-
-int pc_modifybuyvalue(struct map_session_data*,int);
-int pc_modifysellvalue(struct map_session_data*,int);
-
-int pc_follow(struct map_session_data*, int); // [MouseJstr]
-int pc_stop_following(struct map_session_data*);
-
-unsigned int pc_maxbaselv(struct map_session_data *sd);
-unsigned int pc_maxjoblv(struct map_session_data *sd);
-int pc_checkbaselevelup(struct map_session_data *sd);
-int pc_checkjoblevelup(struct map_session_data *sd);
-int pc_gainexp(struct map_session_data*,struct block_list*,unsigned int,unsigned int, bool);
-unsigned int pc_nextbaseexp(struct map_session_data *);
-unsigned int pc_thisbaseexp(struct map_session_data *);
-unsigned int pc_nextjobexp(struct map_session_data *);
-unsigned int pc_thisjobexp(struct map_session_data *);
-int pc_gets_status_point(int);
-int pc_need_status_point(struct map_session_data *,int,int);
-int pc_statusup(struct map_session_data*,int);
-int pc_statusup2(struct map_session_data*,int,int);
-int pc_skillup(struct map_session_data*,uint16 skill_id);
-int pc_allskillup(struct map_session_data*);
-int pc_resetlvl(struct map_session_data*,int type);
-int pc_resetstate(struct map_session_data*);
-int pc_resetskill(struct map_session_data*, int);
-int pc_resetfeel(struct map_session_data*);
-int pc_resethate(struct map_session_data*);
-int pc_equipitem(struct map_session_data*,int,int);
-int pc_unequipitem(struct map_session_data*,int,int);
-int pc_checkitem(struct map_session_data*);
-int pc_useitem(struct map_session_data*,int);
-
-int pc_skillatk_bonus(struct map_session_data *sd, uint16 skill_id);
-int pc_skillheal_bonus(struct map_session_data *sd, uint16 skill_id);
-int pc_skillheal2_bonus(struct map_session_data *sd, uint16 skill_id);
-
-void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp);
-int pc_dead(struct map_session_data *sd,struct block_list *src);
-void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp);
-void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int type);
-int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp);
-int pc_percentheal(struct map_session_data *sd,int,int);
-int pc_jobchange(struct map_session_data *,int, int);
-int pc_setoption(struct map_session_data *,int);
-int pc_setcart(struct map_session_data* sd, int type);
-int pc_setfalcon(struct map_session_data* sd, int flag);
-int pc_setriding(struct map_session_data* sd, int flag);
-int pc_setmadogear(struct map_session_data* sd, int flag);
-int pc_changelook(struct map_session_data *,int,int);
-int pc_equiplookall(struct map_session_data *sd);
-
-int pc_readparam(struct map_session_data*,int);
-int pc_setparam(struct map_session_data*,int,int);
-int pc_readreg(struct map_session_data*,int);
-int pc_setreg(struct map_session_data*,int,int);
-char *pc_readregstr(struct map_session_data *sd,int reg);
-int pc_setregstr(struct map_session_data *sd,int reg,const char *str);
-
-#define pc_readglobalreg(sd,reg) pc_readregistry(sd,reg,3)
-#define pc_setglobalreg(sd,reg,val) pc_setregistry(sd,reg,val,3)
-#define pc_readglobalreg_str(sd,reg) pc_readregistry_str(sd,reg,3)
-#define pc_setglobalreg_str(sd,reg,val) pc_setregistry_str(sd,reg,val,3)
-#define pc_readaccountreg(sd,reg) pc_readregistry(sd,reg,2)
-#define pc_setaccountreg(sd,reg,val) pc_setregistry(sd,reg,val,2)
-#define pc_readaccountregstr(sd,reg) pc_readregistry_str(sd,reg,2)
-#define pc_setaccountregstr(sd,reg,val) pc_setregistry_str(sd,reg,val,2)
-#define pc_readaccountreg2(sd,reg) pc_readregistry(sd,reg,1)
-#define pc_setaccountreg2(sd,reg,val) pc_setregistry(sd,reg,val,1)
-#define pc_readaccountreg2str(sd,reg) pc_readregistry_str(sd,reg,1)
-#define pc_setaccountreg2str(sd,reg,val) pc_setregistry_str(sd,reg,val,1)
-int pc_readregistry(struct map_session_data*,const char*,int);
-int pc_setregistry(struct map_session_data*,const char*,int,int);
-char *pc_readregistry_str(struct map_session_data*,const char*,int);
-int pc_setregistry_str(struct map_session_data*,const char*,const char*,int);
-
-int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name);
-int pc_deleventtimer(struct map_session_data *sd,const char *name);
-int pc_cleareventtimer(struct map_session_data *sd);
-int pc_addeventtimercount(struct map_session_data *sd,const char *name,int tick);
-
-int pc_calc_pvprank(struct map_session_data *sd);
-int pc_calc_pvprank_timer(int tid, unsigned int tick, int id, intptr_t data);
-
-int pc_ismarried(struct map_session_data *sd);
-int pc_marriage(struct map_session_data *sd,struct map_session_data *dstsd);
-int pc_divorce(struct map_session_data *sd);
-struct map_session_data *pc_get_partner(struct map_session_data *sd);
-struct map_session_data *pc_get_father(struct map_session_data *sd);
-struct map_session_data *pc_get_mother(struct map_session_data *sd);
-struct map_session_data *pc_get_child(struct map_session_data *sd);
-
-void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick);
-void pc_regen (struct map_session_data *sd, unsigned int diff_tick);
-
-void pc_setstand(struct map_session_data *sd);
-int pc_candrop(struct map_session_data *sd,struct item *item);
-
-int pc_jobid2mapid(unsigned short b_class); // Skotlex
-int pc_mapid2jobid(unsigned short class_, int sex); // Skotlex
-
-const char * job_name(int class_);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#define pc_readglobalreg(sd,reg) iPc->readregistry(sd,reg,3)
+#define pc_setglobalreg(sd,reg,val) iPc->setregistry(sd,reg,val,3)
+#define pc_readglobalreg_str(sd,reg) iPc->readregistry_str(sd,reg,3)
+#define pc_setglobalreg_str(sd,reg,val) iPc->setregistry_str(sd,reg,val,3)
+#define pc_readaccountreg(sd,reg) iPc->readregistry(sd,reg,2)
+#define pc_setaccountreg(sd,reg,val) iPc->setregistry(sd,reg,val,2)
+#define pc_readaccountregstr(sd,reg) iPc->readregistry_str(sd,reg,2)
+#define pc_setaccountregstr(sd,reg,val) iPc->setregistry_str(sd,reg,val,2)
+#define pc_readaccountreg2(sd,reg) iPc->readregistry(sd,reg,1)
+#define pc_setaccountreg2(sd,reg,val) iPc->setregistry(sd,reg,val,1)
+#define pc_readaccountreg2str(sd,reg) iPc->readregistry_str(sd,reg,1)
+#define pc_setaccountreg2str(sd,reg,val) iPc->setregistry_str(sd,reg,val,1)
+
+
+
+
+
+
+
struct skill_tree_entry {
short id;
@@ -897,6 +738,7 @@ struct skill_tree_entry {
unsigned char lv;
} need[MAX_PC_SKILL_REQUIRE];
}; // Celest
+
extern struct skill_tree_entry skill_tree[CLASS_COUNT][MAX_SKILL_TREE];
struct sg_data {
@@ -907,56 +749,243 @@ struct sg_data {
char hate_var[NAME_LENGTH];
int (*day_func)(void);
};
-extern const struct sg_data sg_info[MAX_PC_FEELHATE];
-void pc_setinvincibletimer(struct map_session_data* sd, int val);
-void pc_delinvincibletimer(struct map_session_data* sd);
-
-int pc_addspiritball(struct map_session_data *sd,int,int);
-int pc_delspiritball(struct map_session_data *sd,int,int);
-void pc_addfame(struct map_session_data *sd,int count);
-unsigned char pc_famerank(int char_id, int job);
-int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl);
+extern const struct sg_data sg_info[MAX_PC_FEELHATE];
extern struct fame_list smith_fame_list[MAX_FAME_LIST];
extern struct fame_list chemist_fame_list[MAX_FAME_LIST];
extern struct fame_list taekwon_fame_list[MAX_FAME_LIST];
-int pc_readdb(void);
-int do_init_pc(void);
-void do_final_pc(void);
-
enum {ADDITEM_EXIST,ADDITEM_NEW,ADDITEM_OVERAMOUNT};
-// timer for night.day
-extern int day_timer_tid;
-extern int night_timer_tid;
-int map_day_timer(int tid, unsigned int tick, int id, intptr_t data); // by [yor]
-int map_night_timer(int tid, unsigned int tick, int id, intptr_t data); // by [yor]
-// Rental System
-void pc_inventory_rentals(struct map_session_data *sd);
-int pc_inventory_rental_clear(struct map_session_data *sd);
-void pc_inventory_rental_add(struct map_session_data *sd, int seconds);
-int pc_read_motd(void); // [Valaris]
-int pc_disguise(struct map_session_data *sd, int class_);
-bool pc_isautolooting(struct map_session_data *sd, int nameid);
-void pc_overheat(struct map_session_data *sd, int val);
-int pc_banding(struct map_session_data *sd, uint16 skill_lv);
-void pc_itemcd_do(struct map_session_data *sd, bool load);
-int pc_load_combo(struct map_session_data *sd);
-int pc_add_talisman(struct map_session_data *sd,int interval,int max,int type);
-int pc_del_talisman(struct map_session_data *sd,int count,int type);
-void pc_baselevelchanged(struct map_session_data *sd);
#if defined(RENEWAL_DROP) || defined(RENEWAL_EXP)
-int pc_level_penalty_mod(struct map_session_data *sd, struct mob_data * md, int type);
#endif
+/*=====================================
+* Interface : pc.h
+* Generated by HerculesInterfaceMaker
+* created by Susu
+*-------------------------------------*/
+struct pc_interface {
+
+ /* vars */
+ // timer for night.day
+ int day_timer_tid;
+ int night_timer_tid;
+
+ /* funcs */
+
+ int (*class2idx) (int class_);
+ int (*get_group_level) (struct map_session_data *sd);
+ int (*getrefinebonus) (int lv,int type);
+ bool (*can_give_items) (struct map_session_data *sd);
+
+ bool (*can_use_command) (struct map_session_data *sd, const char *command);
+
+ int (*setrestartvalue) (struct map_session_data *sd,int type);
+ int (*makesavestatus) (struct map_session_data *);
+ void (*respawn) (struct map_session_data* sd, clr_type clrtype);
+ int (*setnewpc) (struct map_session_data*,int,int,int,unsigned int,int,int);
+ bool (*authok) (struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers);
+ void (*authfail) (struct map_session_data *);
+ int (*reg_received) (struct map_session_data *sd);
+
+ int (*isequip) (struct map_session_data *sd,int n);
+ int (*equippoint) (struct map_session_data *sd,int n);
+ int (*setinventorydata) (struct map_session_data *sd);
+
+ int (*checkskill) (struct map_session_data *sd,uint16 skill_id);
+ int (*checkskill2) (struct map_session_data *sd,uint16 index);
+ int (*checkallowskill) (struct map_session_data *sd);
+ int (*checkequip) (struct map_session_data *sd,int pos);
+
+ int (*calc_skilltree) (struct map_session_data *sd);
+ int (*calc_skilltree_normalize_job) (struct map_session_data *sd);
+ int (*clean_skilltree) (struct map_session_data *sd);
+
+ int (*setpos) (struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype);
+ int (*setsavepoint) (struct map_session_data*,short,int,int);
+ int (*randomwarp) (struct map_session_data *sd,clr_type type);
+ int (*memo) (struct map_session_data* sd, int pos);
+
+ int (*checkadditem) (struct map_session_data*,int,int);
+ int (*inventoryblank) (struct map_session_data*);
+ int (*search_inventory) (struct map_session_data *sd,int item_id);
+ int (*payzeny) (struct map_session_data*,int, enum e_log_pick_type type, struct map_session_data*);
+ int (*additem) (struct map_session_data*,struct item*,int,e_log_pick_type);
+ int (*getzeny) (struct map_session_data*,int, enum e_log_pick_type, struct map_session_data*);
+ int (*delitem) (struct map_session_data*,int,int,int,short,e_log_pick_type);
+ // Special Shop System
+ int (*paycash) (struct map_session_data *sd, int price, int points);
+ int (*getcash) (struct map_session_data *sd, int cash, int points);
+
+ int (*cart_additem) (struct map_session_data *sd,struct item *item_data,int amount,e_log_pick_type log_type);
+ int (*cart_delitem) (struct map_session_data *sd,int n,int amount,int type,e_log_pick_type log_type);
+ int (*putitemtocart) (struct map_session_data *sd,int idx,int amount);
+ int (*getitemfromcart) (struct map_session_data *sd,int idx,int amount);
+ int (*cartitem_amount) (struct map_session_data *sd,int idx,int amount);
+
+ int (*takeitem) (struct map_session_data*,struct flooritem_data*);
+ int (*dropitem) (struct map_session_data*,int,int);
+
+ bool (*isequipped) (struct map_session_data *sd, int nameid);
+ bool (*can_Adopt) (struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
+ bool (*adoption) (struct map_session_data *p1_sd, struct map_session_data *p2_sd, struct map_session_data *b_sd);
+
+ int (*updateweightstatus) (struct map_session_data *sd);
+
+ int (*addautobonus) (struct s_autobonus *bonus,char max,const char *script,short rate,unsigned int dur,short atk_type,const char *o_script,unsigned short pos,bool onskill);
+ int (*exeautobonus) (struct map_session_data* sd,struct s_autobonus *bonus);
+ int (*endautobonus) (int tid, unsigned int tick, int id, intptr_t data);
+ int (*delautobonus) (struct map_session_data* sd,struct s_autobonus *bonus,char max,bool restore);
+
+ int (*bonus) (struct map_session_data*,int,int);
+ int (*bonus2) (struct map_session_data *sd,int,int,int);
+ int (*bonus3) (struct map_session_data *sd,int,int,int,int);
+ int (*bonus4) (struct map_session_data *sd,int,int,int,int,int);
+ int (*bonus5) (struct map_session_data *sd,int,int,int,int,int,int);
+ int (*skill) (struct map_session_data* sd, int id, int level, int flag);
+
+ int (*insert_card) (struct map_session_data *sd,int idx_card,int idx_equip);
+
+ int (*steal_item) (struct map_session_data *sd,struct block_list *bl, uint16 skill_lv);
+ int (*steal_coin) (struct map_session_data *sd,struct block_list *bl);
+
+ int (*modifybuyvalue) (struct map_session_data*,int);
+ int (*modifysellvalue) (struct map_session_data*,int);
+
+ int (*follow) (struct map_session_data*, int); // [MouseJstr]
+ int (*stop_following) (struct map_session_data*);
+
+ unsigned int (*maxbaselv) (struct map_session_data *sd);
+ unsigned int (*maxjoblv) (struct map_session_data *sd);
+ int (*checkbaselevelup) (struct map_session_data *sd);
+ int (*checkjoblevelup) (struct map_session_data *sd);
+ int (*gainexp) (struct map_session_data*,struct block_list*,unsigned int,unsigned int, bool);
+ unsigned int (*nextbaseexp) (struct map_session_data *);
+ unsigned int (*thisbaseexp) (struct map_session_data *);
+ unsigned int (*nextjobexp) (struct map_session_data *);
+ unsigned int (*thisjobexp) (struct map_session_data *);
+ int (*gets_status_point) (int);
+ int (*need_status_point) (struct map_session_data *,int,int);
+ int (*statusup) (struct map_session_data*,int);
+ int (*statusup2) (struct map_session_data*,int,int);
+ int (*skillup) (struct map_session_data*,uint16 skill_id);
+ int (*allskillup) (struct map_session_data*);
+ int (*resetlvl) (struct map_session_data*,int type);
+ int (*resetstate) (struct map_session_data*);
+ int (*resetskill) (struct map_session_data*, int);
+ int (*resetfeel) (struct map_session_data*);
+ int (*resethate) (struct map_session_data*);
+ int (*equipitem) (struct map_session_data*,int,int);
+ int (*unequipitem) (struct map_session_data*,int,int);
+ int (*checkitem) (struct map_session_data*);
+ int (*useitem) (struct map_session_data*,int);
+
+ int (*skillatk_bonus) (struct map_session_data *sd, uint16 skill_id);
+ int (*skillheal_bonus) (struct map_session_data *sd, uint16 skill_id);
+ int (*skillheal2_bonus) (struct map_session_data *sd, uint16 skill_id);
+
+ void (*damage) (struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp);
+ int (*dead) (struct map_session_data *sd,struct block_list *src);
+ void (*revive) (struct map_session_data *sd,unsigned int hp, unsigned int sp);
+ void (*heal) (struct map_session_data *sd,unsigned int hp,unsigned int sp, int type);
+ int (*itemheal) (struct map_session_data *sd,int itemid, int hp,int sp);
+ int (*percentheal) (struct map_session_data *sd,int,int);
+ int (*jobchange) (struct map_session_data *,int, int);
+ int (*setoption) (struct map_session_data *,int);
+ int (*setcart) (struct map_session_data* sd, int type);
+ int (*setfalcon) (struct map_session_data* sd, int flag);
+ int (*setriding) (struct map_session_data* sd, int flag);
+ int (*setmadogear) (struct map_session_data* sd, int flag);
+ int (*changelook) (struct map_session_data *,int,int);
+ int (*equiplookall) (struct map_session_data *sd);
+
+ int (*readparam) (struct map_session_data*,int);
+ int (*setparam) (struct map_session_data*,int,int);
+ int (*readreg) (struct map_session_data*,int);
+ int (*setreg) (struct map_session_data*,int,int);
+ char * (*readregstr) (struct map_session_data *sd,int reg);
+ int (*setregstr) (struct map_session_data *sd,int reg,const char *str);
+ int (*readregistry) (struct map_session_data*,const char*,int);
+ int (*setregistry) (struct map_session_data*,const char*,int,int);
+ char * (*readregistry_str) (struct map_session_data*,const char*,int);
+ int (*setregistry_str) (struct map_session_data*,const char*,const char*,int);
+
+ int (*addeventtimer) (struct map_session_data *sd,int tick,const char *name);
+ int (*deleventtimer) (struct map_session_data *sd,const char *name);
+ int (*cleareventtimer) (struct map_session_data *sd);
+ int (*addeventtimercount) (struct map_session_data *sd,const char *name,int tick);
+
+ int (*calc_pvprank) (struct map_session_data *sd);
+ int (*calc_pvprank_timer) (int tid, unsigned int tick, int id, intptr_t data);
+
+ int (*ismarried) (struct map_session_data *sd);
+ int (*marriage) (struct map_session_data *sd,struct map_session_data *dstsd);
+ int (*divorce) (struct map_session_data *sd);
+ struct map_session_data * (*get_partner) (struct map_session_data *sd);
+ struct map_session_data * (*get_father) (struct map_session_data *sd);
+ struct map_session_data * (*get_mother) (struct map_session_data *sd);
+ struct map_session_data * (*get_child) (struct map_session_data *sd);
+
+ void (*bleeding) (struct map_session_data *sd, unsigned int diff_tick);
+ void (*regen) (struct map_session_data *sd, unsigned int diff_tick);
+
+ void (*setstand) (struct map_session_data *sd);
+ int (*candrop) (struct map_session_data *sd,struct item *item);
+
+ int (*jobid2mapid) (unsigned short b_class); // Skotlex
+ int (*mapid2jobid) (unsigned short class_, int sex); // Skotlex
+
+ const char * (*job_name) (int class_);
+
+ void (*setinvincibletimer) (struct map_session_data* sd, int val);
+ void (*delinvincibletimer) (struct map_session_data* sd);
+
+ int (*addspiritball) (struct map_session_data *sd,int,int);
+ int (*delspiritball) (struct map_session_data *sd,int,int);
+ void (*addfame) (struct map_session_data *sd,int count);
+ unsigned char (*famerank) (int char_id, int job);
+ int (*set_hate_mob) (struct map_session_data *sd, int pos, struct block_list *bl);
+
+ int (*readdb) (void);
+ int (*do_init_pc) (void);
+ void (*do_final_pc) (void);
+ int (*map_day_timer) (int tid, unsigned int tick, int id, intptr_t data); // by [yor]
+ int (*map_night_timer) (int tid, unsigned int tick, int id, intptr_t data); // by [yor]
+ // Rental System
+ void (*inventory_rentals) (struct map_session_data *sd);
+ int (*inventory_rental_clear) (struct map_session_data *sd);
+ void (*inventory_rental_add) (struct map_session_data *sd, int seconds);
+
+ int (*disguise) (struct map_session_data *sd, int class_);
+ bool (*isautolooting) (struct map_session_data *sd, int nameid);
+
+ void (*overheat) (struct map_session_data *sd, int val);
+
+ int (*banding) (struct map_session_data *sd, uint16 skill_lv);
+
+ void (*itemcd_do) (struct map_session_data *sd, bool load);
+
+ int (*load_combo) (struct map_session_data *sd);
+
+ int (*add_talisman) (struct map_session_data *sd,int interval,int max,int type);
+ int (*del_talisman) (struct map_session_data *sd,int count,int type);
+
+ void (*baselevelchanged) (struct map_session_data *sd);
+ int (*level_penalty_mod) (struct map_session_data *sd, struct mob_data * md, int type);
+} iPc_s;
+
+struct pc_interface *iPc;
+
+void pc_defaults(void);
+
#endif /* _PC_H_ */
diff --git a/src/map/pet.c b/src/map/pet.c
index c85092a01..fa5188e79 100644
--- a/src/map/pet.c
+++ b/src/map/pet.c
@@ -76,7 +76,7 @@ int pet_create_egg(struct map_session_data *sd, int item_id)
{
int pet_id = search_petDB_index(item_id, PET_EGG);
if (pet_id < 0) return 0; //No pet egg here.
- if (!pc_inventoryblank(sd)) return 0; // Inventory full
+ if (!iPc->inventoryblank(sd)) return 0; // Inventory full
sd->catch_target_class = pet_db[pet_id].class_;
intif_create_pet(sd->status.account_id, sd->status.char_id,
(short)pet_db[pet_id].class_,
@@ -106,7 +106,7 @@ int pet_attackskill(struct pet_data *pd, int target_id)
(battle_config.pet_equip_required && !pd->pet.equip))
return 0;
- if (DIFF_TICK(pd->ud.canact_tick, gettick()) > 0)
+ if (DIFF_TICK(pd->ud.canact_tick, iTimer->gettick()) > 0)
return 0;
if (rnd()%100 < (pd->a_skill->rate +pd->pet.intimate*pd->a_skill->bonusrate/1000))
@@ -114,7 +114,7 @@ int pet_attackskill(struct pet_data *pd, int target_id)
int inf;
struct block_list *bl;
- bl=map_id2bl(target_id);
+ bl=iMap->id2bl(target_id);
if(bl == NULL || pd->bl.m != bl->m || bl->prev == NULL || status_isdead(bl) ||
!check_distance_bl(&pd->bl, bl, pd->db->range3))
return 0;
@@ -187,7 +187,7 @@ int pet_sc_check(struct map_session_data *sd, int type)
|| pd->recovery->type != type )
return 1;
- pd->recovery->timer = add_timer(gettick()+pd->recovery->delay*1000,pet_recovery_timer,sd->bl.id,0);
+ pd->recovery->timer = iTimer->add_timer(iTimer->gettick()+pd->recovery->delay*1000,pet_recovery_timer,sd->bl.id,0);
return 0;
}
@@ -198,7 +198,7 @@ static int pet_hungry(int tid, unsigned int tick, int id, intptr_t data)
struct pet_data *pd;
int interval;
- sd=map_id2sd(id);
+ sd=iMap->id2sd(id);
if(!sd)
return 1;
@@ -237,7 +237,7 @@ static int pet_hungry(int tid, unsigned int tick, int id, intptr_t data)
interval = pd->petDB->hungry_delay;
if(interval <= 0)
interval = 1;
- pd->pet_hungry_timer = add_timer(tick+interval,pet_hungry,sd->bl.id,0);
+ pd->pet_hungry_timer = iTimer->add_timer(tick+interval,pet_hungry,sd->bl.id,0);
return 0;
}
@@ -267,7 +267,7 @@ int pet_hungry_timer_delete(struct pet_data *pd)
{
nullpo_ret(pd);
if(pd->pet_hungry_timer != INVALID_TIMER) {
- delete_timer(pd->pet_hungry_timer,pet_hungry);
+ iTimer->delete_timer(pd->pet_hungry_timer,pet_hungry);
pd->pet_hungry_timer = INVALID_TIMER;
}
@@ -304,9 +304,9 @@ static int pet_return_egg(struct map_session_data *sd, struct pet_data *pd)
tmp_item.card[1] = GetWord(pd->pet.pet_id,0);
tmp_item.card[2] = GetWord(pd->pet.pet_id,1);
tmp_item.card[3] = pd->pet.rename_flag;
- if((flag = pc_additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
+ if((flag = iPc->additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
clif->additem(sd,0,0,flag);
- map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
pd->pet.incuvate = 1;
unit_free(&pd->bl,CLR_OUTSIGHT);
@@ -366,10 +366,10 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *pet)
pd->bl.x = pd->ud.to_x;
pd->bl.y = pd->ud.to_y;
- map_addiddb(&pd->bl);
+ iMap->addiddb(&pd->bl);
status_calc_pet(pd,1);
- pd->last_thinktime = gettick();
+ pd->last_thinktime = iTimer->gettick();
pd->state.skillbonus = 0;
if( battle_config.pet_status_support )
run_script(pet_db[i].pet_script,0,sd->bl.id,0);
@@ -382,7 +382,7 @@ int pet_data_init(struct map_session_data *sd, struct s_pet *pet)
interval = pd->petDB->hungry_delay;
if( interval <= 0 )
interval = 1;
- pd->pet_hungry_timer = add_timer(gettick() + interval, pet_hungry, sd->bl.id, 0);
+ pd->pet_hungry_timer = iTimer->add_timer(iTimer->gettick() + interval, pet_hungry, sd->bl.id, 0);
return 0;
}
@@ -407,11 +407,11 @@ int pet_birth_process(struct map_session_data *sd, struct s_pet *pet)
}
intif_save_petdata(sd->status.account_id,pet);
- if (save_settings&8)
+ if (iMap->save_settings&8)
chrif_save(sd,0); //is it REALLY Needed to save the char for hatching a pet? [Skotlex]
if(sd->bl.prev != NULL) {
- map_addblock(&sd->pd->bl);
+ iMap->addblock(&sd->pd->bl);
clif->spawn(&sd->pd->bl);
clif->send_petdata(sd,sd->pd, 0,0);
clif->send_petdata(sd,sd->pd, 5,battle_config.pet_hair_style);
@@ -427,7 +427,7 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag)
{
struct map_session_data *sd;
- sd = map_id2sd(account_id);
+ sd = iMap->id2sd(account_id);
if(sd == NULL)
return 1;
if(flag == 1) {
@@ -448,11 +448,11 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag)
return 1;
}
if (!pet_birth_process(sd,p)) //Pet hatched. Delete egg.
- pc_delitem(sd,i,1,0,0,LOG_TYPE_OTHER);
+ iPc->delitem(sd,i,1,0,0,LOG_TYPE_OTHER);
} else {
pet_data_init(sd,p);
if(sd->pd && sd->bl.prev != NULL) {
- map_addblock(&sd->pd->bl);
+ iMap->addblock(&sd->pd->bl);
clif->spawn(&sd->pd->bl);
clif->send_petdata(sd,sd->pd,0,0);
clif->send_petdata(sd,sd->pd,5,battle_config.pet_hair_style);
@@ -496,7 +496,7 @@ int pet_catch_process2(struct map_session_data* sd, int target_id)
nullpo_retr(1, sd);
- md = (struct mob_data*)map_id2bl(target_id);
+ md = (struct mob_data*)iMap->id2bl(target_id);
if(!md || md->bl.type != BL_MOB || md->bl.prev == NULL)
{ // Invalid inputs/state, abort capture.
clif->pet_roulette(sd,0);
@@ -550,7 +550,7 @@ int pet_get_egg(int account_id,int pet_id,int flag)
if(flag)
return 0;
- sd = map_id2sd(account_id);
+ sd = iMap->id2sd(account_id);
if(sd == NULL)
return 0;
@@ -569,9 +569,9 @@ int pet_get_egg(int account_id,int pet_id,int flag)
tmp_item.card[1] = GetWord(pet_id,0);
tmp_item.card[2] = GetWord(pet_id,1);
tmp_item.card[3] = 0; //New pets are not named.
- if((ret = pc_additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER))) {
+ if((ret = iPc->additem(sd,&tmp_item,1,LOG_TYPE_PICKDROP_PLAYER))) {
clif->additem(sd,0,0,ret);
- map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
return 1;
@@ -594,7 +594,7 @@ int pet_menu(struct map_session_data *sd,int menunum)
egg_id = itemdb_exists(sd->pd->petDB->EggID);
if (egg_id) {
- if ((egg_id->flag.trade_restriction&0x01) && !pc_inventoryblank(sd)) {
+ if ((egg_id->flag.trade_restriction&0x01) && !iPc->inventoryblank(sd)) {
clif->message(sd->fd, msg_txt(451)); // You can't return your pet because your inventory is full.
return 1;
}
@@ -674,22 +674,22 @@ int pet_equipitem(struct map_session_data *sd,int index)
return 1;
}
- pc_delitem(sd,index,1,0,0,LOG_TYPE_OTHER);
+ iPc->delitem(sd,index,1,0,0,LOG_TYPE_OTHER);
pd->pet.equip = nameid;
status_set_viewdata(&pd->bl, pd->pet.class_); //Updates view_data.
clif->send_petdata(NULL, sd->pd, 3, sd->pd->vd.head_bottom);
if (battle_config.pet_equip_required)
{ //Skotlex: start support timers if need
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
if (pd->s_skill && pd->s_skill->timer == INVALID_TIMER)
{
if (pd->s_skill->id)
- pd->s_skill->timer=add_timer(tick+pd->s_skill->delay*1000, pet_skill_support_timer, sd->bl.id, 0);
+ pd->s_skill->timer=iTimer->add_timer(tick+pd->s_skill->delay*1000, pet_skill_support_timer, sd->bl.id, 0);
else
- pd->s_skill->timer=add_timer(tick+pd->s_skill->delay*1000, pet_heal_timer, sd->bl.id, 0);
+ pd->s_skill->timer=iTimer->add_timer(tick+pd->s_skill->delay*1000, pet_heal_timer, sd->bl.id, 0);
}
if (pd->bonus && pd->bonus->timer == INVALID_TIMER)
- pd->bonus->timer=add_timer(tick+pd->bonus->delay*1000, pet_skill_bonus_timer, sd->bl.id, 0);
+ pd->bonus->timer=iTimer->add_timer(tick+pd->bonus->delay*1000, pet_skill_bonus_timer, sd->bl.id, 0);
}
return 0;
@@ -710,9 +710,9 @@ static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = nameid;
tmp_item.identify = 1;
- if((flag = pc_additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
+ if((flag = iPc->additem(sd,&tmp_item,1,LOG_TYPE_OTHER))) {
clif->additem(sd,0,0,flag);
- map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
if( battle_config.pet_equip_required )
{ // Skotlex: halt support timers if needed
@@ -724,14 +724,14 @@ static int pet_unequipitem(struct map_session_data *sd, struct pet_data *pd)
if( pd->s_skill && pd->s_skill->timer != INVALID_TIMER )
{
if( pd->s_skill->id )
- delete_timer(pd->s_skill->timer, pet_skill_support_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_skill_support_timer);
else
- delete_timer(pd->s_skill->timer, pet_heal_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_heal_timer);
pd->s_skill->timer = INVALID_TIMER;
}
if( pd->bonus && pd->bonus->timer != INVALID_TIMER )
{
- delete_timer(pd->bonus->timer, pet_skill_bonus_timer);
+ iTimer->delete_timer(pd->bonus->timer, pet_skill_bonus_timer);
pd->bonus->timer = INVALID_TIMER;
}
}
@@ -744,12 +744,12 @@ static int pet_food(struct map_session_data *sd, struct pet_data *pd)
int i,k;
k=pd->petDB->FoodID;
- i=pc_search_inventory(sd,k);
+ i=iPc->search_inventory(sd,k);
if(i < 0) {
clif->pet_food(sd,k,0);
return 1;
}
- pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
+ iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
if( pd->pet.hungry > 90 )
pet_set_intimate(pd, pd->pet.intimate - pd->petDB->r_full);
@@ -801,7 +801,7 @@ static int pet_randomwalk(struct pet_data *pd,unsigned int tick)
int r=rnd();
x=pd->bl.x+r%(d*2+1)-d;
y=pd->bl.y+r/(d*2+1)%(d*2+1)-d;
- if(map_getcell(pd->bl.m,x,y,CELL_CHKPASS) && unit_walktoxy(&pd->bl,x,y,0)){
+ if(iMap->getcell(pd->bl.m,x,y,CELL_CHKPASS) && unit_walktoxy(&pd->bl,x,y,0)){
pd->move_fail_count=0;
break;
}
@@ -876,7 +876,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
}
if (pd->target_id) {
- target= map_id2bl(pd->target_id);
+ target= iMap->id2bl(pd->target_id);
if (!target || pd->bl.m != target->m || status_isdead(target) ||
!check_distance_bl(&pd->bl, target, pd->db->range3))
{
@@ -887,7 +887,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
if(!target && pd->loot && pd->msd && pc_has_permission(pd->msd, PC_PERM_TRADE) && pd->loot->count < pd->loot->max && DIFF_TICK(tick,pd->ud.canact_tick)>0) {
//Use half the pet's range of sight.
- map_foreachinrange(pet_ai_sub_hard_lootsearch,&pd->bl,
+ iMap->foreachinrange(pet_ai_sub_hard_lootsearch,&pd->bl,
pd->db->range2/2, BL_ITEM,pd,&target);
}
@@ -931,7 +931,7 @@ static int pet_ai_sub_hard(struct pet_data *pd, struct map_session_data *sd, uns
if(pd->loot->count < pd->loot->max){
memcpy(&pd->loot->item[pd->loot->count++],&fitem->item_data,sizeof(pd->loot->item[0]));
pd->loot->weight += itemdb_weight(fitem->item_data.nameid)*fitem->item_data.amount;
- map_clearflooritem(target);
+ iMap->clearflooritem(target);
}
//Target is unlocked regardless of whether it was picked or not.
pet_unlocktarget(pd);
@@ -951,7 +951,7 @@ static int pet_ai_sub_foreachclient(struct map_session_data *sd,va_list ap)
static int pet_ai_hard(int tid, unsigned int tick, int id, intptr_t data)
{
- map_foreachpc(pet_ai_sub_foreachclient,tick);
+ iMap->map_foreachpc(pet_ai_sub_foreachclient,tick);
return 0;
}
@@ -990,7 +990,7 @@ static int pet_delay_item_drop(int tid, unsigned int tick, int id, intptr_t data
list=(struct item_drop_list *)data;
ditem = list->item;
while (ditem) {
- map_addflooritem(&ditem->item_data,ditem->item_data.amount,
+ iMap->addflooritem(&ditem->item_data,ditem->item_data.amount,
list->m,list->x,list->y,
list->first_charid,list->second_charid,list->third_charid,0);
ditem_prev = ditem;
@@ -1021,7 +1021,7 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
for(i=0;i<pd->loot->count;i++) {
it = &pd->loot->item[i];
if(sd){
- if((flag = pc_additem(sd,it,it->amount,LOG_TYPE_PICKDROP_PLAYER))){
+ if((flag = iPc->additem(sd,it,it->amount,LOG_TYPE_PICKDROP_PLAYER))){
clif->additem(sd,0,0,flag);
ditem = ers_alloc(item_drop_ers, struct item_drop);
memcpy(&ditem->item_data, it, sizeof(struct item));
@@ -1040,10 +1040,10 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
memset(pd->loot->item,0,pd->loot->max * sizeof(struct item));
pd->loot->count = 0;
pd->loot->weight = 0;
- pd->ud.canact_tick = gettick()+10000; //prevent picked up during 10*1000ms
+ pd->ud.canact_tick = iTimer->gettick()+10000; //prevent picked up during 10*1000ms
if (dlist->item)
- add_timer(gettick()+540,pet_delay_item_drop,0,(intptr_t)dlist);
+ iTimer->add_timer(iTimer->gettick()+540,pet_delay_item_drop,0,(intptr_t)dlist);
else
ers_free(item_drop_list_ers, dlist);
return 1;
@@ -1054,7 +1054,7 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd)
*------------------------------------------*/
int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data)
{
- struct map_session_data *sd=map_id2sd(id);
+ struct map_session_data *sd=iMap->id2sd(id);
struct pet_data *pd;
int bonus;
int timer = 0;
@@ -1087,7 +1087,7 @@ int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data)
status_calc_pc(sd, 0);
}
// wait for the next timer
- pd->bonus->timer=add_timer(tick+timer,pet_skill_bonus_timer,sd->bl.id,0);
+ pd->bonus->timer=iTimer->add_timer(tick+timer,pet_skill_bonus_timer,sd->bl.id,0);
return 0;
}
@@ -1096,7 +1096,7 @@ int pet_skill_bonus_timer(int tid, unsigned int tick, int id, intptr_t data)
*------------------------------------------*/
int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data)
{
- struct map_session_data *sd=map_id2sd(id);
+ struct map_session_data *sd=iMap->id2sd(id);
struct pet_data *pd;
if(sd==NULL || sd->pd == NULL || sd->pd->recovery == NULL)
@@ -1124,7 +1124,7 @@ int pet_recovery_timer(int tid, unsigned int tick, int id, intptr_t data)
int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
{
- struct map_session_data *sd=map_id2sd(id);
+ struct map_session_data *sd=iMap->id2sd(id);
struct status_data *status;
struct pet_data *pd;
unsigned int rate = 100;
@@ -1146,14 +1146,14 @@ int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
(rate = get_percentage(status->hp, status->max_hp)) > pd->s_skill->hp ||
(rate = (pd->ud.skilltimer != INVALID_TIMER)) //Another skill is in effect
) { //Wait (how long? 1 sec for every 10% of remaining)
- pd->s_skill->timer=add_timer(gettick()+(rate>10?rate:10)*100,pet_heal_timer,sd->bl.id,0);
+ pd->s_skill->timer=iTimer->add_timer(iTimer->gettick()+(rate>10?rate:10)*100,pet_heal_timer,sd->bl.id,0);
return 0;
}
pet_stop_attack(pd);
pet_stop_walking(pd,1);
clif->skill_nodamage(&pd->bl,&sd->bl,AL_HEAL,pd->s_skill->lv,1);
status_heal(&sd->bl, pd->s_skill->lv,0, 0);
- pd->s_skill->timer=add_timer(tick+pd->s_skill->delay*1000,pet_heal_timer,sd->bl.id,0);
+ pd->s_skill->timer=iTimer->add_timer(tick+pd->s_skill->delay*1000,pet_heal_timer,sd->bl.id,0);
return 0;
}
@@ -1162,7 +1162,7 @@ int pet_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
*------------------------------------------*/
int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
{
- struct map_session_data *sd=map_id2sd(id);
+ struct map_session_data *sd=iMap->id2sd(id);
struct pet_data *pd;
struct status_data *status;
short rate = 100;
@@ -1180,7 +1180,7 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
if (DIFF_TICK(pd->ud.canact_tick, tick) > 0)
{ //Wait until the pet can act again.
- pd->s_skill->timer=add_timer(pd->ud.canact_tick,pet_skill_support_timer,sd->bl.id,0);
+ pd->s_skill->timer=iTimer->add_timer(pd->ud.canact_tick,pet_skill_support_timer,sd->bl.id,0);
return 0;
}
@@ -1189,13 +1189,13 @@ int pet_skill_support_timer(int tid, unsigned int tick, int id, intptr_t data)
(rate = get_percentage(status->hp, status->max_hp)) > pd->s_skill->hp ||
(rate = (pd->ud.skilltimer != INVALID_TIMER)) //Another skill is in effect
) { //Wait (how long? 1 sec for every 10% of remaining)
- pd->s_skill->timer=add_timer(tick+(rate>10?rate:10)*100,pet_skill_support_timer,sd->bl.id,0);
+ pd->s_skill->timer=iTimer->add_timer(tick+(rate>10?rate:10)*100,pet_skill_support_timer,sd->bl.id,0);
return 0;
}
pet_stop_attack(pd);
pet_stop_walking(pd,1);
- pd->s_skill->timer=add_timer(tick+pd->s_skill->delay*1000,pet_skill_support_timer,sd->bl.id,0);
+ pd->s_skill->timer=iTimer->add_timer(tick+pd->s_skill->delay*1000,pet_skill_support_timer,sd->bl.id,0);
if (skill->get_inf(pd->s_skill->id) & INF_GROUND_SKILL)
unit_skilluse_pos(&pd->bl, sd->bl.x, sd->bl.y, pd->s_skill->id, pd->s_skill->lv);
else
@@ -1238,7 +1238,7 @@ int read_petdb()
char line[1024];
int lines, entries;
- sprintf(line, "%s/%s", db_path, filename[i]);
+ sprintf(line, "%s/%s", iMap->db_path, filename[i]);
fp=fopen(line,"r");
if( fp == NULL )
{
@@ -1363,14 +1363,14 @@ int do_init_pet(void)
item_drop_ers = ers_new(sizeof(struct item_drop),"pet.c::item_drop_ers",ERS_OPT_NONE);
item_drop_list_ers = ers_new(sizeof(struct item_drop_list),"pet.c::item_drop_list_ers",ERS_OPT_NONE);
- add_timer_func_list(pet_hungry,"pet_hungry");
- add_timer_func_list(pet_ai_hard,"pet_ai_hard");
- add_timer_func_list(pet_skill_bonus_timer,"pet_skill_bonus_timer"); // [Valaris]
- add_timer_func_list(pet_delay_item_drop,"pet_delay_item_drop");
- add_timer_func_list(pet_skill_support_timer, "pet_skill_support_timer"); // [Skotlex]
- add_timer_func_list(pet_recovery_timer,"pet_recovery_timer"); // [Valaris]
- add_timer_func_list(pet_heal_timer,"pet_heal_timer"); // [Valaris]
- add_timer_interval(gettick()+MIN_PETTHINKTIME,pet_ai_hard,0,0,MIN_PETTHINKTIME);
+ iTimer->add_timer_func_list(pet_hungry,"pet_hungry");
+ iTimer->add_timer_func_list(pet_ai_hard,"pet_ai_hard");
+ iTimer->add_timer_func_list(pet_skill_bonus_timer,"pet_skill_bonus_timer"); // [Valaris]
+ iTimer->add_timer_func_list(pet_delay_item_drop,"pet_delay_item_drop");
+ iTimer->add_timer_func_list(pet_skill_support_timer, "pet_skill_support_timer"); // [Skotlex]
+ iTimer->add_timer_func_list(pet_recovery_timer,"pet_recovery_timer"); // [Valaris]
+ iTimer->add_timer_func_list(pet_heal_timer,"pet_heal_timer"); // [Valaris]
+ iTimer->add_timer_interval(iTimer->gettick()+MIN_PETTHINKTIME,pet_ai_hard,0,0,MIN_PETTHINKTIME);
return 0;
}
diff --git a/src/map/quest.c b/src/map/quest.c
index 3ef162aaa..b56088886 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -99,7 +99,7 @@ int quest_add(TBL_PC * sd, int quest_id)
clif->quest_add(sd, &sd->quest_log[i], sd->quest_index[i]);
- if( save_settings&64 )
+ if( iMap->save_settings&64 )
chrif_save(sd,0);
return 0;
@@ -147,7 +147,7 @@ int quest_change(TBL_PC * sd, int qid1, int qid2)
clif->quest_delete(sd, qid1);
clif->quest_add(sd, &sd->quest_log[i], sd->quest_index[i]);
- if( save_settings&64 )
+ if( iMap->save_settings&64 )
chrif_save(sd,0);
return 0;
@@ -178,7 +178,7 @@ int quest_delete(TBL_PC * sd, int quest_id)
clif->quest_delete(sd, quest_id);
- if( save_settings&64 )
+ if( iMap->save_settings&64 )
chrif_save(sd,0);
return 0;
@@ -249,7 +249,7 @@ int quest_update_status(TBL_PC * sd, int quest_id, quest_state status) {
clif->quest_delete(sd, quest_id);
- if( save_settings&64 )
+ if( iMap->save_settings&64 )
chrif_save(sd,0);
return 0;
@@ -293,7 +293,7 @@ int quest_read_db(void) {
int i,j,k = 0;
char *str[20],*p,*np;
- sprintf(line, "%s/quest_db.txt", db_path);
+ sprintf(line, "%s/quest_db.txt", iMap->db_path);
if( (fp=fopen(line,"r"))==NULL ){
ShowError("can't read %s\n", line);
return -1;
@@ -302,7 +302,7 @@ int quest_read_db(void) {
while(fgets(line, sizeof(line), fp)) {
if (k == MAX_QUEST_DB) {
- ShowError("quest_read_db: Too many entries specified in %s/quest_db.txt!\n", db_path);
+ ShowError("quest_read_db: Too many entries specified in %s/quest_db.txt!\n", iMap->db_path);
break;
}
diff --git a/src/map/script.c b/src/map/script.c
index 41f8e7472..9569e526d 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -363,7 +363,7 @@ static void script_reportsrc(struct script_state *st)
if( st->oid == 0 )
return; //Can't report source.
- bl = map_id2bl(st->oid);
+ bl = iMap->id2bl(st->oid);
if( bl == NULL )
return;
@@ -816,10 +816,12 @@ const char* parse_callfunc(const char* p, int require_paren, int is_custom)
func = add_word(p);
if( str_data[func].type == C_FUNC ){
+ char argT = 0;
// buildin function
add_scriptl(func);
add_scriptc(C_ARG);
arg = script->buildin[str_data[func].val];
+ if( !arg ) arg = &argT;
} else if( str_data[func].type == C_USERFUNC || str_data[func].type == C_USERFUNC_POS ){
// script defined function
add_scriptl(buildin_callsub_ref);
@@ -2011,7 +2013,7 @@ static void read_constdb(void)
char line[1024],name[1024],val[1024];
int type;
- sprintf(line, "%s/const.txt", db_path);
+ sprintf(line, "%s/const.txt", iMap->db_path);
fp=fopen(line, "r");
if(fp==NULL){
ShowError("can't read %s\n", line);
@@ -2276,10 +2278,9 @@ struct script_code* parse_script(const char *src,const char *file,int line,int o
/// Returns the player attached to this script, identified by the rid.
/// If there is no player attached, the script is terminated.
-TBL_PC *script_rid2sd(struct script_state *st)
-{
- TBL_PC *sd=map_id2sd(st->rid);
- if(!sd){
+TBL_PC *script_rid2sd(struct script_state *st) {
+ TBL_PC *sd;
+ if( !( sd = iMap->id2sd(st->rid) ) ){
ShowError("script_rid2sd: fatal error ! player not attached!\n");
script_reportfunc(st);
script_reportsrc(st);
@@ -2334,7 +2335,7 @@ void get_val(struct script_state* st, struct script_data* data)
switch( prefix )
{
case '@':
- data->u.str = pc_readregstr(sd, data->u.num);
+ data->u.str = iPc->readregstr(sd, data->u.num);
break;
case '$':
data->u.str = mapreg_readregstr(data->u.num);
@@ -2358,8 +2359,8 @@ void get_val(struct script_state* st, struct script_data* data)
}
break;
case '\'':
- if (st->instance_id) {
- data->u.str = (char*)idb_get(instance[st->instance_id].vars,reference_getuid(data));
+ if ( st->instance_id >= 0 ) {
+ data->u.str = (char*)idb_get(instances[st->instance_id].vars,reference_getuid(data));
} else {
ShowWarning("script:get_val: cannot access instance variable '%s', defaulting to \"\"\n", name);
data->u.str = NULL;
@@ -2393,13 +2394,13 @@ void get_val(struct script_state* st, struct script_data* data)
}
else if( reference_toparam(data) )
{
- data->u.num = pc_readparam(sd, reference_getparamtype(data));
+ data->u.num = iPc->readparam(sd, reference_getparamtype(data));
}
else
switch( prefix )
{
case '@':
- data->u.num = pc_readreg(sd, data->u.num);
+ data->u.num = iPc->readreg(sd, data->u.num);
break;
case '$':
data->u.num = mapreg_readreg(data->u.num);
@@ -2423,8 +2424,8 @@ void get_val(struct script_state* st, struct script_data* data)
}
break;
case '\'':
- if( st->instance_id )
- data->u.num = (int)idb_iget(instance[st->instance_id].vars,reference_getuid(data));
+ if( st->instance_id >= 0 )
+ data->u.num = (int)idb_iget(instances[st->instance_id].vars,reference_getuid(data));
else {
ShowWarning("script:get_val: cannot access instance variable '%s', defaulting to 0\n", name);
data->u.num = 0;
@@ -2466,7 +2467,7 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
const char* str = (const char*)value;
switch (prefix) {
case '@':
- return pc_setregstr(sd, num, str);
+ return iPc->setregstr(sd, num, str);
case '$':
return mapreg_setregstr(num, str);
case '#':
@@ -2484,9 +2485,9 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
}
return 1;
case '\'':
- if( st->instance_id ) {
- idb_remove(instance[st->instance_id].vars, num);
- if( str[0] ) idb_put(instance[st->instance_id].vars, num, aStrdup(str));
+ if( st->instance_id >= 0 ) {
+ idb_remove(instances[st->instance_id].vars, num);
+ if( str[0] ) idb_put(instances[st->instance_id].vars, num, aStrdup(str));
}
return 1;
default:
@@ -2498,7 +2499,7 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
int val = (int)__64BPTRSIZE(value);
if(str_data[num&0x00ffffff].type == C_PARAM)
{
- if( pc_setparam(sd, str_data[num&0x00ffffff].val, val) == 0 )
+ if( iPc->setparam(sd, str_data[num&0x00ffffff].val, val) == 0 )
{
if( st != NULL )
{
@@ -2513,7 +2514,7 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
switch (prefix) {
case '@':
- return pc_setreg(sd, num, val);
+ return iPc->setreg(sd, num, val);
case '$':
return mapreg_setreg(num, val);
case '#':
@@ -2532,10 +2533,10 @@ static int set_reg(struct script_state* st, TBL_PC* sd, int num, const char* nam
}
return 1;
case '\'':
- if( st->instance_id ) {
- idb_remove(instance[st->instance_id].vars, num);
+ if( st->instance_id >= 0 ) {
+ idb_remove(instances[st->instance_id].vars, num);
if( val != 0 )
- idb_iput(instance[st->instance_id].vars, num, val);
+ idb_iput(instances[st->instance_id].vars, num, val);
}
return 1;
default:
@@ -2830,7 +2831,7 @@ void script_free_state(struct script_state* st)
ShowDebug("script_free_state: Previous script state lost (rid=%d, oid=%d, state=%d, bk_npcid=%d).\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid);
}
if( st->sleep.timer != INVALID_TIMER )
- delete_timer(st->sleep.timer, run_script_timer);
+ iTimer->delete_timer(st->sleep.timer, run_script_timer);
script_free_vars(st->stack->var_function);
pop_stack(st, 0, st->stack->sp);
aFree(st->stack->stack_data);
@@ -3354,7 +3355,7 @@ int run_script_timer(int tid, unsigned int tick, int id, intptr_t data)
{
struct script_state *st = (struct script_state *)data;
struct linkdb_node *node = (struct linkdb_node *)sleep_db;
- TBL_PC *sd = map_id2sd(st->rid);
+ TBL_PC *sd = iMap->id2sd(st->rid);
if((sd && sd->status.char_id != id) || (st->rid && !sd))
{ //Character mismatch. Cancel execution.
@@ -3383,9 +3384,10 @@ static void script_detach_state(struct script_state* st, bool dequeue_event)
{
struct map_session_data* sd;
- if(st->rid && (sd = map_id2sd(st->rid))!=NULL) {
+ if(st->rid && (sd = iMap->id2sd(st->rid))!=NULL) {
sd->st = st->bk_st;
sd->npc_id = st->bk_npcid;
+ sd->state.dialog = 0;
if(st->bk_st) {
//Remove tag for removal.
st->bk_st = NULL;
@@ -3405,9 +3407,7 @@ static void script_detach_state(struct script_state* st, bool dequeue_event)
#endif
npc_event_dequeue(sd);
}
- }
- else if(st->bk_st)
- {// rid was set to 0, before detaching the script state
+ } else if(st->bk_st) { // rid was set to 0, before detaching the script state
ShowError("script_detach_state: Found previous script state without attached player (rid=%d, oid=%d, state=%d, bk_npcid=%d)\n", st->bk_st->rid, st->bk_st->oid, st->bk_st->state, st->bk_npcid);
script_reportsrc(st->bk_st);
@@ -3423,7 +3423,7 @@ static void script_attach_state(struct script_state* st)
{
struct map_session_data* sd;
- if(st->rid && (sd = map_id2sd(st->rid))!=NULL)
+ if(st->rid && (sd = iMap->id2sd(st->rid))!=NULL)
{
if(st!=sd->st)
{
@@ -3461,9 +3461,11 @@ void run_script_main(struct script_state *st)
script_attach_state(st);
- nd = map_id2nd(st->oid);
- if( nd && map[nd->bl.m].instance_id > 0 )
+ nd = iMap->id2nd(st->oid);
+ if( nd && nd->bl.m >= 0 )
st->instance_id = map[nd->bl.m].instance_id;
+ else
+ st->instance_id = -1;
if(st->state == RERUNLINE) {
run_func(st);
@@ -3564,9 +3566,9 @@ void run_script_main(struct script_state *st)
//Restore previous script
script_detach_state(st, false);
//Delay execution
- sd = map_id2sd(st->rid); // Get sd since script might have attached someone while running. [Inkfish]
+ sd = iMap->id2sd(st->rid); // Get sd since script might have attached someone while running. [Inkfish]
st->sleep.charid = sd?sd->status.char_id:0;
- st->sleep.timer = add_timer(gettick()+st->sleep.tick,
+ st->sleep.timer = iTimer->add_timer(iTimer->gettick()+st->sleep.tick,
run_script_timer, st->sleep.charid, (intptr_t)st);
linkdb_insert(&sleep_db, (void*)__64BPTRSIZE(st->oid), st);
}
@@ -3585,8 +3587,7 @@ void run_script_main(struct script_state *st)
}
} else {
//Dispose of script.
- if ((sd = map_id2sd(st->rid))!=NULL)
- { //Restore previous stack and save char.
+ if ((sd = iMap->id2sd(st->rid))!=NULL) { //Restore previous stack and save char.
if(sd->state.using_fake_npc){
clif->clearunit_single(sd->npc_id, CLR_OUTSIGHT, sd->fd);
sd->state.using_fake_npc = 0;
@@ -3658,7 +3659,7 @@ int script_config_read(char *cfgName)
*/
static int db_script_free_code_sub(DBKey key, DBData *data, va_list ap)
{
- struct script_code *code = DB->data2ptr(data);
+ struct script_code *code = iDB->data2ptr(data);
if (code)
script_free_code(code);
return 0;
@@ -3705,14 +3706,14 @@ void script_cleararray_pc(struct map_session_data* sd, const char* varname, void
{
for( idx = 0; idx < SCRIPT_MAX_ARRAYSIZE; idx++ )
{
- pc_setregstr(sd, reference_uid(key, idx), (const char*)value);
+ iPc->setregstr(sd, reference_uid(key, idx), (const char*)value);
}
}
else
{
for( idx = 0; idx < SCRIPT_MAX_ARRAYSIZE; idx++ )
{
- pc_setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
+ iPc->setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
}
}
}
@@ -3740,11 +3741,11 @@ void script_setarray_pc(struct map_session_data* sd, const char* varname, uint8
if( is_string_variable(varname) )
{
- pc_setregstr(sd, reference_uid(key, idx), (const char*)value);
+ iPc->setregstr(sd, reference_uid(key, idx), (const char*)value);
}
else
{
- pc_setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
+ iPc->setreg(sd, reference_uid(key, idx), (int)__64BPTRSIZE(value));
}
if( refcache )
@@ -3845,9 +3846,25 @@ void do_final_script(void) {
script->buildin[i] = NULL;
}
}
-
- aFree(script->buildin);
+ aFree(script->buildin);
+
+ if( script->hqs ) {
+ for( i = 0; i < script->hqs; i++ ) {
+ if( script->hq[i].item != NULL )
+ aFree(script->hq[i].item);
+ }
+ }
+ if( script->hqis ) {
+ for( i = 0; i < script->hqis; i++ ) {
+ if( script->hqi[i].item != NULL )
+ aFree(script->hqi[i].item);
+ }
+ }
+ if( script->hq != NULL )
+ aFree(script->hq);
+ if( script->hqi != NULL )
+ aFree(script->hqi);
}
/*==========================================
* Initialization
@@ -3904,22 +3921,17 @@ int script_reload() {
/// If a dialog doesn't exist yet, one is created.
///
/// mes "<message>";
-BUILDIN(mes)
-{
+BUILDIN(mes) {
TBL_PC* sd = script_rid2sd(st);
if( sd == NULL )
return true;
- if( !script_hasdata(st, 3) )
- {// only a single line detected in the script
+ if( !script_hasdata(st, 3) ) {// only a single line detected in the script
clif->scriptmes(sd, st->oid, script_getstr(st, 2));
- }
- else
- {// parse multiple lines as they exist
+ } else {// parse multiple lines as they exist
int i;
- for( i = 2; script_hasdata(st, i); i++ )
- {
+ for( i = 2; script_hasdata(st, i); i++ ) {
// send the message to the client
clif->scriptmes(sd, st->oid, script_getstr(st, i));
}
@@ -3951,15 +3963,14 @@ BUILDIN(next)
/// The dialog is closed when the button is pressed.
///
/// close;
-BUILDIN(close)
-{
+BUILDIN(close) {
TBL_PC* sd;
sd = script_rid2sd(st);
if( sd == NULL )
return true;
- st->state = CLOSE;
+ st->state = sd->state.dialog == 1 ? CLOSE : END;
clif->scriptclose(sd, st->oid);
return true;
}
@@ -3968,8 +3979,7 @@ BUILDIN(close)
/// The dialog is closed and the script continues when the button is pressed.
///
/// close2;
-BUILDIN(close2)
-{
+BUILDIN(close2) {
TBL_PC* sd;
sd = script_rid2sd(st);
@@ -4093,7 +4103,7 @@ BUILDIN(menu)
* menus beyond this length crash the client (see bugreport:6402)
**/
if( StrBuf->Length(&buf) >= 2047 ) {
- struct npc_data * nd = map_id2nd(st->oid);
+ struct npc_data * nd = iMap->id2nd(st->oid);
char* menu;
CREATE(menu, char, 2048);
safestrncpy(menu, StrBuf->Value(&buf), 2047);
@@ -4149,7 +4159,7 @@ BUILDIN(menu)
st->state = END;
return false;
}
- pc_setreg(sd, add_str("@menu"), menu);
+ iPc->setreg(sd, add_str("@menu"), menu);
st->pos = script_getnum(st, i + 1);
st->state = GOTO;
}
@@ -4198,7 +4208,7 @@ BUILDIN(select)
* menus beyond this length crash the client (see bugreport:6402)
**/
if( StrBuf->Length(&buf) >= 2047 ) {
- struct npc_data * nd = map_id2nd(st->oid);
+ struct npc_data * nd = iMap->id2nd(st->oid);
char* menu;
CREATE(menu, char, 2048);
safestrncpy(menu, StrBuf->Value(&buf), 2047);
@@ -4226,7 +4236,7 @@ BUILDIN(select)
if( sd->npc_menu <= 0 )
break;// entry found
}
- pc_setreg(sd, add_str("@menu"), menu);
+ iPc->setreg(sd, add_str("@menu"), menu);
script_pushint(st, menu);
st->state = RUN;
}
@@ -4277,7 +4287,7 @@ BUILDIN(prompt)
* menus beyond this length crash the client (see bugreport:6402)
**/
if( StrBuf->Length(&buf) >= 2047 ) {
- struct npc_data * nd = map_id2nd(st->oid);
+ struct npc_data * nd = iMap->id2nd(st->oid);
char* menu;
CREATE(menu, char, 2048);
safestrncpy(menu, StrBuf->Value(&buf), 2047);
@@ -4297,7 +4307,7 @@ BUILDIN(prompt)
else if( sd->npc_menu == 0xff )
{// Cancel was pressed
sd->state.menu_or_input = 0;
- pc_setreg(sd, add_str("@menu"), 0xff);
+ iPc->setreg(sd, add_str("@menu"), 0xff);
script_pushint(st, 0xff);
st->state = RUN;
}
@@ -4313,7 +4323,7 @@ BUILDIN(prompt)
if( sd->npc_menu <= 0 )
break;// entry found
}
- pc_setreg(sd, add_str("@menu"), menu);
+ iPc->setreg(sd, add_str("@menu"), menu);
script_pushint(st, menu);
st->state = RUN;
}
@@ -4559,11 +4569,11 @@ BUILDIN(warp)
y = script_getnum(st,4);
if(strcmp(str,"Random")==0)
- ret = pc_randomwarp(sd,CLR_TELEPORT);
+ ret = iPc->randomwarp(sd,CLR_TELEPORT);
else if(strcmp(str,"SavePoint")==0 || strcmp(str,"Save")==0)
- ret = pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ ret = iPc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
else
- ret = pc_setpos(sd,mapindex_name2id(str),x,y,CLR_OUTSIGHT);
+ ret = iPc->setpos(sd,mapindex_name2id(str),x,y,CLR_OUTSIGHT);
if( ret ) {
ShowError("buildin_warp: moving player '%s' to \"%s\",%d,%d failed.\n", sd->status.name, str, x, y);
@@ -4587,7 +4597,7 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
y3 = va_arg(ap,int);
if(index == 0)
- pc_randomwarp((TBL_PC *)bl,CLR_TELEPORT);
+ iPc->randomwarp((TBL_PC *)bl,CLR_TELEPORT);
else if(x3 && y3) {
int max, tx, ty, j = 0;
@@ -4600,12 +4610,12 @@ static int buildin_areawarp_sub(struct block_list *bl,va_list ap)
tx = rnd()%(x3-x2+1)+x2;
ty = rnd()%(y3-y2+1)+y2;
j++;
- } while( map_getcell(index,tx,ty,CELL_CHKNOPASS) && j < max );
+ } while( iMap->getcell(index,tx,ty,CELL_CHKNOPASS) && j < max );
- pc_setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
+ iPc->setpos((TBL_PC *)bl,index,tx,ty,CLR_OUTSIGHT);
}
else
- pc_setpos((TBL_PC *)bl,index,x2,y2,CLR_OUTSIGHT);
+ iPc->setpos((TBL_PC *)bl,index,x2,y2,CLR_OUTSIGHT);
return 0;
}
BUILDIN(areawarp)
@@ -4635,7 +4645,7 @@ BUILDIN(areawarp)
}
}
- if( (m = map_mapname2mapid(mapname)) < 0 )
+ if( (m = iMap->mapname2mapid(mapname)) < 0 )
return true;
if( strcmp(str,"Random") == 0 )
@@ -4643,7 +4653,7 @@ BUILDIN(areawarp)
else if( !(index=mapindex_name2id(str)) )
return true;
- map_foreachinarea(buildin_areawarp_sub, m,x0,y0,x1,y1, BL_PC, index,x2,y2,x3,y3);
+ iMap->foreachinarea(buildin_areawarp_sub, m,x0,y0,x1,y1, BL_PC, index,x2,y2,x3,y3);
return true;
}
@@ -4655,7 +4665,7 @@ static int buildin_areapercentheal_sub(struct block_list *bl,va_list ap)
int hp, sp;
hp = va_arg(ap, int);
sp = va_arg(ap, int);
- pc_percentheal((TBL_PC *)bl,hp,sp);
+ iPc->percentheal((TBL_PC *)bl,hp,sp);
return 0;
}
BUILDIN(areapercentheal)
@@ -4672,10 +4682,10 @@ BUILDIN(areapercentheal)
hp=script_getnum(st,7);
sp=script_getnum(st,8);
- if( (m=map_mapname2mapid(mapname))< 0)
+ if( (m=iMap->mapname2mapid(mapname))< 0)
return true;
- map_foreachinarea(buildin_areapercentheal_sub,m,x0,y0,x1,y1,BL_PC,hp,sp);
+ iMap->foreachinarea(buildin_areapercentheal_sub,m,x0,y0,x1,y1,BL_PC,hp,sp);
return true;
}
@@ -4696,17 +4706,17 @@ BUILDIN(warpchar)
y=script_getnum(st,4);
a=script_getnum(st,5);
- sd = map_charid2sd(a);
+ sd = iMap->charid2sd(a);
if( sd == NULL )
return true;
if(strcmp(str, "Random") == 0)
- pc_randomwarp(sd, CLR_TELEPORT);
+ iPc->randomwarp(sd, CLR_TELEPORT);
else
if(strcmp(str, "SavePoint") == 0)
- pc_setpos(sd, sd->status.save_point.map,sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
+ iPc->setpos(sd, sd->status.save_point.map,sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
else
- pc_setpos(sd, mapindex_name2id(str), x, y, CLR_TELEPORT);
+ iPc->setpos(sd, mapindex_name2id(str), x, y, CLR_TELEPORT);
return true;
}
@@ -4732,7 +4742,7 @@ BUILDIN(warpparty)
if ( script_hasdata(st,6) )
str2 = script_getstr(st,6);
- p = party_search(p_id);
+ p = iParty->search(p_id);
if(!p)
return true;
@@ -4780,20 +4790,20 @@ BUILDIN(warpparty)
{
case 0: // Random
if(!map[pl_sd->bl.m].flag.nowarp)
- pc_randomwarp(pl_sd,CLR_TELEPORT);
+ iPc->randomwarp(pl_sd,CLR_TELEPORT);
break;
case 1: // SavePointAll
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
break;
case 2: // SavePoint
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
case 3: // Leader
case 4: // m,x,y
if(!map[pl_sd->bl.m].flag.noreturn && !map[pl_sd->bl.m].flag.nowarp)
- pc_setpos(pl_sd,mapindex,x,y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,mapindex,x,y,CLR_TELEPORT);
break;
}
}
@@ -4841,19 +4851,19 @@ BUILDIN(warpguild)
{
case 0: // Random
if(!map[pl_sd->bl.m].flag.nowarp)
- pc_randomwarp(pl_sd,CLR_TELEPORT);
+ iPc->randomwarp(pl_sd,CLR_TELEPORT);
break;
case 1: // SavePointAll
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,pl_sd->status.save_point.map,pl_sd->status.save_point.x,pl_sd->status.save_point.y,CLR_TELEPORT);
break;
case 2: // SavePoint
if(!map[pl_sd->bl.m].flag.noreturn)
- pc_setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
case 3: // m,x,y
if(!map[pl_sd->bl.m].flag.noreturn && !map[pl_sd->bl.m].flag.nowarp)
- pc_setpos(pl_sd,mapindex_name2id(str),x,y,CLR_TELEPORT);
+ iPc->setpos(pl_sd,mapindex_name2id(str),x,y,CLR_TELEPORT);
break;
}
}
@@ -4896,7 +4906,7 @@ BUILDIN(itemheal)
sd = script_rid2sd(st);
if (!sd) return true;
- pc_itemheal(sd,sd->itemid,hp,sp);
+ iPc->itemheal(sd,sd->itemid,hp,sp);
return true;
}
/*==========================================
@@ -4923,7 +4933,7 @@ BUILDIN(percentheal)
if( sd->sc.data[SC_EXTREMITYFIST2] )
sp = 0;
#endif
- pc_percentheal(sd,hp,sp);
+ iPc->percentheal(sd,hp,sp);
return true;
}
@@ -4946,7 +4956,7 @@ BUILDIN(jobchange)
if( sd == NULL )
return true;
- pc_jobchange(sd, job, upper);
+ iPc->jobchange(sd, job, upper);
}
return true;
@@ -4958,7 +4968,7 @@ BUILDIN(jobchange)
BUILDIN(jobname)
{
int class_=script_getnum(st,2);
- script_pushconststr(st, (char*)job_name(class_));
+ script_pushconststr(st, (char*)iPc->job_name(class_));
return true;
}
@@ -5520,7 +5530,7 @@ BUILDIN(setlook)
if( sd == NULL )
return true;
- pc_changelook(sd,type,val);
+ iPc->changelook(sd,type,val);
return true;
}
@@ -5709,7 +5719,7 @@ BUILDIN(checkweight)
script_pushint(st,0);
return false;
}
- slots = pc_inventoryblank(sd); //nb of empty slot
+ slots = iPc->inventoryblank(sd); //nb of empty slot
for(i=2; i<nbargs; i=i+2){
data = script_getdata(st,i);
@@ -5740,7 +5750,7 @@ BUILDIN(checkweight)
return true;
}
- switch( pc_checkadditem(sd, nameid, amount) )
+ switch( iPc->checkadditem(sd, nameid, amount) )
{
case ADDITEM_EXIST:
// item is already in inventory, but there is still space for the requested amount
@@ -5823,7 +5833,7 @@ BUILDIN(checkweight2)
fail = 1;
}
- slots = pc_inventoryblank(sd);
+ slots = iPc->inventoryblank(sd);
for(i=0; i<nb_it; i++){
nameid = (int32)__64BPTRSIZE(get_val2(st,reference_uid(id_it,idx_it+i),reference_getref(data_it)));
script_removetop(st, -1, 0);
@@ -5846,7 +5856,7 @@ BUILDIN(checkweight2)
fail = 1;
continue;
}
- switch( pc_checkadditem(sd, nameid, amount) ) {
+ switch( iPc->checkadditem(sd, nameid, amount) ) {
case ADDITEM_EXIST:
// item is already in inventory, but there is still space for the requested amount
break;
@@ -5922,7 +5932,7 @@ BUILDIN(getitem)
it.identify=itemdb_isidentified2(item_data);
if( script_hasdata(st,4) )
- sd=map_id2sd(script_getnum(st,4)); // <Account ID>
+ sd=iMap->id2sd(script_getnum(st,4)); // <Account ID>
else
sd=script_rid2sd(st); // Attached player
@@ -5940,11 +5950,11 @@ BUILDIN(getitem)
// if not pet egg
if (!pet_create_egg(sd, nameid))
{
- if ((flag = pc_additem(sd, &it, get_count, LOG_TYPE_SCRIPT)))
+ if ((flag = iPc->additem(sd, &it, get_count, LOG_TYPE_SCRIPT)))
{
clif->additem(sd, 0, 0, flag);
- if( pc_candrop(sd,&it) )
- map_addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ if( iPc->candrop(sd,&it) )
+ iMap->addflooritem(&it,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -5965,7 +5975,7 @@ BUILDIN(getitem2)
struct script_data *data;
if( script_hasdata(st,11) )
- sd=map_id2sd(script_getnum(st,11)); // <Account ID>
+ sd=iMap->id2sd(script_getnum(st,11)); // <Account ID>
else
sd=script_rid2sd(st); // Attached player
@@ -6038,11 +6048,11 @@ BUILDIN(getitem2)
// if not pet egg
if (!pet_create_egg(sd, nameid))
{
- if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT)))
+ if ((flag = iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT)))
{
clif->additem(sd, 0, 0, flag);
- if( pc_candrop(sd,&item_tmp) )
- map_addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ if( iPc->candrop(sd,&item_tmp) )
+ iMap->addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -6101,7 +6111,7 @@ BUILDIN(rentitem)
it.identify = 1;
it.expire_time = (unsigned int)(time(NULL) + seconds);
- if( (flag = pc_additem(sd, &it, 1, LOG_TYPE_SCRIPT)) )
+ if( (flag = iPc->additem(sd, &it, 1, LOG_TYPE_SCRIPT)) )
{
clif->additem(sd, 0, 0, flag);
return false;
@@ -6153,9 +6163,9 @@ BUILDIN(getnameditem)
data=script_getdata(st,3);
get_val(st,data);
if( data_isstring(data) ) //Char Name
- tsd=map_nick2sd(script->conv_str(st,data));
+ tsd=iMap->nick2sd(script->conv_str(st,data));
else //Char Id was given
- tsd=map_charid2sd(script->conv_num(st,data));
+ tsd=iMap->charid2sd(script->conv_num(st,data));
if( tsd == NULL )
{ //Failed
@@ -6170,7 +6180,7 @@ BUILDIN(getnameditem)
item_tmp.card[0]=CARD0_CREATE; //we don't use 255! because for example SIGNED WEAPON shouldn't get TOP10 BS Fame bonus [Lupus]
item_tmp.card[2]=tsd->status.char_id;
item_tmp.card[3]=tsd->status.char_id >> 16;
- if(pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT)) {
+ if(iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT)) {
script_pushint(st,0);
return true; //Failed to add item, we will not drop if they don't fit
}
@@ -6231,7 +6241,7 @@ BUILDIN(makeitem)
if (!sd) return true; //Failed...
m=sd->bl.m;
} else
- m=map_mapname2mapid(mapname);
+ m=iMap->mapname2mapid(mapname);
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid=nameid;
@@ -6240,7 +6250,7 @@ BUILDIN(makeitem)
else
item_tmp.identify=itemdb_isidentified2(item_data);
- map_addflooritem(&item_tmp,amount,m,x,y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,amount,m,x,y,0,0,0,0);
return true;
}
@@ -6262,7 +6272,7 @@ static void buildin_delitem_delete(struct map_session_data* sd, int idx, int* am
{// delete associated pet
intif_delete_petdata(MakeDWord(inv->card[1], inv->card[2]));
}
- pc_delitem(sd, idx, delamount, 0, 0, LOG_TYPE_SCRIPT);
+ iPc->delitem(sd, idx, delamount, 0, 0, LOG_TYPE_SCRIPT);
}
amount[0]-= delamount;
@@ -6401,7 +6411,7 @@ BUILDIN(delitem)
if( script_hasdata(st,4) )
{
int account_id = script_getnum(st,4);
- sd = map_id2sd(account_id); // <account id>
+ sd = iMap->id2sd(account_id); // <account id>
if( sd == NULL )
{
ShowError("script:delitem: player not found (AID=%d).\n", account_id);
@@ -6470,7 +6480,7 @@ BUILDIN(delitem2)
if( script_hasdata(st,11) )
{
int account_id = script_getnum(st,11);
- sd = map_id2sd(account_id); // <account id>
+ sd = iMap->id2sd(account_id); // <account id>
if( sd == NULL )
{
ShowError("script:delitem2: player not found (AID=%d).\n", account_id);
@@ -6556,7 +6566,7 @@ BUILDIN(disableitemuse)
/*==========================================
* return the basic stats of sd
- * chk pc_readparam for available type
+ * chk iPc->readparam for available type
*------------------------------------------*/
BUILDIN(readparam)
{
@@ -6565,7 +6575,7 @@ BUILDIN(readparam)
type=script_getnum(st,2);
if( script_hasdata(st,3) )
- sd=map_nick2sd(script_getstr(st,3));
+ sd=iMap->nick2sd(script_getstr(st,3));
else
sd=script_rid2sd(st);
@@ -6574,7 +6584,7 @@ BUILDIN(readparam)
return true;
}
- script_pushint(st,pc_readparam(sd,type));
+ script_pushint(st,iPc->readparam(sd,type));
return true;
}
@@ -6595,7 +6605,7 @@ BUILDIN(getcharid)
num = script_getnum(st,2);
if( script_hasdata(st,3) )
- sd=map_nick2sd(script_getstr(st,3));
+ sd=iMap->nick2sd(script_getstr(st,3));
else
sd=script_rid2sd(st);
@@ -6660,7 +6670,7 @@ BUILDIN(getpartyname)
party_id = script_getnum(st,2);
- if( ( p = party_search(party_id) ) != NULL )
+ if( ( p = iParty->search(party_id) ) != NULL )
{
script_pushstrcopy(st,p->party.name);
}
@@ -6684,7 +6694,7 @@ BUILDIN(getpartymember)
struct party_data *p;
int i,j=0,type=0;
- p=party_search(script_getnum(st,2));
+ p=iParty->search(script_getnum(st,2));
if( script_hasdata(st,3) )
type=script_getnum(st,3);
@@ -6724,7 +6734,7 @@ BUILDIN(getpartyleader)
if( script_hasdata(st,3) )
type=script_getnum(st,3);
- p=party_search(party_id);
+ p=iParty->search(party_id);
if (p) //Search leader
for(i = 0; i < MAX_PARTY && !p->party.member[i].leader; i++);
@@ -6837,7 +6847,7 @@ BUILDIN(strcharinfo)
script_pushstrcopy(st,sd->status.name);
break;
case 1:
- if( ( p = party_search(sd->status.party_id) ) != NULL ) {
+ if( ( p = iParty->search(sd->status.party_id) ) != NULL ) {
script_pushstrcopy(st,p->party.name);
} else {
script_pushconststr(st,"");
@@ -6877,7 +6887,7 @@ BUILDIN(strnpcinfo)
int num;
char *buf,*name=NULL;
- nd = map_id2nd(st->oid);
+ nd = iMap->id2nd(st->oid);
if (!nd) {
script_pushconststr(st, "");
return true;
@@ -6941,7 +6951,7 @@ BUILDIN(getequipid)
}
// get inventory position of item
- i = pc_checkequip(sd,equip[num]);
+ i = iPc->checkequip(sd,equip[num]);
if( i < 0 )
{
script_pushint(st,-1);
@@ -6979,7 +6989,7 @@ BUILDIN(getequipname)
}
// get inventory position of item
- i = pc_checkequip(sd,equip[num]);
+ i = iPc->checkequip(sd,equip[num]);
if( i < 0 )
{
script_pushconststr(st,"");
@@ -7098,7 +7108,7 @@ BUILDIN(getequipisequiped)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0)
script_pushint(st,1);
@@ -7125,7 +7135,7 @@ BUILDIN(getequipisenableref)
return true;
if( num > 0 && num <= ARRAYLENGTH(equip) )
- i = pc_checkequip(sd,equip[num-1]);
+ i = iPc->checkequip(sd,equip[num-1]);
if( i >= 0 && sd->inventory_data[i] && !sd->inventory_data[i]->flag.no_refine && !sd->status.inventory[i].expire_time )
script_pushint(st,1);
else
@@ -7151,7 +7161,7 @@ BUILDIN(getequipisidentify)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0)
script_pushint(st,sd->status.inventory[i].identify);
else
@@ -7177,7 +7187,7 @@ BUILDIN(getequiprefinerycnt)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0)
script_pushint(st,sd->status.inventory[i].refine);
else
@@ -7204,7 +7214,7 @@ BUILDIN(getequipweaponlv)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0 && sd->inventory_data[i])
script_pushint(st,sd->inventory_data[i]->wlv);
else
@@ -7230,7 +7240,7 @@ BUILDIN(getequippercentrefinery)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0 && sd->status.inventory[i].nameid && sd->status.inventory[i].refine < MAX_REFINE)
script_pushint(st,status_get_refine_chance(itemdb_wlv(sd->status.inventory[i].nameid), (int)sd->status.inventory[i].refine));
else
@@ -7253,7 +7263,7 @@ BUILDIN(successrefitem)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0) {
ep=sd->status.inventory[i].equip;
@@ -7261,7 +7271,7 @@ BUILDIN(successrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]);
sd->status.inventory[i].refine++;
- pc_unequipitem(sd,i,2); // status calc will happen in pc_equipitem() below
+ iPc->unequipitem(sd,i,2); // status calc will happen in iPc->equipitem() below
clif->refine(sd->fd,0,i,sd->status.inventory[i].refine);
clif->delitem(sd,i,1,3);
@@ -7270,21 +7280,21 @@ BUILDIN(successrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]);
clif->additem(sd,i,1,0);
- pc_equipitem(sd,i,ep);
+ iPc->equipitem(sd,i,ep);
clif->misceffect(&sd->bl,3);
- if(sd->status.inventory[i].refine == MAX_REFINE &&
+ if(sd->status.inventory[i].refine == 10 &&
sd->status.inventory[i].card[0] == CARD0_FORGE &&
sd->status.char_id == (int)MakeDWord(sd->status.inventory[i].card[2],sd->status.inventory[i].card[3])
){ // Fame point system [DracoRPG]
switch (sd->inventory_data[i]->wlv){
case 1:
- pc_addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
+ iPc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
break;
case 2:
- pc_addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
+ iPc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
break;
case 3:
- pc_addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
+ iPc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
break;
}
}
@@ -7307,13 +7317,13 @@ BUILDIN(failedrefitem)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0) {
sd->status.inventory[i].refine = 0;
- pc_unequipitem(sd,i,3); //recalculate bonus
+ iPc->unequipitem(sd,i,3); //recalculate bonus
clif->refine(sd->fd,1,i,sd->status.inventory[i].refine); //notify client of failure
- pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
clif->misceffect(&sd->bl,2); // display failure effect
}
@@ -7335,7 +7345,7 @@ BUILDIN(downrefitem)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i = pc_checkequip(sd,equip[num-1]);
+ i = iPc->checkequip(sd,equip[num-1]);
if(i >= 0) {
ep = sd->status.inventory[i].equip;
@@ -7343,7 +7353,7 @@ BUILDIN(downrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, -1, &sd->status.inventory[i],sd->inventory_data[i]);
sd->status.inventory[i].refine++;
- pc_unequipitem(sd,i,2); // status calc will happen in pc_equipitem() below
+ iPc->unequipitem(sd,i,2); // status calc will happen in iPc->equipitem() below
clif->refine(sd->fd,2,i,sd->status.inventory[i].refine = sd->status.inventory[i].refine - 2);
clif->delitem(sd,i,1,3);
@@ -7352,7 +7362,7 @@ BUILDIN(downrefitem)
logs->pick_pc(sd, LOG_TYPE_SCRIPT, 1, &sd->status.inventory[i],sd->inventory_data[i]);
clif->additem(sd,i,1,0);
- pc_equipitem(sd,i,ep);
+ iPc->equipitem(sd,i,ep);
clif->misceffect(&sd->bl,2);
}
@@ -7373,10 +7383,10 @@ BUILDIN(delequip)
return true;
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0) {
- pc_unequipitem(sd,i,3); //recalculate bonus
- pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ iPc->unequipitem(sd,i,3); //recalculate bonus
+ iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
}
return true;
@@ -7395,7 +7405,7 @@ BUILDIN(statusup)
if( sd == NULL )
return true;
- pc_statusup(sd,type);
+ iPc->statusup(sd,type);
return true;
}
@@ -7413,7 +7423,7 @@ BUILDIN(statusup2)
if( sd == NULL )
return true;
- pc_statusup2(sd,type,val);
+ iPc->statusup2(sd,type,val);
return true;
}
@@ -7467,16 +7477,16 @@ BUILDIN(bonus)
switch( script_lastdata(st)-2 ) {
case 1:
- pc_bonus(sd, type, val1);
+ iPc->bonus(sd, type, val1);
break;
case 2:
val2 = script_getnum(st,4);
- pc_bonus2(sd, type, val1, val2);
+ iPc->bonus2(sd, type, val1, val2);
break;
case 3:
val2 = script_getnum(st,4);
val3 = script_getnum(st,5);
- pc_bonus3(sd, type, val1, val2, val3);
+ iPc->bonus3(sd, type, val1, val2, val3);
break;
case 4:
if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) )
@@ -7486,7 +7496,7 @@ BUILDIN(bonus)
val3 = script_getnum(st,5);
val4 = script_getnum(st,6);
- pc_bonus4(sd, type, val1, val2, val3, val4);
+ iPc->bonus4(sd, type, val1, val2, val3, val4);
break;
case 5:
if( type == SP_AUTOSPELL_ONSKILL && script_isstring(st,4) )
@@ -7497,7 +7507,7 @@ BUILDIN(bonus)
val3 = script_getnum(st,5);
val4 = script_getnum(st,6);
val5 = script_getnum(st,7);
- pc_bonus5(sd, type, val1, val2, val3, val4, val5);
+ iPc->bonus5(sd, type, val1, val2, val3, val4, val5);
break;
default:
ShowDebug("buildin_bonus: unexpected number of arguments (%d)\n", (script_lastdata(st) - 1));
@@ -7533,7 +7543,7 @@ BUILDIN(autobonus)
if( script_hasdata(st,6) )
other_script = script_getstr(st,6);
- if( pc_addautobonus(sd->autobonus,ARRAYLENGTH(sd->autobonus),
+ if( iPc->addautobonus(sd->autobonus,ARRAYLENGTH(sd->autobonus),
bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[current_equip_item_index].equip,false) )
{
script_add_autobonus(bonus_script);
@@ -7570,7 +7580,7 @@ BUILDIN(autobonus2)
if( script_hasdata(st,6) )
other_script = script_getstr(st,6);
- if( pc_addautobonus(sd->autobonus2,ARRAYLENGTH(sd->autobonus2),
+ if( iPc->addautobonus(sd->autobonus2,ARRAYLENGTH(sd->autobonus2),
bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[current_equip_item_index].equip,false) )
{
script_add_autobonus(bonus_script);
@@ -7605,7 +7615,7 @@ BUILDIN(autobonus3)
if( script_hasdata(st,6) )
other_script = script_getstr(st,6);
- if( pc_addautobonus(sd->autobonus3,ARRAYLENGTH(sd->autobonus3),
+ if( iPc->addautobonus(sd->autobonus3,ARRAYLENGTH(sd->autobonus3),
bonus_script,rate,dur,atk_type,other_script,sd->status.inventory[current_equip_item_index].equip,true) )
{
script_add_autobonus(bonus_script);
@@ -7641,7 +7651,7 @@ BUILDIN(skill)
level = script_getnum(st,3);
if( script_hasdata(st,4) )
flag = script_getnum(st,4);
- pc_skill(sd, id, level, flag);
+ iPc->skill(sd, id, level, flag);
return true;
}
@@ -7670,7 +7680,7 @@ BUILDIN(addtoskill)
level = script_getnum(st,3);
if( script_hasdata(st,4) )
flag = script_getnum(st,4);
- pc_skill(sd, id, level, flag);
+ iPc->skill(sd, id, level, flag);
return true;
}
@@ -7712,7 +7722,7 @@ BUILDIN(getskilllv)
return true;// no player attached, report source
id = ( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
- script_pushint(st, pc_checkskill(sd,id));
+ script_pushint(st, iPc->checkskill(sd,id));
return true;
}
@@ -7760,7 +7770,7 @@ BUILDIN(getgmlevel)
if( sd == NULL )
return true;// no player attached, report source
- script_pushint(st, pc_get_group_level(sd));
+ script_pushint(st, iPc->get_group_level(sd));
return true;
}
@@ -7783,8 +7793,7 @@ BUILDIN(getgroupid)
/// Terminates the execution of this script instance.
///
/// end
-BUILDIN(end)
-{
+BUILDIN(end) {
st->state = END;
return true;
}
@@ -7882,9 +7891,9 @@ BUILDIN(setoption)
if( flag ){// Add option
if( option&OPTION_WEDDING && !battle_config.wedding_modifydisplay )
option &= ~OPTION_WEDDING;// Do not show the wedding sprites
- pc_setoption(sd, sd->sc.option|option);
+ iPc->setoption(sd, sd->sc.option|option);
} else// Remove option
- pc_setoption(sd, sd->sc.option&~option);
+ iPc->setoption(sd, sd->sc.option&~option);
return true;
}
@@ -7932,7 +7941,7 @@ BUILDIN(setcart)
if( script_hasdata(st,2) )
type = script_getnum(st,2);
- pc_setcart(sd, type);
+ iPc->setcart(sd, type);
return true;
}
@@ -7975,7 +7984,7 @@ BUILDIN(setfalcon)
if( script_hasdata(st,2) )
flag = script_getnum(st,2);
- pc_setfalcon(sd, flag);
+ iPc->setfalcon(sd, flag);
return true;
}
@@ -8017,7 +8026,7 @@ BUILDIN(setriding)
if( script_hasdata(st,2) )
flag = script_getnum(st,2);
- pc_setriding(sd, flag);
+ iPc->setriding(sd, flag);
return true;
}
@@ -8078,7 +8087,7 @@ BUILDIN(setmadogear)
if( script_hasdata(st,2) )
flag = script_getnum(st,2);
- pc_setmadogear(sd, flag);
+ iPc->setmadogear(sd, flag);
return true;
}
@@ -8104,7 +8113,7 @@ BUILDIN(savepoint)
y = script_getnum(st,4);
map = mapindex_name2id(str);
if( map )
- pc_setsavepoint(sd, map, x, y);
+ iPc->setsavepoint(sd, map, x, y);
return true;
}
@@ -8135,7 +8144,7 @@ BUILDIN(gettimetick) /* Asgard Version */
case 0:
default:
//type 0:(System Ticks)
- script_pushint(st,gettick());
+ script_pushint(st,iTimer->gettick());
break;
}
return true;
@@ -8351,7 +8360,7 @@ BUILDIN(getexp)
base = (int) cap_value(base * bonus, 0, INT_MAX);
job = (int) cap_value(job * bonus, 0, INT_MAX);
- pc_gainexp(sd, NULL, base, job, true);
+ iPc->gainexp(sd, NULL, base, job, true);
return true;
}
@@ -8388,7 +8397,7 @@ BUILDIN(guildchangegm)
guild_id = script_getnum(st,2);
name = script_getstr(st,3);
- sd=map_nick2sd(name);
+ sd=iMap->nick2sd(name);
if (!sd)
script_pushint(st,0);
@@ -8417,6 +8426,7 @@ BUILDIN(monster)
const char* event = "";
unsigned int size = SZ_SMALL;
unsigned int ai = AI_NONE;
+ int mob_id;
struct map_session_data* sd;
int16 m;
@@ -8453,24 +8463,22 @@ BUILDIN(monster)
return false;
}
- sd = map_id2sd(st->rid);
+ sd = iMap->id2sd(st->rid);
if (sd && strcmp(mapn, "this") == 0)
m = sd->bl.m;
- else
- {
- m = map_mapname2mapid(mapn);
- if (map[m].flag.src4instance && st->instance_id)
- { // Try to redirect to the instance map, not the src map
- if ((m = instance_mapid2imapid(m, st->instance_id)) < 0)
- {
+ else {
+ m = iMap->mapname2mapid(mapn);
+ if (map[m].flag.src4instance && st->instance_id >= 0) { // Try to redirect to the instance map, not the src map
+ if ((m = instance->mapid2imapid(m, st->instance_id)) < 0) {
ShowError("buildin_monster: Trying to spawn monster (%d) on instance map (%s) without instance attached.\n", class_, mapn);
return false;
}
}
}
- mob_once_spawn(sd, m, x, y, str, class_, amount, event, size, ai);
+ mob_id = mob_once_spawn(sd, m, x, y, str, class_, amount, event, size, ai);
+ script_pushint(st, mob_id);
return true;
}
/*==========================================
@@ -8524,54 +8532,49 @@ BUILDIN(areamonster)
const char* event = "";
unsigned int size = SZ_SMALL;
unsigned int ai = AI_NONE;
+ int mob_id;
struct map_session_data* sd;
int16 m;
- if (script_hasdata(st,10))
- {
+ if (script_hasdata(st,10)) {
event = script_getstr(st, 10);
check_event(st, event);
}
- if (script_hasdata(st, 11))
- {
+ if (script_hasdata(st, 11)) {
size = script_getnum(st, 11);
- if (size > 3)
- {
+ if (size > 3) {
ShowWarning("buildin_monster: Attempted to spawn non-existing size %d for monster class %d\n", size, class_);
return false;
}
}
- if (script_hasdata(st, 12))
- {
+ if (script_hasdata(st, 12)) {
ai = script_getnum(st, 12);
- if (ai > 4)
- {
+ if (ai > 4) {
ShowWarning("buildin_monster: Attempted to spawn non-existing ai %d for monster class %d\n", ai, class_);
return false;
}
}
- sd = map_id2sd(st->rid);
+ sd = iMap->id2sd(st->rid);
if (sd && strcmp(mapn, "this") == 0)
m = sd->bl.m;
- else
- {
- m = map_mapname2mapid(mapn);
- if (map[m].flag.src4instance && st->instance_id)
- { // Try to redirect to the instance map, not the src map
- if ((m = instance_mapid2imapid(m, st->instance_id)) < 0)
- {
+ else {
+ m = iMap->mapname2mapid(mapn);
+ if (map[m].flag.src4instance && st->instance_id >= 0) { // Try to redirect to the instance map, not the src map
+ if ((m = instance->mapid2imapid(m, st->instance_id)) < 0) {
ShowError("buildin_areamonster: Trying to spawn monster (%d) on instance map (%s) without instance attached.\n", class_, mapn);
return false;
}
}
}
- mob_once_spawn_area(sd, m, x0, y0, x1, y1, str, class_, amount, event, size, ai);
+ mob_id = mob_once_spawn_area(sd, m, x0, y0, x1, y1, str, class_, amount, event, size, ai);
+ script_pushint(st, mob_id);
+
return true;
}
/*==========================================
@@ -8621,22 +8624,22 @@ BUILDIN(killmonster)
else
check_event(st, event);
- if( (m=map_mapname2mapid(mapname))<0 )
+ if( (m=iMap->mapname2mapid(mapname))<0 )
return true;
- if( map[m].flag.src4instance && st->instance_id && (m = instance_mapid2imapid(m, st->instance_id)) < 0 )
+ if( map[m].flag.src4instance && st->instance_id >= 0 && (m = instance->mapid2imapid(m, st->instance_id)) < 0 )
return true;
if( script_hasdata(st,4) ) {
if ( script_getnum(st,4) == 1 ) {
- map_foreachinmap(buildin_killmonster_sub, m, BL_MOB, event ,allflag);
+ iMap->foreachinmap(buildin_killmonster_sub, m, BL_MOB, event ,allflag);
return true;
}
}
- map_freeblock_lock();
- map_foreachinmap(buildin_killmonster_sub_strip, m, BL_MOB, event ,allflag);
- map_freeblock_unlock();
+ iMap->freeblock_lock();
+ iMap->foreachinmap(buildin_killmonster_sub_strip, m, BL_MOB, event ,allflag);
+ iMap->freeblock_unlock();
return true;
}
@@ -8662,20 +8665,20 @@ BUILDIN(killmonsterall)
int16 m;
mapname=script_getstr(st,2);
- if( (m = map_mapname2mapid(mapname))<0 )
+ if( (m = iMap->mapname2mapid(mapname))<0 )
return true;
- if( map[m].flag.src4instance && st->instance_id && (m = instance_mapid2imapid(m, st->instance_id)) < 0 )
+ if( map[m].flag.src4instance && st->instance_id >= 0 && (m = instance->mapid2imapid(m, st->instance_id)) < 0 )
return true;
if( script_hasdata(st,3) ) {
if ( script_getnum(st,3) == 1 ) {
- map_foreachinmap(buildin_killmonsterall_sub,m,BL_MOB);
+ iMap->foreachinmap(buildin_killmonsterall_sub,m,BL_MOB);
return true;
}
}
- map_foreachinmap(buildin_killmonsterall_sub_strip,m,BL_MOB);
+ iMap->foreachinmap(buildin_killmonsterall_sub_strip,m,BL_MOB);
return true;
}
@@ -8710,13 +8713,13 @@ BUILDIN(clone)
check_event(st, event);
- m = map_mapname2mapid(map);
+ m = iMap->mapname2mapid(map);
if (m < 0) return true;
- sd = map_charid2sd(char_id);
+ sd = iMap->charid2sd(char_id);
if (master_id) {
- msd = map_charid2sd(master_id);
+ msd = iMap->charid2sd(master_id);
if (msd)
master_id = msd->bl.id;
else
@@ -8752,7 +8755,7 @@ BUILDIN(donpcevent)
const char* event = script_getstr(st,2);
check_event(st, event);
if( !npc_event_do(event) ) {
- struct npc_data * nd = map_id2nd(st->oid);
+ struct npc_data * nd = iMap->id2nd(st->oid);
ShowDebug("NPCEvent '%s' not found! (source: %s)\n",event,nd?nd->name:"Unknown");
script_pushint(st, 0);
} else
@@ -8786,7 +8789,7 @@ BUILDIN(addtimer)
if( sd == NULL )
return true;
- pc_addeventtimer(sd,tick,event);
+ iPc->addeventtimer(sd,tick,event);
return true;
}
/*==========================================
@@ -8802,7 +8805,7 @@ BUILDIN(deltimer)
return true;
check_event(st, event);
- pc_deleventtimer(sd,event);
+ iPc->deleventtimer(sd,event);
return true;
}
/*==========================================
@@ -8820,7 +8823,7 @@ BUILDIN(addtimercount)
return true;
check_event(st, event);
- pc_addeventtimercount(sd,event,tick);
+ iPc->addeventtimercount(sd,event,tick);
return true;
}
@@ -8845,7 +8848,7 @@ BUILDIN(initnpctimer)
nd = npc_name2id(script->conv_str(st, data));
else if( data_isint(data) ) //Flag
{
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
flag = script->conv_num(st,data);
}
else
@@ -8855,7 +8858,7 @@ BUILDIN(initnpctimer)
}
}
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( !nd )
return true;
@@ -8893,7 +8896,7 @@ BUILDIN(startnpctimer)
nd = npc_name2id(script->conv_str(st, data));
else if( data_isint(data) ) //Flag
{
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
flag = script->conv_num(st,data);
}
else
@@ -8903,7 +8906,7 @@ BUILDIN(startnpctimer)
}
}
else
- nd=(struct npc_data *)map_id2bl(st->oid);
+ nd=(struct npc_data *)iMap->id2bl(st->oid);
if( !nd )
return true;
@@ -8939,7 +8942,7 @@ BUILDIN(stopnpctimer)
nd = npc_name2id(script->conv_str(st, data));
else if( data_isint(data) ) //Flag
{
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
flag = script->conv_num(st,data);
}
else
@@ -8949,7 +8952,7 @@ BUILDIN(stopnpctimer)
}
}
else
- nd=(struct npc_data *)map_id2bl(st->oid);
+ nd=(struct npc_data *)iMap->id2bl(st->oid);
if( !nd )
return true;
@@ -8971,7 +8974,7 @@ BUILDIN(getnpctimer)
if( script_hasdata(st,3) )
nd = npc_name2id(script_getstr(st,3));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( !nd || nd->bl.type != BL_NPC )
{
@@ -8986,7 +8989,7 @@ BUILDIN(getnpctimer)
case 1:
if( nd->u.scr.rid )
{
- sd = map_id2sd(nd->u.scr.rid);
+ sd = iMap->id2sd(nd->u.scr.rid);
if( !sd )
{
ShowError("buildin_getnpctimer: Attached player not found!\n");
@@ -9014,7 +9017,7 @@ BUILDIN(setnpctimer)
if( script_hasdata(st,3) )
nd = npc_name2id(script_getstr(st,3));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( !nd || nd->bl.type != BL_NPC )
{
@@ -9034,7 +9037,7 @@ BUILDIN(setnpctimer)
BUILDIN(attachnpctimer)
{
TBL_PC *sd;
- struct npc_data *nd = (struct npc_data *)map_id2bl(st->oid);
+ struct npc_data *nd = (struct npc_data *)iMap->id2bl(st->oid);
if( !nd || nd->bl.type != BL_NPC )
{
@@ -9044,7 +9047,7 @@ BUILDIN(attachnpctimer)
}
if( script_hasdata(st,2) )
- sd = map_nick2sd(script_getstr(st,2));
+ sd = iMap->nick2sd(script_getstr(st,2));
else
sd = script_rid2sd(st);
@@ -9070,7 +9073,7 @@ BUILDIN(detachnpctimer)
if( script_hasdata(st,2) )
nd = npc_name2id(script_getstr(st,2));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( !nd || nd->bl.type != BL_NPC )
{
@@ -9091,7 +9094,7 @@ BUILDIN(detachnpctimer)
*------------------------------------------*/
BUILDIN(playerattached)
{
- if(st->rid == 0 || map_id2sd(st->rid) == NULL)
+ if(st->rid == 0 || iMap->id2sd(st->rid) == NULL)
script_pushint(st,0);
else
script_pushint(st,st->rid);
@@ -9113,7 +9116,7 @@ BUILDIN(announce)
if (flag&0x0f) // Broadcast source or broadcast region defined
{
send_target target;
- struct block_list *bl = (flag&0x08) ? map_id2bl(st->oid) : (struct block_list *)script_rid2sd(st); // If bc_npc flag is set, use NPC as broadcast source
+ struct block_list *bl = (flag&0x08) ? iMap->id2bl(st->oid) : (struct block_list *)script_rid2sd(st); // If bc_npc flag is set, use NPC as broadcast source
if (bl == NULL)
return true;
@@ -9164,7 +9167,7 @@ BUILDIN(itemeffect) {
struct item_data *item_data;
nullpo_retr( 1, ( sd = script_rid2sd( st ) ) );
- nullpo_retr( 1, ( nd = (TBL_NPC *)map_id2bl( sd->npc_id ) ) );
+ nullpo_retr( 1, ( nd = (TBL_NPC *)iMap->id2bl( sd->npc_id ) ) );
data = script_getdata( st, 2 );
get_val( st, data );
@@ -9205,10 +9208,10 @@ BUILDIN(mapannounce)
int fontY = script_hasdata(st,9) ? script_getnum(st,9) : 0; // default fontY
int16 m;
- if ((m = map_mapname2mapid(mapname)) < 0)
+ if ((m = iMap->mapname2mapid(mapname)) < 0)
return true;
- map_foreachinmap(buildin_announce_sub, m, BL_PC,
+ iMap->foreachinmap(buildin_announce_sub, m, BL_PC,
mes, strlen(mes)+1, flag&0xf0, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
}
@@ -9230,10 +9233,10 @@ BUILDIN(areaannounce)
int fontY = script_hasdata(st,13) ? script_getnum(st,13) : 0; // default fontY
int16 m;
- if ((m = map_mapname2mapid(mapname)) < 0)
+ if ((m = iMap->mapname2mapid(mapname)) < 0)
return true;
- map_foreachinarea(buildin_announce_sub, m, x0, y0, x1, y1, BL_PC,
+ iMap->foreachinarea(buildin_announce_sub, m, x0, y0, x1, y1, BL_PC,
mes, strlen(mes)+1, flag&0xf0, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
}
@@ -9253,7 +9256,7 @@ BUILDIN(getusers)
case 0:
if(flag&0x8)
{// npc
- bl = map_id2bl(st->oid);
+ bl = iMap->id2bl(st->oid);
}
else if((sd = script_rid2sd(st))!=NULL)
{// pc
@@ -9266,7 +9269,7 @@ BUILDIN(getusers)
}
break;
case 1:
- val = map_getusers();
+ val = iMap->getusers();
break;
default:
ShowWarning("buildin_getusers: Unknown type %d.\n", flag);
@@ -9289,11 +9292,11 @@ BUILDIN(getusersname)
sd = script_rid2sd(st);
if (!sd) return true;
- group_level = pc_get_group_level(sd);
+ group_level = iPc->get_group_level(sd);
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
- if (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && pc_get_group_level(pl_sd) > group_level)
+ if (pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) && iPc->get_group_level(pl_sd) > group_level)
continue; // skip hidden sessions
/* Temporary fix for bugreport:1023.
@@ -9318,7 +9321,7 @@ BUILDIN(getmapguildusers)
struct guild *g = NULL;
str=script_getstr(st,2);
gid=script_getnum(st,3);
- if ((m = map_mapname2mapid(str)) < 0) { // map id on this server (m == -1 if not in actual map-server)
+ if ((m = iMap->mapname2mapid(str)) < 0) { // map id on this server (m == -1 if not in actual map-server)
script_pushint(st,-1);
return true;
}
@@ -9342,7 +9345,7 @@ BUILDIN(getmapusers)
const char *str;
int16 m;
str=script_getstr(st,2);
- if( (m=map_mapname2mapid(str))< 0){
+ if( (m=iMap->mapname2mapid(str))< 0){
script_pushint(st,-1);
return true;
}
@@ -9366,11 +9369,11 @@ BUILDIN(getareausers)
y0=script_getnum(st,4);
x1=script_getnum(st,5);
y1=script_getnum(st,6);
- if( (m=map_mapname2mapid(str))< 0){
+ if( (m=iMap->mapname2mapid(str))< 0){
script_pushint(st,-1);
return true;
}
- map_foreachinarea(buildin_getareausers_sub,
+ iMap->foreachinarea(buildin_getareausers_sub,
m,x0,y0,x1,y1,BL_PC,&users);
script_pushint(st,users);
return true;
@@ -9413,11 +9416,11 @@ BUILDIN(getareadropitem)
}else
item=script->conv_num(st,data);
- if( (m=map_mapname2mapid(str))< 0){
+ if( (m=iMap->mapname2mapid(str))< 0){
script_pushint(st,-1);
return true;
}
- map_foreachinarea(buildin_getareadropitem_sub,
+ iMap->foreachinarea(buildin_getareadropitem_sub,
m,x0,y0,x1,y1,BL_ITEM,item,&amount);
script_pushint(st,amount);
return true;
@@ -9475,9 +9478,9 @@ BUILDIN(sc_start)
tick = script_getnum(st,3);
val1 = script_getnum(st,4);
if( script_hasdata(st,5) )
- bl = map_id2bl(script_getnum(st,5));
+ bl = iMap->id2bl(script_getnum(st,5));
else
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status_sc2skill(type) != 0 )
{// When there isn't a duration specified, try to get it from the skill_db
@@ -9486,7 +9489,7 @@ BUILDIN(sc_start)
if( potion_flag == 1 && potion_target )
{ //skill.c set the flags before running the script, this must be a potion-pitched effect.
- bl = map_id2bl(potion_target);
+ bl = iMap->id2bl(potion_target);
tick /= 2;// Thrown potions only last half.
val4 = 1;// Mark that this was a thrown sc_effect
}
@@ -9514,9 +9517,9 @@ BUILDIN(sc_start2)
val1 = script_getnum(st,4);
rate = script_getnum(st,5);
if( script_hasdata(st,6) )
- bl = map_id2bl(script_getnum(st,6));
+ bl = iMap->id2bl(script_getnum(st,6));
else
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status_sc2skill(type) != 0 )
{// When there isn't a duration specified, try to get it from the skill_db
@@ -9525,7 +9528,7 @@ BUILDIN(sc_start2)
if( potion_flag == 1 && potion_target )
{ //skill.c set the flags before running the script, this must be a potion-pitched effect.
- bl = map_id2bl(potion_target);
+ bl = iMap->id2bl(potion_target);
tick /= 2;// Thrown potions only last half.
val4 = 1;// Mark that this was a thrown sc_effect
}
@@ -9556,9 +9559,9 @@ BUILDIN(sc_start4)
val3 = script_getnum(st,6);
val4 = script_getnum(st,7);
if( script_hasdata(st,8) )
- bl = map_id2bl(script_getnum(st,8));
+ bl = iMap->id2bl(script_getnum(st,8));
else
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
if( tick == 0 && val1 > 0 && type > SC_NONE && type < SC_MAX && status_sc2skill(type) != 0 )
{// When there isn't a duration specified, try to get it from the skill_db
@@ -9567,7 +9570,7 @@ BUILDIN(sc_start4)
if( potion_flag == 1 && potion_target )
{ //skill.c set the flags before running the script, this must be a potion-pitched effect.
- bl = map_id2bl(potion_target);
+ bl = iMap->id2bl(potion_target);
tick /= 2;// Thrown potions only last half.
}
@@ -9587,12 +9590,12 @@ BUILDIN(sc_end)
type = script_getnum(st, 2);
if (script_hasdata(st, 3))
- bl = map_id2bl(script_getnum(st, 3));
+ bl = iMap->id2bl(script_getnum(st, 3));
else
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
if (potion_flag == 1 && potion_target) //##TODO how does this work [FlavioJS]
- bl = map_id2bl(potion_target);
+ bl = iMap->id2bl(potion_target);
if (!bl)
return true;
@@ -9639,9 +9642,9 @@ BUILDIN(getscrate)
type=script_getnum(st,2);
rate=script_getnum(st,3);
if( script_hasdata(st,4) ) //get for the bl assigned
- bl = map_id2bl(script_getnum(st,4));
+ bl = iMap->id2bl(script_getnum(st,4));
else
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
if (bl)
rate = status_get_sc_def(bl, (sc_type)type, 10000, 10000, 0);
@@ -9686,11 +9689,11 @@ BUILDIN(getstatus)
case 4: script_pushint(st, sd->sc.data[id]->val4); break;
case 5:
{
- struct TimerData* timer = (struct TimerData*)get_timer(sd->sc.data[id]->timer);
+ struct TimerData* timer = (struct TimerData*)iTimer->get_timer(sd->sc.data[id]->timer);
if( timer )
{// return the amount of time remaining
- script_pushint(st, timer->tick - gettick());
+ script_pushint(st, timer->tick - iTimer->gettick());
}
}
break;
@@ -9790,6 +9793,31 @@ BUILDIN(homunculus_shuffle) {
return true;
}
+/*==========================================
+ * Check for homunculus state.
+ * Return: -1 = No homunculus
+ * 0 = Homunculus is active
+ * 1 = Homunculus is vaporized (rest)
+ * 2 = Homunculus is in morph state
+ *------------------------------------------*/
+BUILDIN(checkhomcall)
+{
+ TBL_PC *sd = script_rid2sd(st);
+ TBL_HOM *hd;
+
+ if( sd == NULL )
+ return false;
+
+ hd = sd->hd;
+
+ if( !hd )
+ script_pushint(st, -1);
+ else
+ script_pushint(st, hd->homunculus.vaporize);
+
+ return true;
+}
+
//These two functions bring the eA MAPID_* class functionality to scripts.
BUILDIN(eaclass)
{
@@ -9805,7 +9833,7 @@ BUILDIN(eaclass)
}
class_ = sd->status.class_;
}
- script_pushint(st,pc_jobid2mapid(class_));
+ script_pushint(st,iPc->jobid2mapid(class_));
return true;
}
@@ -9822,7 +9850,7 @@ BUILDIN(roclass)
else
sex = 1; //Just use male when not found.
}
- script_pushint(st,pc_mapid2jobid(class_, sex));
+ script_pushint(st,iPc->mapid2jobid(class_, sex));
return true;
}
@@ -9863,7 +9891,7 @@ BUILDIN(resetlvl)
if( sd == NULL )
return true;
- pc_resetlvl(sd,type);
+ iPc->resetlvl(sd,type);
return true;
}
/*==========================================
@@ -9873,7 +9901,7 @@ BUILDIN(resetstatus)
{
TBL_PC *sd;
sd=script_rid2sd(st);
- pc_resetstate(sd);
+ iPc->resetstate(sd);
return true;
}
@@ -9884,7 +9912,7 @@ BUILDIN(resetskill)
{
TBL_PC *sd;
sd=script_rid2sd(st);
- pc_resetskill(sd,1);
+ iPc->resetskill(sd,1);
return true;
}
@@ -9895,7 +9923,7 @@ BUILDIN(skillpointcount)
{
TBL_PC *sd;
sd=script_rid2sd(st);
- script_pushint(st,sd->status.skill_point + pc_resetskill(sd,2));
+ script_pushint(st,sd->status.skill_point + iPc->resetskill(sd,2));
return true;
}
@@ -9908,7 +9936,7 @@ BUILDIN(changebase)
int vclass;
if( script_hasdata(st,3) )
- sd=map_id2sd(script_getnum(st,3));
+ sd=iMap->id2sd(script_getnum(st,3));
else
sd=script_rid2sd(st);
@@ -9946,10 +9974,10 @@ BUILDIN(changesex)
TBL_PC *sd = NULL;
sd = script_rid2sd(st);
- pc_resetskill(sd,4);
+ iPc->resetskill(sd,4);
// to avoid any problem with equipment and invalid sex, equipment is unequiped.
for( i=0; i<EQI_MAX; i++ )
- if( sd->equip_index[i] >= 0 ) pc_unequipitem(sd, sd->equip_index[i], 3);
+ if( sd->equip_index[i] >= 0 ) iPc->unequipitem(sd, sd->equip_index[i], 3);
chrif_changesex(sd);
return true;
}
@@ -9959,7 +9987,7 @@ BUILDIN(changesex)
*------------------------------------------*/
BUILDIN(globalmes)
{
- struct block_list *bl = map_id2bl(st->oid);
+ struct block_list *bl = iMap->id2bl(st->oid);
struct npc_data *nd = (struct npc_data *)bl;
const char *name=NULL,*mes;
@@ -9996,7 +10024,7 @@ BUILDIN(waitingroom)
int minLvl = script_hasdata(st,7) ? script_getnum(st,7) : 1;
int maxLvl = script_hasdata(st,8) ? script_getnum(st,8) : MAX_LEVEL;
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( nd != NULL )
chat_createnpcchat(nd, title, limit, pub, trigger, ev, zeny, minLvl, maxLvl);
@@ -10013,7 +10041,7 @@ BUILDIN(delwaitingroom)
if( script_hasdata(st,2) )
nd = npc_name2id(script_getstr(st, 2));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
if( nd != NULL )
chat_deletenpcchat(nd);
return true;
@@ -10031,9 +10059,9 @@ BUILDIN(waitingroomkickall)
if( script_hasdata(st,2) )
nd = npc_name2id(script_getstr(st,2));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
- if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL )
+ if( nd != NULL && (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) != NULL )
chat_npckickall(cd);
return true;
}
@@ -10050,9 +10078,9 @@ BUILDIN(enablewaitingroomevent)
if( script_hasdata(st,2) )
nd = npc_name2id(script_getstr(st, 2));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
- if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL )
+ if( nd != NULL && (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) != NULL )
chat_enableevent(cd);
return true;
}
@@ -10069,9 +10097,9 @@ BUILDIN(disablewaitingroomevent)
if( script_hasdata(st,2) )
nd = npc_name2id(script_getstr(st, 2));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
- if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL )
+ if( nd != NULL && (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) != NULL )
chat_disableevent(cd);
return true;
}
@@ -10100,9 +10128,9 @@ BUILDIN(getwaitingroomstate)
if( script_hasdata(st,3) )
nd = npc_name2id(script_getstr(st, 3));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
- if( nd == NULL || (cd=(struct chat_data *)map_id2bl(nd->chat_id)) == NULL )
+ if( nd == NULL || (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL )
{
script_pushint(st, -1);
return true;
@@ -10147,8 +10175,8 @@ BUILDIN(warpwaitingpc)
struct chat_data* cd;
TBL_PC* sd;
- nd = (struct npc_data *)map_id2bl(st->oid);
- if( nd == NULL || (cd=(struct chat_data *)map_id2bl(nd->chat_id)) == NULL )
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
+ if( nd == NULL || (cd=(struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL )
return true;
map_name = script_getstr(st,2);
@@ -10174,17 +10202,17 @@ BUILDIN(warpwaitingpc)
{// no zeny to cover set fee
break;
}
- pc_payzeny(sd, cd->zeny, LOG_TYPE_NPC, NULL);
+ iPc->payzeny(sd, cd->zeny, LOG_TYPE_NPC, NULL);
}
mapreg_setreg(reference_uid(add_str("$@warpwaitingpc"), i), sd->bl.id);
if( strcmp(map_name,"Random") == 0 )
- pc_randomwarp(sd,CLR_TELEPORT);
+ iPc->randomwarp(sd,CLR_TELEPORT);
else if( strcmp(map_name,"SavePoint") == 0 )
- pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
+ iPc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_TELEPORT);
else
- pc_setpos(sd, mapindex_name2id(map_name), x, y, CLR_OUTSIGHT);
+ iPc->setpos(sd, mapindex_name2id(map_name), x, y, CLR_OUTSIGHT);
}
mapreg_setreg(add_str("$@warpwaitingpcnum"), i);
return true;
@@ -10213,7 +10241,7 @@ BUILDIN(attachrid)
{
int rid = script_getnum(st,2);
- if (map_id2sd(rid) != NULL) {
+ if (iMap->id2sd(rid) != NULL) {
script_detach_rid(st);
st->rid = rid;
@@ -10236,7 +10264,7 @@ BUILDIN(detachrid)
*------------------------------------------*/
BUILDIN(isloggedin)
{
- TBL_PC* sd = map_id2sd(script_getnum(st,2));
+ TBL_PC* sd = iMap->id2sd(script_getnum(st,2));
if (script_hasdata(st,3) && sd &&
sd->status.char_id != script_getnum(st,3))
sd = NULL;
@@ -10258,7 +10286,7 @@ BUILDIN(setmapflagnosave)
str2=script_getstr(st,3);
x=script_getnum(st,4);
y=script_getnum(st,5);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
mapindex = mapindex_name2id(str2);
if(m >= 0 && mapindex) {
@@ -10279,7 +10307,7 @@ BUILDIN(getmapflag)
str=script_getstr(st,2);
i=script_getnum(st,3);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m >= 0) {
switch(i) {
case MF_NOMEMO: script_pushint(st,map[m].flag.nomemo); break;
@@ -10340,7 +10368,7 @@ BUILDIN(getmapflag)
static int script_mapflag_pvp_sub(struct block_list *bl,va_list ap) {
TBL_PC* sd = (TBL_PC*)bl;
if (sd->pvp_timer == INVALID_TIMER) {
- sd->pvp_timer = add_timer(gettick() + 200, pc_calc_pvprank_timer, sd->bl.id, 0);
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick() + 200, iPc->calc_pvprank_timer, sd->bl.id, 0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
sd->pvp_point = 5;
@@ -10373,7 +10401,7 @@ BUILDIN(setmapflag)
val = script_getnum(st, 4);
}
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m >= 0) {
switch(i) {
@@ -10386,7 +10414,7 @@ BUILDIN(setmapflag)
case MF_PVP:
map[m].flag.pvp = 1;
if( !battle_config.pk_mode ) {
- map_foreachinmap(script_mapflag_pvp_sub,m,BL_PC);
+ iMap->foreachinmap(script_mapflag_pvp_sub,m,BL_PC);
}
break;
case MF_PVP_NOPARTY: map[m].flag.pvp_noparty = 1; break;
@@ -10464,7 +10492,7 @@ BUILDIN(removemapflag)
if(script_hasdata(st,4)){
val=script_getnum(st,4);
}
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m >= 0) {
switch(i) {
case MF_NOMEMO: map[m].flag.nomemo = 0; break;
@@ -10517,7 +10545,7 @@ BUILDIN(removemapflag)
case MF_NOWARPTO: map[m].flag.nowarpto = 0; break;
case MF_NIGHTMAREDROP: map[m].flag.pvp_nightmaredrop = 0; break;
case MF_ZONE:
- map_zone_change2(m, map[m].prev_zone);
+ iMap->zone_change2(m, map[m].prev_zone);
break;
case MF_NOCOMMAND: map[m].nocommand = 0; break;
case MF_NODROP: map[m].flag.nodrop = 0; break;
@@ -10550,11 +10578,11 @@ BUILDIN(pvpon)
struct block_list bl;
str = script_getstr(st,2);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if( m < 0 || map[m].flag.pvp )
return true; // nothing to do
- map_zone_change2(m, strdb_get(zone_db, MAP_ZONE_PVP_NAME));
+ iMap->zone_change2(m, strdb_get(zone_db, MAP_ZONE_PVP_NAME));
map[m].flag.pvp = 1;
clif->map_property_mapall(m, MAPPROPERTY_FREEPVPZONE);
bl.type = BL_NUL;
@@ -10571,7 +10599,7 @@ BUILDIN(pvpon)
if( sd->bl.m != m || sd->pvp_timer != INVALID_TIMER )
continue; // not applicable
- sd->pvp_timer = add_timer(gettick()+200,pc_calc_pvprank_timer,sd->bl.id,0);
+ sd->pvp_timer = iTimer->add_timer(iTimer->gettick()+200,iPc->calc_pvprank_timer,sd->bl.id,0);
sd->pvp_rank = 0;
sd->pvp_lastusers = 0;
sd->pvp_point = 5;
@@ -10588,7 +10616,7 @@ static int buildin_pvpoff_sub(struct block_list *bl,va_list ap)
TBL_PC* sd = (TBL_PC*)bl;
clif->pvpset(sd, 0, 0, 2);
if (sd->pvp_timer != INVALID_TIMER) {
- delete_timer(sd->pvp_timer, pc_calc_pvprank_timer);
+ iTimer->delete_timer(sd->pvp_timer, iPc->calc_pvprank_timer);
sd->pvp_timer = INVALID_TIMER;
}
return 0;
@@ -10601,11 +10629,11 @@ BUILDIN(pvpoff)
struct block_list bl;
str=script_getstr(st,2);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m < 0 || !map[m].flag.pvp)
return true; //fixed Lupus
- map_zone_change2(m, map[m].prev_zone);
+ iMap->zone_change2(m, map[m].prev_zone);
map[m].flag.pvp = 0;
clif->map_property_mapall(m, MAPPROPERTY_NOTHING);
bl.type = BL_NUL;
@@ -10615,7 +10643,7 @@ BUILDIN(pvpoff)
if(battle_config.pk_mode) // disable ranking options if pk_mode is on [Valaris]
return true;
- map_foreachinmap(buildin_pvpoff_sub, m, BL_PC);
+ iMap->foreachinmap(buildin_pvpoff_sub, m, BL_PC);
return true;
}
@@ -10625,10 +10653,10 @@ BUILDIN(gvgon)
const char *str;
str=script_getstr(st,2);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m >= 0 && !map[m].flag.gvg) {
struct block_list bl;
- map_zone_change2(m, strdb_get(zone_db, MAP_ZONE_GVG_NAME));
+ iMap->zone_change2(m, strdb_get(zone_db, MAP_ZONE_GVG_NAME));
map[m].flag.gvg = 1;
clif->map_property_mapall(m, MAPPROPERTY_AGITZONE);
bl.type = BL_NUL;
@@ -10644,10 +10672,10 @@ BUILDIN(gvgoff)
const char *str;
str=script_getstr(st,2);
- m = map_mapname2mapid(str);
+ m = iMap->mapname2mapid(str);
if(m >= 0 && map[m].flag.gvg) {
struct block_list bl;
- map_zone_change2(m, map[m].prev_zone);
+ iMap->zone_change2(m, map[m].prev_zone);
map[m].flag.gvg = 0;
clif->map_property_mapall(m, MAPPROPERTY_NOTHING);
bl.type = BL_NUL;
@@ -10677,7 +10705,7 @@ BUILDIN(emotion)
if (player) {
TBL_PC *sd = NULL;
if( script_hasdata(st,4) )
- sd = map_nick2sd(script_getstr(st,4));
+ sd = iMap->nick2sd(script_getstr(st,4));
else
sd = script_rid2sd(st);
if (sd)
@@ -10690,7 +10718,7 @@ BUILDIN(emotion)
clif->emotion(&nd->bl,type);
}
else
- clif->emotion(map_id2bl(st->oid),type);
+ clif->emotion(iMap->id2bl(st->oid),type);
return true;
}
@@ -10707,7 +10735,7 @@ static int buildin_maprespawnguildid_sub_pc(struct map_session_data* sd, va_list
(sd->status.guild_id != g_id && flag&2) || //Warp out outsiders
(sd->status.guild_id == 0) // Warp out players not in guild [Valaris]
)
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
return 1;
}
@@ -10727,46 +10755,46 @@ BUILDIN(maprespawnguildid)
int g_id=script_getnum(st,3);
int flag=script_getnum(st,4);
- int16 m=map_mapname2mapid(mapname);
+ int16 m=iMap->mapname2mapid(mapname);
if(m == -1)
return true;
//Catch ALL players (in case some are 'between maps' on execution time)
- map_foreachpc(buildin_maprespawnguildid_sub_pc,m,g_id,flag);
+ iMap->map_foreachpc(buildin_maprespawnguildid_sub_pc,m,g_id,flag);
if (flag&4) //Remove script mobs.
- map_foreachinmap(buildin_maprespawnguildid_sub_mob,m,BL_MOB);
+ iMap->foreachinmap(buildin_maprespawnguildid_sub_mob,m,BL_MOB);
return true;
}
BUILDIN(agitstart)
{
- if(agit_flag==1) return true; // Agit already Start.
- agit_flag=1;
+ if(iMap->agit_flag==1) return true; // Agit already Start.
+ iMap->agit_flag=1;
guild->agit_start();
return true;
}
BUILDIN(agitend)
{
- if(agit_flag==0) return true; // Agit already End.
- agit_flag=0;
+ if(iMap->agit_flag==0) return true; // Agit already End.
+ iMap->agit_flag=0;
guild->agit_end();
return true;
}
BUILDIN(agitstart2)
{
- if(agit2_flag==1) return true; // Agit2 already Start.
- agit2_flag=1;
+ if(iMap->agit2_flag==1) return true; // Agit2 already Start.
+ iMap->agit2_flag=1;
guild->agit2_start();
return true;
}
BUILDIN(agitend2)
{
- if(agit2_flag==0) return true; // Agit2 already End.
- agit2_flag=0;
+ if(iMap->agit2_flag==0) return true; // Agit2 already End.
+ iMap->agit2_flag=0;
guild->agit2_end();
return true;
}
@@ -10776,7 +10804,7 @@ BUILDIN(agitend2)
*------------------------------------------*/
BUILDIN(agitcheck)
{
- script_pushint(st,agit_flag);
+ script_pushint(st,iMap->agit_flag);
return true;
}
@@ -10785,7 +10813,7 @@ BUILDIN(agitcheck)
*------------------------------------------*/
BUILDIN(agitcheck2)
{
- script_pushint(st,agit2_flag);
+ script_pushint(st,iMap->agit2_flag);
return true;
}
@@ -10799,7 +10827,7 @@ BUILDIN(flagemblem)
if(g_id < 0) return true;
- nd = (TBL_NPC*)map_id2nd(st->oid);
+ nd = (TBL_NPC*)iMap->id2nd(st->oid);
if( nd == NULL ) {
ShowError("script:flagemblem: npc %d not found\n", st->oid);
} else if( nd->subtype != SCRIPT ) {
@@ -10918,7 +10946,7 @@ BUILDIN(getequipcardcnt)
num=script_getnum(st,2);
sd=script_rid2sd(st);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if (i < 0 || !sd->inventory_data[i]) {
script_pushint(st,0);
@@ -10950,7 +10978,7 @@ BUILDIN(successremovecards) {
int num = script_getnum(st,2);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if (i < 0 || !sd->inventory_data[i]) {
return true;
@@ -10968,9 +10996,9 @@ BUILDIN(successremovecards) {
item_tmp.nameid = sd->status.inventory[i].card[c];
item_tmp.identify = 1;
- if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // get back the cart in inventory
+ if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // get back the cart in inventory
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -10989,10 +11017,10 @@ BUILDIN(successremovecards) {
for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->status.inventory[i].card[j];
- pc_delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT);
- if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ //chk if can be spawn in inventory otherwise put on floor
+ iPc->delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT);
+ if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ //chk if can be spawn in inventory otherwise put on floor
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
clif->misceffect(&sd->bl,3);
@@ -11014,7 +11042,7 @@ BUILDIN(failedremovecards) {
int typefail = script_getnum(st,3);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if (i < 0 || !sd->inventory_data[i])
return true;
@@ -11035,9 +11063,9 @@ BUILDIN(failedremovecards) {
item_tmp.nameid = sd->status.inventory[i].card[c];
item_tmp.identify = 1;
- if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
+ if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -11045,7 +11073,7 @@ BUILDIN(failedremovecards) {
if(cardflag == 1) {
if(typefail == 0 || typefail == 2){ // destroy the item
- pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
}
if(typefail == 1){ // destroy the card
int flag;
@@ -11062,11 +11090,11 @@ BUILDIN(failedremovecards) {
for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->status.inventory[i].card[j];
- pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
+ iPc->delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
- if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
+ if((flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
clif->misceffect(&sd->bl,2);
@@ -11097,7 +11125,7 @@ BUILDIN(mapwarp) // Added by RoVeRT
check_ID=script_getnum(st,7);
}
- if((m=map_mapname2mapid(mapname))< 0)
+ if((m=iMap->mapname2mapid(mapname))< 0)
return true;
if(!(index=mapindex_name2id(str)))
@@ -11110,23 +11138,23 @@ BUILDIN(mapwarp) // Added by RoVeRT
for( i=0; i < g->max_member; i++)
{
if(g->member[i].sd && g->member[i].sd->bl.m==m){
- pc_setpos(g->member[i].sd,index,x,y,CLR_TELEPORT);
+ iPc->setpos(g->member[i].sd,index,x,y,CLR_TELEPORT);
}
}
}
break;
case 2:
- p = party_search(check_ID);
+ p = iParty->search(check_ID);
if(p){
for(i=0;i<MAX_PARTY; i++){
if(p->data[i].sd && p->data[i].sd->bl.m == m){
- pc_setpos(p->data[i].sd,index,x,y,CLR_TELEPORT);
+ iPc->setpos(p->data[i].sd,index,x,y,CLR_TELEPORT);
}
}
}
break;
default:
- map_foreachinmap(buildin_areawarp_sub,m,BL_PC,index,x,y,0,0);
+ iMap->foreachinmap(buildin_areawarp_sub,m,BL_PC,index,x,y,0,0);
break;
}
@@ -11153,7 +11181,7 @@ BUILDIN(mobcount) // Added by RoVeRT
event = NULL;
else
check_event(st, event);
-
+
if( strcmp(mapname, "this") == 0 ) {
struct map_session_data *sd = script_rid2sd(st);
if( sd )
@@ -11162,19 +11190,17 @@ BUILDIN(mobcount) // Added by RoVeRT
script_pushint(st,-1);
return true;
}
- }
- else if( (m = map_mapname2mapid(mapname)) < 0 ) {
+ } else if( (m = iMap->mapname2mapid(mapname)) < 0 ) {
script_pushint(st,-1);
return true;
}
-
- if( map[m].flag.src4instance && map[m].instance_id == 0 && st->instance_id && (m = instance_mapid2imapid(m, st->instance_id)) < 0 )
- {
+
+ if( map[m].flag.src4instance && map[m].instance_id == -1 && st->instance_id >= 0 && (m = instance->mapid2imapid(m, st->instance_id)) < 0 ) {
script_pushint(st,-1);
return true;
}
-
- script_pushint(st,map_foreachinmap(buildin_mobcount_sub, m, BL_MOB, event));
+
+ script_pushint(st,iMap->foreachinmap(buildin_mobcount_sub, m, BL_MOB, event));
return true;
}
@@ -11183,9 +11209,9 @@ BUILDIN(marriage)
{
const char *partner=script_getstr(st,2);
TBL_PC *sd=script_rid2sd(st);
- TBL_PC *p_sd=map_nick2sd(partner);
+ TBL_PC *p_sd=iMap->nick2sd(partner);
- if(sd==NULL || p_sd==NULL || pc_marriage(sd,p_sd) < 0){
+ if(sd==NULL || p_sd==NULL || iPc->marriage(sd,p_sd) < 0){
script_pushint(st,0);
return true;
}
@@ -11198,7 +11224,7 @@ BUILDIN(wedding_effect)
struct block_list *bl;
if(sd==NULL) {
- bl=map_id2bl(st->oid);
+ bl=iMap->id2bl(st->oid);
} else
bl=&sd->bl;
clif->wedding_effect(bl);
@@ -11207,7 +11233,7 @@ BUILDIN(wedding_effect)
BUILDIN(divorce)
{
TBL_PC *sd=script_rid2sd(st);
- if(sd==NULL || pc_divorce(sd) < 0){
+ if(sd==NULL || iPc->divorce(sd) < 0){
script_pushint(st,0);
return true;
}
@@ -11219,8 +11245,8 @@ BUILDIN(ispartneron)
{
TBL_PC *sd=script_rid2sd(st);
- if(sd==NULL || !pc_ismarried(sd) ||
- map_charid2sd(sd->status.partner_id) == NULL) {
+ if(sd==NULL || !iPc->ismarried(sd) ||
+ iMap->charid2sd(sd->status.partner_id) == NULL) {
script_pushint(st,0);
return true;
}
@@ -11285,8 +11311,8 @@ BUILDIN(warppartner)
TBL_PC *sd=script_rid2sd(st);
TBL_PC *p_sd=NULL;
- if(sd==NULL || !pc_ismarried(sd) ||
- (p_sd=map_charid2sd(sd->status.partner_id)) == NULL) {
+ if(sd==NULL || !iPc->ismarried(sd) ||
+ (p_sd=iMap->charid2sd(sd->status.partner_id)) == NULL) {
script_pushint(st,0);
return true;
}
@@ -11297,7 +11323,7 @@ BUILDIN(warppartner)
mapindex = mapindex_name2id(str);
if (mapindex) {
- pc_setpos(p_sd,mapindex,x,y,CLR_OUTSIGHT);
+ iPc->setpos(p_sd,mapindex,x,y,CLR_OUTSIGHT);
script_pushint(st,1);
} else
script_pushint(st,0);
@@ -11398,16 +11424,16 @@ BUILDIN(setwall)
shootable = script_getnum(st,7);
name = script_getstr(st,8);
- if( (m = map_mapname2mapid(map)) < 0 )
+ if( (m = iMap->mapname2mapid(map)) < 0 )
return true; // Invalid Map
- map_iwall_set(m, x, y, size, dir, shootable, name);
+ iMap->iwall_set(m, x, y, size, dir, shootable, name);
return true;
}
BUILDIN(delwall)
{
const char *name = script_getstr(st,2);
- map_iwall_remove(name);
+ iMap->iwall_remove(name);
return true;
}
@@ -11440,7 +11466,7 @@ BUILDIN(guardianinfo)
if( !gc->guardian[id].visible )
script_pushint(st,-1);
else
- if( (gd = map_id2md(gc->guardian[id].id)) == NULL )
+ if( (gd = iMap->id2md(gc->guardian[id].id)) == NULL )
script_pushint(st,-1);
else
{
@@ -11611,7 +11637,7 @@ BUILDIN(getequipcardid)
slot=script_getnum(st,3);
sd=script_rid2sd(st);
if (num > 0 && num <= ARRAYLENGTH(equip))
- i=pc_checkequip(sd,equip[num-1]);
+ i=iPc->checkequip(sd,equip[num-1]);
if(i >= 0 && slot>=0 && slot<4)
script_pushint(st,sd->status.inventory[i].card[slot]);
else
@@ -11636,7 +11662,7 @@ BUILDIN(petskillbonus)
if (pd->bonus)
{ //Clear previous bonus
if (pd->bonus->timer != INVALID_TIMER)
- delete_timer(pd->bonus->timer, pet_skill_bonus_timer);
+ iTimer->delete_timer(pd->bonus->timer, pet_skill_bonus_timer);
} else //init
pd->bonus = (struct pet_bonus *) aMalloc(sizeof(struct pet_bonus));
@@ -11652,7 +11678,7 @@ BUILDIN(petskillbonus)
if (battle_config.pet_equip_required && pd->pet.equip == 0)
pd->bonus->timer = INVALID_TIMER;
else
- pd->bonus->timer = add_timer(gettick()+pd->bonus->delay*1000, pet_skill_bonus_timer, sd->bl.id, 0);
+ pd->bonus->timer = iTimer->add_timer(iTimer->gettick()+pd->bonus->delay*1000, pet_skill_bonus_timer, sd->bl.id, 0);
return true;
}
@@ -11709,22 +11735,22 @@ BUILDIN(getinventorylist)
if(!sd) return true;
for(i=0;i<MAX_INVENTORY;i++){
if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].amount > 0){
- pc_setreg(sd,reference_uid(add_str("@inventorylist_id"), j),sd->status.inventory[i].nameid);
- pc_setreg(sd,reference_uid(add_str("@inventorylist_amount"), j),sd->status.inventory[i].amount);
- pc_setreg(sd,reference_uid(add_str("@inventorylist_equip"), j),sd->status.inventory[i].equip);
- pc_setreg(sd,reference_uid(add_str("@inventorylist_refine"), j),sd->status.inventory[i].refine);
- pc_setreg(sd,reference_uid(add_str("@inventorylist_identify"), j),sd->status.inventory[i].identify);
- pc_setreg(sd,reference_uid(add_str("@inventorylist_attribute"), j),sd->status.inventory[i].attribute);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_id"), j),sd->status.inventory[i].nameid);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_amount"), j),sd->status.inventory[i].amount);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_equip"), j),sd->status.inventory[i].equip);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_refine"), j),sd->status.inventory[i].refine);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_identify"), j),sd->status.inventory[i].identify);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_attribute"), j),sd->status.inventory[i].attribute);
for (k = 0; k < MAX_SLOTS; k++)
{
sprintf(card_var, "@inventorylist_card%d",k+1);
- pc_setreg(sd,reference_uid(add_str(card_var), j),sd->status.inventory[i].card[k]);
+ iPc->setreg(sd,reference_uid(add_str(card_var), j),sd->status.inventory[i].card[k]);
}
- pc_setreg(sd,reference_uid(add_str("@inventorylist_expire"), j),sd->status.inventory[i].expire_time);
+ iPc->setreg(sd,reference_uid(add_str("@inventorylist_expire"), j),sd->status.inventory[i].expire_time);
j++;
}
}
- pc_setreg(sd,add_str("@inventorylist_count"),j);
+ iPc->setreg(sd,add_str("@inventorylist_count"),j);
return true;
}
@@ -11735,13 +11761,13 @@ BUILDIN(getskilllist)
if(!sd) return true;
for(i=0;i<MAX_SKILL;i++){
if(sd->status.skill[i].id > 0 && sd->status.skill[i].lv > 0){
- pc_setreg(sd,reference_uid(add_str("@skilllist_id"), j),sd->status.skill[i].id);
- pc_setreg(sd,reference_uid(add_str("@skilllist_lv"), j),sd->status.skill[i].lv);
- pc_setreg(sd,reference_uid(add_str("@skilllist_flag"), j),sd->status.skill[i].flag);
+ iPc->setreg(sd,reference_uid(add_str("@skilllist_id"), j),sd->status.skill[i].id);
+ iPc->setreg(sd,reference_uid(add_str("@skilllist_lv"), j),sd->status.skill[i].lv);
+ iPc->setreg(sd,reference_uid(add_str("@skilllist_flag"), j),sd->status.skill[i].flag);
j++;
}
}
- pc_setreg(sd,add_str("@skilllist_count"),j);
+ iPc->setreg(sd,add_str("@skilllist_count"),j);
return true;
}
@@ -11752,7 +11778,7 @@ BUILDIN(clearitem)
if(sd==NULL) return true;
for (i=0; i<MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
- pc_delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_SCRIPT);
+ iPc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_SCRIPT);
}
}
return true;
@@ -11770,7 +11796,7 @@ BUILDIN(disguise)
id = script_getnum(st,2);
if (mobdb_checkid(id) || npcdb_checkid(id)) {
- pc_disguise(sd, id);
+ iPc->disguise(sd, id);
script_pushint(st,id);
} else
script_pushint(st,0);
@@ -11787,7 +11813,7 @@ BUILDIN(undisguise)
if (sd == NULL) return true;
if (sd->disguise != -1) {
- pc_disguise(sd, -1);
+ iPc->disguise(sd, -1);
script_pushint(st,0);
} else {
script_pushint(st,1);
@@ -11802,7 +11828,7 @@ BUILDIN(undisguise)
BUILDIN(classchange)
{
int _class,type;
- struct block_list *bl=map_id2bl(st->oid);
+ struct block_list *bl=iMap->id2bl(st->oid);
if(bl==NULL) return true;
@@ -11821,7 +11847,7 @@ BUILDIN(misceffect)
type=script_getnum(st,2);
if(st->oid && st->oid != fake_nd->bl.id) {
- struct block_list *bl = map_id2bl(st->oid);
+ struct block_list *bl = iMap->id2bl(st->oid);
if (bl)
clif->specialeffect(bl,type,AREA);
} else{
@@ -11883,17 +11909,17 @@ BUILDIN(playBGMall)
int x1 = script_getnum(st,6);
int y1 = script_getnum(st,7);
- map_foreachinarea(playBGM_sub, map_mapname2mapid(map), x0, y0, x1, y1, BL_PC, name);
+ iMap->foreachinarea(playBGM_sub, iMap->mapname2mapid(map), x0, y0, x1, y1, BL_PC, name);
}
else if( script_hasdata(st,3) )
{// entire map
const char* map = script_getstr(st,3);
- map_foreachinmap(playBGM_sub, map_mapname2mapid(map), BL_PC, name);
+ iMap->foreachinmap(playBGM_sub, iMap->mapname2mapid(map), BL_PC, name);
}
else
{// entire server
- map_foreachpc(&playBGM_foreachpc_sub, name);
+ iMap->map_foreachpc(&playBGM_foreachpc_sub, name);
}
return true;
@@ -11935,14 +11961,14 @@ BUILDIN(soundeffectall)
const char* name;
int type;
- bl = (st->rid) ? &(script_rid2sd(st)->bl) : map_id2bl(st->oid);
+ bl = (st->rid) ? &(script_rid2sd(st)->bl) : iMap->id2bl(st->oid);
if (!bl)
return true;
name = script_getstr(st,2);
type = script_getnum(st,3);
- //FIXME: enumerating map squares (map_foreach) is slower than enumerating the list of online players (map_foreachpc?) [ultramage]
+ //FIXME: enumerating map squares (iMap->foreach) is slower than enumerating the list of online players (iMap->foreachpc?) [ultramage]
if(!script_hasdata(st,4))
{ // area around
@@ -11952,7 +11978,7 @@ BUILDIN(soundeffectall)
if(!script_hasdata(st,5))
{ // entire map
const char* map = script_getstr(st,4);
- map_foreachinmap(soundeffect_sub, map_mapname2mapid(map), BL_PC, name, type);
+ iMap->foreachinmap(soundeffect_sub, iMap->mapname2mapid(map), BL_PC, name, type);
}
else
if(script_hasdata(st,8))
@@ -11962,7 +11988,7 @@ BUILDIN(soundeffectall)
int y0 = script_getnum(st,6);
int x1 = script_getnum(st,7);
int y1 = script_getnum(st,8);
- map_foreachinarea(soundeffect_sub, map_mapname2mapid(map), x0, y0, x1, y1, BL_PC, name, type);
+ iMap->foreachinarea(soundeffect_sub, iMap->mapname2mapid(map), x0, y0, x1, y1, BL_PC, name, type);
}
else
{
@@ -11987,7 +12013,7 @@ BUILDIN(petrecovery)
if (pd->recovery)
{ //Halt previous bonus
if (pd->recovery->timer != INVALID_TIMER)
- delete_timer(pd->recovery->timer, pet_recovery_timer);
+ iTimer->delete_timer(pd->recovery->timer, pet_recovery_timer);
} else //Init
pd->recovery = (struct pet_recovery *)aMalloc(sizeof(struct pet_recovery));
@@ -12015,9 +12041,9 @@ BUILDIN(petheal)
if (pd->s_skill->timer != INVALID_TIMER)
{
if (pd->s_skill->id)
- delete_timer(pd->s_skill->timer, pet_skill_support_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_skill_support_timer);
else
- delete_timer(pd->s_skill->timer, pet_heal_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_heal_timer);
}
} else //init memory
pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support));
@@ -12033,7 +12059,7 @@ BUILDIN(petheal)
if (battle_config.pet_equip_required && pd->pet.equip == 0)
pd->s_skill->timer = INVALID_TIMER;
else
- pd->s_skill->timer = add_timer(gettick()+pd->s_skill->delay*1000,pet_heal_timer,sd->bl.id,0);
+ pd->s_skill->timer = iTimer->add_timer(iTimer->gettick()+pd->s_skill->delay*1000,pet_heal_timer,sd->bl.id,0);
return true;
}
@@ -12109,9 +12135,9 @@ BUILDIN(petskillsupport)
if (pd->s_skill->timer != INVALID_TIMER)
{
if (pd->s_skill->id)
- delete_timer(pd->s_skill->timer, pet_skill_support_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_skill_support_timer);
else
- delete_timer(pd->s_skill->timer, pet_heal_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_heal_timer);
}
} else //init memory
pd->s_skill = (struct pet_skill_support *) aMalloc(sizeof(struct pet_skill_support));
@@ -12126,7 +12152,7 @@ BUILDIN(petskillsupport)
if (battle_config.pet_equip_required && pd->pet.equip == 0)
pd->s_skill->timer = INVALID_TIMER;
else
- pd->s_skill->timer = add_timer(gettick()+pd->s_skill->delay*1000,pet_skill_support_timer,sd->bl.id,0);
+ pd->s_skill->timer = iTimer->add_timer(iTimer->gettick()+pd->s_skill->delay*1000,pet_skill_support_timer,sd->bl.id,0);
return true;
}
@@ -12156,7 +12182,7 @@ BUILDIN(skilleffect)
/// npcskilleffect "<skill name>",<level>,<x>,<y>
BUILDIN(npcskilleffect)
{
- struct block_list *bl= map_id2bl(st->oid);
+ struct block_list *bl= iMap->id2bl(st->oid);
uint16 skill_id=( script_isstring(st,2) ? skill->name2id(script_getstr(st,2)) : script_getnum(st,2) );
uint16 skill_lv=script_getnum(st,3);
@@ -12164,7 +12190,7 @@ BUILDIN(npcskilleffect)
int y=script_getnum(st,5);
if (bl)
- clif->skill_poseffect(bl,skill_id,skill_lv,x,y,gettick());
+ clif->skill_poseffect(bl,skill_id,skill_lv,x,y,iTimer->gettick());
return true;
}
@@ -12174,7 +12200,7 @@ BUILDIN(npcskilleffect)
*------------------------------------------*/
BUILDIN(specialeffect)
{
- struct block_list *bl=map_id2bl(st->oid);
+ struct block_list *bl=iMap->id2bl(st->oid);
int type = script_getnum(st,2);
enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA;
@@ -12208,7 +12234,7 @@ BUILDIN(specialeffect2)
enum send_target target = script_hasdata(st,3) ? (send_target)script_getnum(st,3) : AREA;
if( script_hasdata(st,4) )
- sd = map_nick2sd(script_getstr(st,4));
+ sd = iMap->nick2sd(script_getstr(st,4));
if (sd)
clif->specialeffect(&sd->bl, type, target);
@@ -12231,7 +12257,7 @@ BUILDIN(nude)
if( sd->equip_index[ i ] >= 0 ) {
if( !calcflag )
calcflag = 1;
- pc_unequipitem( sd , sd->equip_index[ i ] , 2);
+ iPc->unequipitem( sd , sd->equip_index[ i ] , 2);
}
}
@@ -12263,7 +12289,7 @@ BUILDIN(atcommand)
memset(&dummy_sd, 0, sizeof(TBL_PC));
if (st->oid)
{
- struct block_list* bl = map_id2bl(st->oid);
+ struct block_list* bl = iMap->id2bl(st->oid);
memcpy(&dummy_sd.bl, bl, sizeof(struct block_list));
if (bl->type == BL_NPC)
safestrncpy(dummy_sd.status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
@@ -12397,7 +12423,7 @@ BUILDIN(getmercinfo)
{
char_id = script_getnum(st,3);
- if( ( sd = map_charid2sd(char_id) ) == NULL )
+ if( ( sd = iMap->charid2sd(char_id) ) == NULL )
{
ShowError("buildin_getmercinfo: No such character (char_id=%d).\n", char_id);
script_pushnil(st);
@@ -12491,8 +12517,7 @@ BUILDIN(jump_zero)
/*==========================================
* movenpc [MouseJstr]
*------------------------------------------*/
-BUILDIN(movenpc)
-{
+BUILDIN(movenpc) {
TBL_NPC *nd = NULL;
const char *npc;
int x,y;
@@ -12505,7 +12530,7 @@ BUILDIN(movenpc)
return -1;
if (script_hasdata(st,5))
- nd->ud.dir = script_getnum(st,5) % 8;
+ nd->dir = script_getnum(st,5) % 8;
npc_movenpc(nd, x, y);
return true;
}
@@ -12521,7 +12546,7 @@ BUILDIN(message)
player = script_getstr(st,2);
msg = script_getstr(st,3);
- if((pl_sd=map_nick2sd((char *) player)) == NULL)
+ if((pl_sd=iMap->nick2sd((char *) player)) == NULL)
return true;
clif->message(pl_sd->fd, msg);
@@ -12536,7 +12561,7 @@ BUILDIN(npctalk)
const char* str;
char name[NAME_LENGTH], message[256];
- struct npc_data* nd = (struct npc_data *)map_id2bl(st->oid);
+ struct npc_data* nd = (struct npc_data *)iMap->id2bl(st->oid);
str = script_getstr(st,2);
if(nd)
@@ -12557,26 +12582,35 @@ BUILDIN(npcspeed)
int speed;
speed = script_getnum(st,2);
- nd =(struct npc_data *)map_id2bl(st->oid);
+ nd =(struct npc_data *)iMap->id2bl(st->oid);
- if( nd )
- {
+ if( nd ) {
+ if( nd->ud == &npc_base_ud ) {
+ nd->ud = NULL;
+ CREATE(nd->ud, struct unit_data, 1);
+ unit_dataset(&nd->bl);
+ }
nd->speed = speed;
- nd->ud.state.speed_changed = 1;
+ nd->ud->state.speed_changed = 1;
}
return true;
}
// make an npc walk to a position [Valaris]
-BUILDIN(npcwalkto)
-{
- struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid);
+BUILDIN(npcwalkto) {
+ struct npc_data *nd=(struct npc_data *)iMap->id2bl(st->oid);
int x=0,y=0;
x=script_getnum(st,2);
y=script_getnum(st,3);
if(nd) {
+ if( nd->ud == &npc_base_ud ) {
+ nd->ud = NULL;
+ CREATE(nd->ud, struct unit_data, 1);
+ unit_dataset(&nd->bl);
+ }
+
if (!nd->status.hp) {
status_calc_npc(nd, true);
} else {
@@ -12590,7 +12624,7 @@ BUILDIN(npcwalkto)
// stop an npc's movement [Valaris]
BUILDIN(npcstop)
{
- struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid);
+ struct npc_data *nd=(struct npc_data *)iMap->id2bl(st->oid);
if(nd) {
unit_stop_walking(&nd->bl,1|4);
@@ -12711,7 +12745,7 @@ BUILDIN(getmapxy)
switch (type){
case 0: //Get Character Position
if( script_hasdata(st,6) )
- sd=map_nick2sd(script_getstr(st,6));
+ sd=iMap->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12726,11 +12760,11 @@ BUILDIN(getmapxy)
if (nd)
bl = &nd->bl;
} else //In case the origin is not an npc?
- bl=map_id2bl(st->oid);
+ bl=iMap->id2bl(st->oid);
break;
case 2: //Get Pet Position
if(script_hasdata(st,6))
- sd=map_nick2sd(script_getstr(st,6));
+ sd=iMap->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12741,7 +12775,7 @@ BUILDIN(getmapxy)
break; //Not supported?
case 4: //Get Homun Position
if(script_hasdata(st,6))
- sd=map_nick2sd(script_getstr(st,6));
+ sd=iMap->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12750,7 +12784,7 @@ BUILDIN(getmapxy)
break;
case 5: //Get Mercenary Position
if(script_hasdata(st,6))
- sd=map_nick2sd(script_getstr(st,6));
+ sd=iMap->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12759,7 +12793,7 @@ BUILDIN(getmapxy)
break;
case 6: //Get Elemental Position
if(script_hasdata(st,6))
- sd=map_nick2sd(script_getstr(st,6));
+ sd=iMap->nick2sd(script_getstr(st,6));
else
sd=script_rid2sd(st);
@@ -12771,7 +12805,7 @@ BUILDIN(getmapxy)
script_pushint(st,-1);
return false;
}
- if (!bl) { //No object found.
+ if (!bl || bl->m == -1) { //No object found.
script_pushint(st,-1);
return true;
}
@@ -12841,7 +12875,7 @@ BUILDIN(summon)
const char *str,*event="";
TBL_PC *sd;
struct mob_data *md;
- int tick = gettick();
+ int tick = iTimer->gettick();
sd=script_rid2sd(st);
if (!sd) return true;
@@ -12862,8 +12896,8 @@ BUILDIN(summon)
md->master_id=sd->bl.id;
md->special_state.ai = AI_ATTACK;
if( md->deletetimer != INVALID_TIMER )
- delete_timer(md->deletetimer, mob_timer_delete);
- md->deletetimer = add_timer(tick+(timeout>0?timeout*1000:60000),mob_timer_delete,md->bl.id,0);
+ iTimer->delete_timer(md->deletetimer, mob_timer_delete);
+ md->deletetimer = iTimer->add_timer(tick+(timeout>0?timeout*1000:60000),mob_timer_delete,md->bl.id,0);
mob_spawn (md); //Now it is ready for spawning.
clif->specialeffect(&md->bl,344,AREA);
sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000);
@@ -12876,13 +12910,13 @@ BUILDIN(summon)
*------------------------------------------*/
BUILDIN(isnight)
{
- script_pushint(st,(night_flag == 1));
+ script_pushint(st,(iMap->night_flag == 1));
return true;
}
BUILDIN(isday)
{
- script_pushint(st,(night_flag == 0));
+ script_pushint(st,(iMap->night_flag == 0));
return true;
}
@@ -13082,12 +13116,12 @@ BUILDIN(getrefine)
*-------------------------------------------------------*/
BUILDIN(night)
{
- if (night_flag != 1) map_night_timer(night_timer_tid, 0, 0, 1);
+ if (iMap->night_flag != 1) iPc->map_night_timer(iPc->night_timer_tid, 0, 0, 1);
return true;
}
BUILDIN(day)
{
- if (night_flag != 0) map_day_timer(day_timer_tid, 0, 0, 1);
+ if (iMap->night_flag != 0) iPc->map_day_timer(iPc->day_timer_tid, 0, 0, 1);
return true;
}
@@ -13104,9 +13138,9 @@ BUILDIN(unequip)
sd = script_rid2sd(st);
if( sd != NULL && num >= 1 && num <= ARRAYLENGTH(equip) )
{
- i = pc_checkequip(sd,equip[num-1]);
+ i = iPc->checkequip(sd,equip[num-1]);
if (i >= 0)
- pc_unequipitem(sd,i,1|2);
+ iPc->unequipitem(sd,i,1|2);
}
return true;
}
@@ -13127,7 +13161,7 @@ BUILDIN(equip)
}
ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == nameid );
if( i < MAX_INVENTORY )
- pc_equipitem(sd,i,item_data->equip);
+ iPc->equipitem(sd,i,item_data->equip);
return true;
}
@@ -14450,7 +14484,7 @@ BUILDIN(npcshopattach)
}
if (flag)
- nd->master_nd = ((struct npc_data *)map_id2bl(st->oid));
+ nd->master_nd = ((struct npc_data *)iMap->id2bl(st->oid));
else
nd->master_nd = NULL;
@@ -14584,7 +14618,7 @@ BUILDIN(checkvending) // check vending [Nab4]
TBL_PC *sd = NULL;
if(script_hasdata(st,2))
- sd = map_nick2sd(script_getstr(st,2));
+ sd = iMap->nick2sd(script_getstr(st,2));
else
sd = script_rid2sd(st);
@@ -14602,7 +14636,7 @@ BUILDIN(checkchatting) // check chatting [Marka]
TBL_PC *sd = NULL;
if(script_hasdata(st,2))
- sd = map_nick2sd(script_getstr(st,2));
+ sd = iMap->nick2sd(script_getstr(st,2));
else
sd = script_rid2sd(st);
@@ -14619,7 +14653,7 @@ BUILDIN(checkidle)
TBL_PC *sd = NULL;
if (script_hasdata(st, 2))
- sd = map_nick2sd(script_getstr(st, 2));
+ sd = iMap->nick2sd(script_getstr(st, 2));
else
sd = script_rid2sd(st);
@@ -14746,7 +14780,7 @@ BUILDIN(rid2name)
{
struct block_list *bl = NULL;
int rid = script_getnum(st,2);
- if((bl = map_id2bl(rid)))
+ if((bl = iMap->id2bl(rid)))
{
switch(bl->type) {
case BL_MOB: script_pushstrcopy(st,((TBL_MOB*)bl)->name); break;
@@ -14776,7 +14810,7 @@ BUILDIN(pcblockmove)
flag = script_getnum(st,3);
if(id)
- sd = map_id2sd(id);
+ sd = iMap->id2sd(id);
else
sd = script_rid2sd(st);
@@ -14796,12 +14830,12 @@ BUILDIN(pcfollow)
targetid = script_getnum(st,3);
if(id)
- sd = map_id2sd(id);
+ sd = iMap->id2sd(id);
else
sd = script_rid2sd(st);
if(sd)
- pc_follow(sd, targetid);
+ iPc->follow(sd, targetid);
return true;
}
@@ -14815,12 +14849,12 @@ BUILDIN(pcstopfollow)
id = script_getnum(st,2);
if(id)
- sd = map_id2sd(id);
+ sd = iMap->id2sd(id);
else
sd = script_rid2sd(st);
if(sd)
- pc_stop_following(sd);
+ iPc->stop_following(sd);
return true;
}
@@ -14837,7 +14871,7 @@ BUILDIN(unitwalk)
{
struct block_list* bl;
- bl = map_id2bl(script_getnum(st,2));
+ bl = iMap->id2bl(script_getnum(st,2));
if( bl == NULL )
{
script_pushint(st, 0);
@@ -14851,7 +14885,7 @@ BUILDIN(unitwalk)
else
{
int map_id = script_getnum(st,3);
- script_pushint(st, unit_walktobl(bl,map_id2bl(map_id),65025,1));
+ script_pushint(st, unit_walktobl(bl,iMap->id2bl(map_id),65025,1));
}
return true;
@@ -14862,7 +14896,7 @@ BUILDIN(unitwalk)
/// unitkill <unit_id>;
BUILDIN(unitkill)
{
- struct block_list* bl = map_id2bl(script_getnum(st,2));
+ struct block_list* bl = iMap->id2bl(script_getnum(st,2));
if( bl != NULL )
status_kill(bl);
@@ -14888,14 +14922,14 @@ BUILDIN(unitwarp)
y = (short)script_getnum(st,5);
if (!unit_id) //Warp the script's runner
- bl = map_id2bl(st->rid);
+ bl = iMap->id2bl(st->rid);
else
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( strcmp(mapname,"this") == 0 )
map = bl?bl->m:-1;
else
- map = map_mapname2mapid(mapname);
+ map = iMap->mapname2mapid(mapname);
if( map >= 0 && bl != NULL )
script_pushint(st, unit_warp(bl,map,x,y,CLR_OUTSIGHT));
@@ -14920,7 +14954,7 @@ BUILDIN(unitattack)
int actiontype = 0;
// get unit
- unit_bl = map_id2bl(script_getnum(st,2));
+ unit_bl = iMap->id2bl(script_getnum(st,2));
if( unit_bl == NULL ) {
script_pushint(st, 0);
return true;
@@ -14930,11 +14964,11 @@ BUILDIN(unitattack)
get_val(st, data);
if( data_isstring(data) )
{
- TBL_PC* sd = map_nick2sd(script->conv_str(st, data));
+ TBL_PC* sd = iMap->nick2sd(script->conv_str(st, data));
if( sd != NULL )
target_bl = &sd->bl;
} else
- target_bl = map_id2bl(script->conv_num(st, data));
+ target_bl = iMap->id2bl(script->conv_num(st, data));
// request the attack
if( target_bl == NULL )
{
@@ -14949,7 +14983,7 @@ BUILDIN(unitattack)
switch( unit_bl->type )
{
case BL_PC:
- clif->pActionRequest_sub(((TBL_PC *)unit_bl), actiontype > 0 ? 0x07 : 0x00, target_bl->id, gettick());
+ clif->pActionRequest_sub(((TBL_PC *)unit_bl), actiontype > 0 ? 0x07 : 0x00, target_bl->id, iTimer->gettick());
script_pushint(st, 1);
return true;
case BL_MOB:
@@ -14977,7 +15011,7 @@ BUILDIN(unitstop)
unit_id = script_getnum(st,2);
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( bl != NULL )
{
unit_stop_attack(bl);
@@ -15001,7 +15035,7 @@ BUILDIN(unittalk)
unit_id = script_getnum(st,2);
message = script_getstr(st, 3);
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( bl != NULL )
{
struct StringBuf sbuf;
@@ -15029,7 +15063,7 @@ BUILDIN(unitemote)
unit_id = script_getnum(st,2);
emotion = script_getnum(st,3);
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( bl != NULL )
clif->emotion(bl, emotion);
@@ -15053,7 +15087,7 @@ BUILDIN(unitskilluseid)
skill_lv = script_getnum(st,4);
target_id = ( script_hasdata(st,5) ? script_getnum(st,5) : unit_id );
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( bl != NULL )
unit_skilluse_id(bl, target_id, skill_id, skill_lv);
@@ -15079,7 +15113,7 @@ BUILDIN(unitskillusepos)
skill_x = script_getnum(st,5);
skill_y = script_getnum(st,6);
- bl = map_id2bl(unit_id);
+ bl = iMap->id2bl(unit_id);
if( bl != NULL )
unit_skilluse_pos(bl, skill_x, skill_y, skill_id, skill_lv);
@@ -15128,7 +15162,7 @@ BUILDIN(sleep2)
if( ticks <= 0 )
{// do nothing
- script_pushint(st, (map_id2sd(st->rid)!=NULL));
+ script_pushint(st, (iMap->id2sd(st->rid)!=NULL));
}
else if( !st->sleep.tick )
{// sleep for the target amount of time
@@ -15139,7 +15173,7 @@ BUILDIN(sleep2)
{// sleep time is over
st->state = RUN;
st->sleep.tick = 0;
- script_pushint(st, (map_id2sd(st->rid)!=NULL));
+ script_pushint(st, (iMap->id2sd(st->rid)!=NULL));
}
return true;
}
@@ -15163,7 +15197,7 @@ BUILDIN(awake)
if( (int)__64BPTRSIZE(node->key) == nd->bl.id )
{// sleep timer for the npc
struct script_state* tst = (struct script_state*)node->data;
- TBL_PC* sd = map_id2sd(tst->rid);
+ TBL_PC* sd = iMap->id2sd(tst->rid);
if( tst->sleep.timer == INVALID_TIMER )
{// already awake ???
@@ -15176,7 +15210,7 @@ BUILDIN(awake)
tst->rid = 0;
}
- delete_timer(tst->sleep.timer, run_script_timer);
+ iTimer->delete_timer(tst->sleep.timer, run_script_timer);
node = script_erase_sleepdb(node);
tst->sleep.timer = INVALID_TIMER;
if(tst->state != RERUNLINE)
@@ -15250,7 +15284,7 @@ BUILDIN(warpportal)
struct skill_unit_group* group;
struct block_list* bl;
- bl = map_id2bl(st->oid);
+ bl = iMap->id2bl(st->oid);
if( bl == NULL )
{
ShowError("script:warpportal: npc is needed\n");
@@ -15309,12 +15343,12 @@ BUILDIN(openauction)
/// @see cell_chk* constants in const.txt for the types
BUILDIN(checkcell)
{
- int16 m = map_mapname2mapid(script_getstr(st,2));
+ int16 m = iMap->mapname2mapid(script_getstr(st,2));
int16 x = script_getnum(st,3);
int16 y = script_getnum(st,4);
cell_chk type = (cell_chk)script_getnum(st,5);
- script_pushint(st, map_getcell(m, x, y, type));
+ script_pushint(st, iMap->getcell(m, x, y, type));
return true;
}
@@ -15326,7 +15360,7 @@ BUILDIN(checkcell)
/// @see cell_* constants in const.txt for the types
BUILDIN(setcell)
{
- int16 m = map_mapname2mapid(script_getstr(st,2));
+ int16 m = iMap->mapname2mapid(script_getstr(st,2));
int16 x1 = script_getnum(st,3);
int16 y1 = script_getnum(st,4);
int16 x2 = script_getnum(st,5);
@@ -15341,7 +15375,7 @@ BUILDIN(setcell)
for( y = y1; y <= y2; ++y )
for( x = x1; x <= x2; ++x )
- map_setcell(m, x, y, type, flag);
+ map[m].setcell(m, x, y, type, flag);
return true;
}
@@ -15596,7 +15630,7 @@ BUILDIN(checkquest)
BUILDIN(showevent)
{
TBL_PC *sd = script_rid2sd(st);
- struct npc_data *nd = map_id2nd(st->oid);
+ struct npc_data *nd = iMap->id2nd(st->oid);
int state, color;
if( sd == NULL || nd == NULL )
@@ -15625,9 +15659,9 @@ BUILDIN(waitingroom2bg)
if( script_hasdata(st,7) )
nd = npc_name2id(script_getstr(st,7));
else
- nd = (struct npc_data *)map_id2bl(st->oid);
+ nd = (struct npc_data *)iMap->id2bl(st->oid);
- if( nd == NULL || (cd = (struct chat_data *)map_id2bl(nd->chat_id)) == NULL )
+ if( nd == NULL || (cd = (struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL )
{
script_pushint(st,0);
return true;
@@ -15686,7 +15720,7 @@ BUILDIN(waitingroom2bg_single)
y = script_getnum(st,5);
nd = npc_name2id(script_getstr(st,6));
- if( nd == NULL || (cd = (struct chat_data *)map_id2bl(nd->chat_id)) == NULL || cd->users <= 0 )
+ if( nd == NULL || (cd = (struct chat_data *)iMap->id2bl(nd->chat_id)) == NULL || cd->users <= 0 )
return true;
if( (sd = cd->usersd[0]) == NULL )
@@ -15694,7 +15728,7 @@ BUILDIN(waitingroom2bg_single)
if( bg_team_join(bg_id, sd) )
{
- pc_setpos(sd, mapindex, x, y, CLR_TELEPORT);
+ iPc->setpos(sd, mapindex, x, y, CLR_TELEPORT);
script_pushint(st,1);
}
else
@@ -15756,7 +15790,7 @@ BUILDIN(bg_monster_set_team)
int id = script_getnum(st,2),
bg_id = script_getnum(st,3);
- if( (mbl = map_id2bl(id)) == NULL || mbl->type != BL_MOB )
+ if( (mbl = iMap->id2bl(id)) == NULL || mbl->type != BL_MOB )
return true;
md = (TBL_MOB *)mbl;
md->bg_id = bg_id;
@@ -15798,7 +15832,7 @@ BUILDIN(bg_getareausers)
bg_id = script_getnum(st,2);
str = script_getstr(st,3);
- if( (bg = bg_team_search(bg_id)) == NULL || (m = map_mapname2mapid(str)) < 0 )
+ if( (bg = bg_team_search(bg_id)) == NULL || (m = iMap->mapname2mapid(str)) < 0 )
{
script_pushint(st,0);
return true;
@@ -15828,7 +15862,7 @@ BUILDIN(bg_updatescore)
int16 m;
str = script_getstr(st,2);
- if( (m = map_mapname2mapid(str)) < 0 )
+ if( (m = iMap->mapname2mapid(str)) < 0 )
return true;
map[m].bgscore_lion = script_getnum(st,3);
@@ -15865,25 +15899,28 @@ BUILDIN(bg_get_data)
* Instancing Script Commands
*------------------------------------------*/
-BUILDIN(instance_create)
-{
+BUILDIN(instance_create) {
const char *name;
- int party_id, res;
+ int owner_id, res;
+ int type = IOT_PARTY;
name = script_getstr(st, 2);
- party_id = script_getnum(st, 3);
+ owner_id = script_getnum(st, 3);
+ if( script_hasdata(st,4) ) {
+ type = script_getnum(st, 4);
+ if( type < IOT_NONE || type >= IOT_MAX ) {
+ ShowError("buildin_instance_create: unknown instance type %d for '%s'\n",type,name);
+ return true;
+ }
+ }
- res = instance_create(party_id, name);
- if( res == -4 ) // Already exists
- {
+ res = instance->create(owner_id, name, (enum instance_owner_type) type);
+ if( res == -4 ) { // Already exists
script_pushint(st, -1);
return true;
- }
- else if( res < 0 )
- {
+ } else if( res < 0 ) {
const char *err;
- switch(res)
- {
+ switch(res) {
case -3: err = "No free instances"; break;
case -2: err = "Invalid party ID"; break;
case -1: err = "Invalid type"; break;
@@ -15898,44 +15935,39 @@ BUILDIN(instance_create)
return true;
}
-BUILDIN(instance_destroy)
-{
- int instance_id;
- struct map_session_data *sd;
- struct party_data *p;
+BUILDIN(instance_destroy) {
+ int instance_id = -1;
if( script_hasdata(st, 2) )
instance_id = script_getnum(st, 2);
- else if( st->instance_id )
+ else if( st->instance_id >= 0 )
instance_id = st->instance_id;
- else if( (sd = script_rid2sd(st)) != NULL && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id )
- instance_id = p->instance_id;
else return true;
- if( instance_id <= 0 || instance_id >= MAX_INSTANCE )
- {
+ if( !instance->valid(instance_id) ) {
ShowError("buildin_instance_destroy: Trying to destroy invalid instance %d.\n", instance_id);
return true;
}
- instance_destroy(instance_id);
+ instance->destroy(instance_id);
return true;
}
-BUILDIN(instance_attachmap)
-{
- const char *name;
+BUILDIN(instance_attachmap) {
+ const char *name, *map_name = NULL;
int16 m;
- int instance_id;
+ int instance_id = -1;
bool usebasename = false;
name = script_getstr(st,2);
instance_id = script_getnum(st,3);
- if( script_hasdata(st,4) && script_getnum(st,4) > 0)
+ if( script_hasdata(st,4) && script_getnum(st,4) > 0 )
usebasename = true;
- if( (m = instance_add_map(name, instance_id, usebasename)) < 0 ) // [Saithis]
- {
+ if( script_hasdata(st, 5) )
+ map_name = script_getstr(st, 5);
+
+ if( (m = instance->add_map(name, instance_id, usebasename, map_name)) < 0 ) { // [Saithis]
ShowError("buildin_instance_attachmap: instance creation failed (%s): %d\n", name, m);
script_pushconststr(st, "");
return true;
@@ -15945,109 +15977,81 @@ BUILDIN(instance_attachmap)
return true;
}
-BUILDIN(instance_detachmap)
-{
- struct map_session_data *sd;
- struct party_data *p;
+BUILDIN(instance_detachmap) {
const char *str;
int16 m;
- int instance_id;
+ int instance_id = -1;
str = script_getstr(st, 2);
if( script_hasdata(st, 3) )
instance_id = script_getnum(st, 3);
- else if( st->instance_id )
+ else if( st->instance_id >= 0 )
instance_id = st->instance_id;
- else if( (sd = script_rid2sd(st)) != NULL && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id )
- instance_id = p->instance_id;
else return true;
- if( (m = map_mapname2mapid(str)) < 0 || (m = instance_map2imap(m,instance_id)) < 0 )
- {
+ if( (m = iMap->mapname2mapid(str)) < 0 || (m = instance->map2imap(m,instance_id)) < 0 ) {
ShowError("buildin_instance_detachmap: Trying to detach invalid map %s\n", str);
return true;
}
- instance_del_map(m);
+ instance->del_map(m);
return true;
}
-BUILDIN(instance_attach)
-{
- int instance_id;
+BUILDIN(instance_attach) {
+ int instance_id = -1;
instance_id = script_getnum(st, 2);
- if( instance_id <= 0 || instance_id >= MAX_INSTANCE )
+ if( !instance->valid(instance_id) )
return true;
st->instance_id = instance_id;
return true;
}
-BUILDIN(instance_id)
-{
- int instance_id;
-
- if( script_hasdata(st, 2) )
- {
- struct party_data *p;
- struct map_session_data *sd;
- int type;
- type = script_getnum(st, 2);
- if( type == 0 )
- instance_id = st->instance_id;
- else if( type == 1 && (sd = script_rid2sd(st)) != NULL && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL )
- instance_id = p->instance_id;
- else
- instance_id = 0;
- }
- else
- instance_id = st->instance_id;
-
- script_pushint(st, instance_id);
+BUILDIN(instance_id) {
+ script_pushint(st, st->instance_id);
return true;
}
BUILDIN(instance_set_timeout)
{
int progress_timeout, idle_timeout;
- int instance_id;
- struct map_session_data *sd;
- struct party_data *p;
+ int instance_id = -1;
progress_timeout = script_getnum(st, 2);
idle_timeout = script_getnum(st, 3);
if( script_hasdata(st, 4) )
instance_id = script_getnum(st, 4);
- else if( st->instance_id )
+ else if( st->instance_id >= 0 )
instance_id = st->instance_id;
- else if( (sd = script_rid2sd(st)) != NULL && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id )
- instance_id = p->instance_id;
else return true;
- if( instance_id > 0 )
- instance_set_timeout(instance_id, progress_timeout, idle_timeout);
+ if( instance_id >= 0 )
+ instance->set_timeout(instance_id, progress_timeout, idle_timeout);
return true;
}
-BUILDIN(instance_init)
-{
+BUILDIN(instance_init) {
int instance_id = script_getnum(st, 2);
- if( instance[instance_id].state != INSTANCE_IDLE )
- {
+ if( !instance->valid(instance_id) ) {
+ ShowError("instance_init: invalid instance id %d.\n",instance_id);
+ return true;
+ }
+
+ if( instances[instance_id].state != INSTANCE_IDLE ) {
ShowError("instance_init: instance already initialized.\n");
return true;
}
- instance_init(instance_id);
+ instance->start(instance_id);
return true;
}
-BUILDIN(instance_announce)
-{
+BUILDIN(instance_announce) {
int instance_id = script_getnum(st,2);
const char *mes = script_getstr(st,3);
int flag = script_getnum(st,4);
@@ -16058,53 +16062,40 @@ BUILDIN(instance_announce)
int fontY = script_hasdata(st,9) ? script_getnum(st,9) : 0; // default fontY
int i;
- struct map_session_data *sd;
- struct party_data *p;
- if( instance_id == 0 )
- {
- if( st->instance_id )
+ if( instance_id == -1 ) {
+ if( st->instance_id >= 0 )
instance_id = st->instance_id;
- else if( (sd = script_rid2sd(st)) != NULL && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id )
- instance_id = p->instance_id;
- else return true;
+ else
+ return true;
}
- if( instance_id <= 0 || instance_id >= MAX_INSTANCE )
+ if( !instance->valid(instance_id) )
return true;
- for( i = 0; i < instance[instance_id].num_map; i++ )
- map_foreachinmap(buildin_announce_sub, instance[instance_id].map[i], BL_PC,
+ for( i = 0; i < instances[instance_id].num_map; i++ )
+ iMap->foreachinmap(buildin_announce_sub, instances[instance_id].map[i], BL_PC,
mes, strlen(mes)+1, flag&0xf0, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
}
-BUILDIN(instance_npcname)
-{
+BUILDIN(instance_npcname) {
const char *str;
- int instance_id = 0;
-
- struct map_session_data *sd;
- struct party_data *p;
+ int instance_id = -1;
struct npc_data *nd;
str = script_getstr(st, 2);
if( script_hasdata(st, 3) )
instance_id = script_getnum(st, 3);
- else if( st->instance_id )
+ else if( st->instance_id >= 0 )
instance_id = st->instance_id;
- else if( (sd = script_rid2sd(st)) != NULL && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id )
- instance_id = p->instance_id;
- if( instance_id && (nd = npc_name2id(str)) != NULL )
- {
+ if( instance_id >= 0 && (nd = npc_name2id(str)) != NULL ) {
static char npcname[NAME_LENGTH];
snprintf(npcname, sizeof(npcname), "dup_%d_%d", instance_id, nd->bl.id);
script_pushconststr(st,npcname);
- }
- else
- {
+ } else {
ShowError("script:instance_npcname: invalid instance NPC (instance_id: %d, NPC name: \"%s\".)\n", instance_id, str);
st->state = END;
return false;
@@ -16113,24 +16104,56 @@ BUILDIN(instance_npcname)
return true;
}
-BUILDIN(has_instance)
-{
+BUILDIN(has_instance) {
struct map_session_data *sd;
- struct party_data *p;
const char *str;
int16 m;
- int instance_id = 0;
+ int instance_id = -1;
str = script_getstr(st, 2);
+
+ if( (m = iMap->mapname2mapid(str)) < 0 ) {
+ script_pushconststr(st, "");
+ return true;
+ }
+
if( script_hasdata(st, 3) )
instance_id = script_getnum(st, 3);
- else if( st->instance_id )
+ else if( st->instance_id >= 0 )
instance_id = st->instance_id;
- else if( (sd = script_rid2sd(st)) != NULL && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id )
- instance_id = p->instance_id;
+ else if( (sd = script_rid2sd(st)) != NULL ) {
+ struct party_data *p;
+ int i = 0, j = 0;
+ if( sd->instances ) {
+ for( i = 0; i < sd->instances; i++ ) {
+ ARR_FIND(0, instances[sd->instance[i]].num_map, j, map[instances[sd->instance[i]].map[j]].instance_src_map == m);
+ if( j != instances[sd->instance[i]].num_map )
+ break;
+ }
+ if( i != sd->instances )
+ instance_id = sd->instance[i];
+ }
+ if( instance_id == -1 && sd->status.party_id && (p = iParty->search(sd->status.party_id)) && p->instances ) {
+ for( i = 0; i < p->instances; i++ ) {
+ ARR_FIND(0, instances[p->instance[i]].num_map, j, map[instances[p->instance[i]].map[j]].instance_src_map == m);
+ if( j != instances[p->instance[i]].num_map )
+ break;
+ }
+ if( i != p->instances )
+ instance_id = p->instance[i];
+ }
+ if( instance_id == -1 && sd->guild && sd->guild->instances ) {
+ for( i = 0; i < sd->guild->instances; i++ ) {
+ ARR_FIND(0, instances[sd->guild->instance[i]].num_map, j, map[instances[sd->guild->instance[i]].map[j]].instance_src_map == m);
+ if( j != instances[sd->guild->instance[i]].num_map )
+ break;
+ }
+ if( i != sd->guild->instances )
+ instance_id = sd->guild->instance[i];
+ }
+ }
- if( !instance_id || (m = map_mapname2mapid(str)) < 0 || (m = instance_map2imap(m, instance_id)) < 0 )
- {
+ if( !instance->valid(instance_id) || (m = instance->map2imap(m, instance_id)) < 0 ) {
script_pushconststr(st, "");
return true;
}
@@ -16138,38 +16161,41 @@ BUILDIN(has_instance)
script_pushconststr(st, map[m].name);
return true;
}
-
-BUILDIN(instance_warpall)
-{
- struct map_session_data *pl_sd;
- int16 m, i;
- int instance_id;
+static int buildin_instance_warpall_sub(struct block_list *bl,va_list ap) {
+ struct map_session_data *sd = ((TBL_PC*)bl);
+ int mapindex = va_arg(ap,int);
+ int x = va_arg(ap,int);
+ int y = va_arg(ap,int);
+
+ iPc->setpos(sd,mapindex,x,y,CLR_TELEPORT);
+
+ return 0;
+}
+BUILDIN(instance_warpall) {
+ int16 m;
+ int instance_id = -1;
const char *mapn;
int x, y;
- unsigned short mapindex;
- struct party_data *p = NULL;
+ int mapindex;
mapn = script_getstr(st,2);
x = script_getnum(st,3);
y = script_getnum(st,4);
+
if( script_hasdata(st,5) )
instance_id = script_getnum(st,5);
- else if( st->instance_id )
+ else if( st->instance_id >= 0 )
instance_id = st->instance_id;
- else if( (pl_sd = script_rid2sd(st)) != NULL && pl_sd->status.party_id && (p = party_search(pl_sd->status.party_id)) != NULL && p->instance_id )
- instance_id = p->instance_id;
- else return true;
-
- if( (m = map_mapname2mapid(mapn)) < 0 || (map[m].flag.src4instance && (m = instance_mapid2imapid(m, instance_id)) < 0) )
+ else
return true;
- if( !(p = party_search(instance[instance_id].party_id)) )
+ if( (m = iMap->mapname2mapid(mapn)) < 0 || (map[m].flag.src4instance && (m = instance->mapid2imapid(m, instance_id)) < 0) )
return true;
-
+
mapindex = map_id2index(m);
- for( i = 0; i < MAX_PARTY; i++ )
- if( (pl_sd = p->data[i].sd) && map[pl_sd->bl.m].instance_id == st->instance_id ) pc_setpos(pl_sd,mapindex,x,y,CLR_TELEPORT);
+ iMap->foreachininstance(buildin_instance_warpall_sub, instance_id, BL_PC,mapindex,x,y);
+
return true;
}
@@ -16183,8 +16209,7 @@ BUILDIN(instance_warpall)
* Example: instance_check_party (getcharid(1){,amount}{,min}{,max});
* Example 2: instance_check_party (getcharid(1),1,1,99);
*------------------------------------------*/
-BUILDIN(instance_check_party)
-{
+BUILDIN(instance_check_party) {
struct map_session_data *pl_sd;
int amount, min, max, i, party_id, c = 0;
struct party_data *p = NULL;
@@ -16205,14 +16230,14 @@ BUILDIN(instance_check_party)
party_id = script_getnum(st,2);
else return true;
- if( !(p = party_search(party_id)) ){
+ if( !(p = iParty->search(party_id)) ){
script_pushint(st, 0); // Returns false if party does not exist.
return true;
}
for( i = 0; i < MAX_PARTY; i++ )
if( (pl_sd = p->data[i].sd) )
- if(map_id2bl(pl_sd->bl.id)){
+ if(iMap->id2bl(pl_sd->bl.id)){
if(pl_sd->status.base_level < min){
script_pushint(st, 0);
return true;
@@ -16268,9 +16293,9 @@ static int buildin_mobuseskill_sub(struct block_list *bl,va_list ap)
// 0:self, 1:target, 2:master, default:random
switch( target )
{
- case 0: tbl = map_id2bl(md->bl.id); break;
- case 1: tbl = map_id2bl(md->target_id); break;
- case 2: tbl = map_id2bl(md->master_id); break;
+ case 0: tbl = iMap->id2bl(md->bl.id); break;
+ case 1: tbl = iMap->id2bl(md->target_id); break;
+ case 2: tbl = iMap->id2bl(md->master_id); break;
default:tbl = battle->get_enemy(&md->bl, DEFAULT_ENEMY_TYPE(md),skill->get_range2(&md->bl, skill_id, skill_lv)); break;
}
@@ -16298,13 +16323,12 @@ BUILDIN(areamobuseskill)
int16 m;
int range,mobid,skill_id,skill_lv,casttime,emotion,target,cancel;
- if( (m = map_mapname2mapid(script_getstr(st,2))) < 0 )
- {
+ if( (m = iMap->mapname2mapid(script_getstr(st,2))) < 0 ) {
ShowError("areamobuseskill: invalid map name.\n");
return true;
}
- if( map[m].flag.src4instance && st->instance_id && (m = instance_mapid2imapid(m, st->instance_id)) < 0 )
+ if( map[m].flag.src4instance && st->instance_id >= 0 && (m = instance->mapid2imapid(m, st->instance_id)) < 0 )
return true;
center.m = m;
@@ -16319,7 +16343,7 @@ BUILDIN(areamobuseskill)
emotion = script_getnum(st,11);
target = script_getnum(st,12);
- map_foreachinrange(buildin_mobuseskill_sub, &center, range, BL_MOB, mobid, skill_id, skill_lv, casttime, cancel, emotion, target);
+ iMap->foreachinrange(buildin_mobuseskill_sub, &center, range, BL_MOB, mobid, skill_id, skill_lv, casttime, cancel, emotion, target);
return true;
}
@@ -16339,7 +16363,7 @@ BUILDIN(progressbar)
second = script_getnum(st,3);
sd->progressbar.npc_id = st->oid;
- sd->progressbar.timeout = gettick() + second*1000;
+ sd->progressbar.timeout = iTimer->gettick() + second*1000;
clif->progressbar(sd, strtol(color, (char **)NULL, 0), second);
return true;
@@ -16500,10 +16524,10 @@ BUILDIN(setdragon) {
if( (sd = script_rid2sd(st)) == NULL )
return true;
- if( !pc_checkskill(sd,RK_DRAGONTRAINING) || (sd->class_&MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT )
+ if( !iPc->checkskill(sd,RK_DRAGONTRAINING) || (sd->class_&MAPID_THIRDMASK) != MAPID_RUNE_KNIGHT )
script_pushint(st,0);//Doesn't have the skill or it's not a Rune Knight
else if ( pc_isridingdragon(sd) ) {//Is mounted; release
- pc_setoption(sd, sd->sc.option&~OPTION_DRAGON);
+ iPc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
script_pushint(st,1);
} else {//Not mounted; Mount now.
unsigned int option = OPTION_DRAGON1;
@@ -16518,7 +16542,7 @@ BUILDIN(setdragon) {
option = OPTION_DRAGON1;
}
}
- pc_setoption(sd, sd->sc.option|option);
+ iPc->setoption(sd, sd->sc.option|option);
script_pushint(st,1);
}
return true;
@@ -16588,12 +16612,12 @@ BUILDIN(getcharip)
if( script_hasdata(st, 2) )
{
if (script_isstring(st, 2))
- sd = map_nick2sd(script_getstr(st, 2));
+ sd = iMap->nick2sd(script_getstr(st, 2));
else if (script_isint(st, 2) || script_getnum(st, 2))
{
int id;
id = script_getnum(st, 2);
- sd = (map_id2sd(id) ? map_id2sd(id) : map_charid2sd(id));
+ sd = (iMap->id2sd(id) ? iMap->id2sd(id) : iMap->charid2sd(id));
}
}
else
@@ -16779,7 +16803,7 @@ BUILDIN(useatcmd)
memset(&dummy_sd, 0, sizeof(TBL_PC));
if( st->oid )
{
- struct block_list* bl = map_id2bl(st->oid);
+ struct block_list* bl = iMap->id2bl(st->oid);
memcpy(&dummy_sd.bl, bl, sizeof(struct block_list));
if( bl->type == BL_NPC )
safestrncpy(dummy_sd.status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
@@ -16897,10 +16921,10 @@ BUILDIN(getrandgroupitem) {
for (i = 0; i < qty; i += get_count) {
// if not pet egg
if (!pet_create_egg(sd, nameid)) {
- if ((flag = pc_additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT))) {
+ if ((flag = iPc->additem(sd, &item_tmp, get_count, LOG_TYPE_SCRIPT))) {
clif->additem(sd, 0, 0, flag);
- if( pc_candrop(sd,&item_tmp) )
- map_addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ if( iPc->candrop(sd,&item_tmp) )
+ iMap->addflooritem(&item_tmp,get_count,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -16913,7 +16937,7 @@ BUILDIN(getrandgroupitem) {
static int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap)
{
nullpo_ret(bl);
- map_clearflooritem(bl);
+ iMap->clearflooritem(bl);
return 0;
}
@@ -16925,19 +16949,19 @@ BUILDIN(cleanmap)
int16 x0 = 0, y0 = 0, x1 = 0, y1 = 0;
map = script_getstr(st, 2);
- m = map_mapname2mapid(map);
+ m = iMap->mapname2mapid(map);
if (!m)
return false;
if ((script_lastdata(st) - 2) < 4) {
- map_foreachinmap(atcommand_cleanfloor_sub, m, BL_ITEM);
+ iMap->foreachinmap(atcommand_cleanfloor_sub, m, BL_ITEM);
} else {
x0 = script_getnum(st, 3);
y0 = script_getnum(st, 4);
x1 = script_getnum(st, 5);
y1 = script_getnum(st, 6);
if (x0 > 0 && y0 > 0 && x1 > 0 && y1 > 0) {
- map_foreachinarea(atcommand_cleanfloor_sub, m, x0, y0, x1, y1, BL_ITEM);
+ iMap->foreachinarea(atcommand_cleanfloor_sub, m, x0, y0, x1, y1, BL_ITEM);
} else {
ShowError("cleanarea: invalid coordinate defined!\n");
return false;
@@ -16963,7 +16987,7 @@ BUILDIN(npcskill)
stat_point = script_getnum(st, 4);
npc_level = script_getnum(st, 5);
sd = script_rid2sd(st);
- nd = (struct npc_data *)map_id2bl(sd->npc_id);
+ nd = (struct npc_data *)iMap->id2bl(sd->npc_id);
if (stat_point > battle_config.max_third_parameter) {
ShowError("npcskill: stat point exceeded maximum of %d.\n",battle_config.max_third_parameter );
@@ -16994,6 +17018,309 @@ BUILDIN(npcskill)
return true;
}
+struct hQueue *script_hqueue_get(int idx) {
+ if( idx < 0 || idx >= script->hqs || script->hq[idx].items == -1 )
+ return NULL;
+ return &script->hq[idx];
+}
+/* set .@id,queue(); */
+/* creates queue, returns created queue id */
+BUILDIN(queue) {
+ int idx = script->hqs;
+ int i;
+
+ for(i = 0; i < script->hqs; i++) {
+ if( script->hq[i].items == -1 ) {
+ break;
+ }
+ }
+
+ if( i == script->hqs ) {
+ RECREATE(script->hq, struct hQueue, ++script->hqs);
+ script->hq[ idx ].item = NULL;
+ } else
+ idx = i;
+
+ script->hq[ idx ].id = idx;
+ script->hq[ idx ].items = 0;
+ script->hq[ idx ].onDeath[0] = '\0';
+ script->hq[ idx ].onLogOut[0] = '\0';
+ script->hq[ idx ].onMapChange[0] = '\0';
+
+ script_pushint(st,idx);
+ return true;
+}
+/* set .@length,queuesize(.@queue_id); */
+/* returns queue length */
+BUILDIN(queuesize) {
+ int idx = script_getnum(st, 2);
+
+ if( idx < 0 || idx >= script->hqs || script->hq[idx].items == -1 ) {
+ ShowWarning("buildin_queuesize: unknown queue id %d\n",idx);
+ script_pushint(st, 0);
+ } else
+ script_pushint(st, script->hq[ idx ].items );
+
+ return true;
+}
+bool script_hqueue_add(int idx, int var) {
+ if( idx < 0 || idx >= script->hqs || script->hq[idx].items == -1 ) {
+ ShowWarning("script_hqueue_add: unknown queue id %d\n",idx);
+ return true;
+ } else {
+ struct map_session_data *sd;
+ int i;
+
+ for(i = 0; i < script->hq[idx].items; i++) {
+ if( script->hq[idx].item[i] == var ) {
+ return true;
+ }
+ }
+
+ if( i == script->hq[idx].items ) {
+
+ for(i = 0; i < script->hq[idx].items; i++) {
+ if( script->hq[idx].item[i] == 0 ) {
+ break;
+ }
+ }
+
+ if( i == script->hq[idx].items )
+ RECREATE(script->hq[idx].item, int, ++script->hq[idx].items);
+
+ script->hq[idx].item[i] = var;
+
+ if( var >= START_ACCOUNT_NUM && (sd = iMap->id2sd(var)) ) {
+ for(i = 0; i < sd->queues_count; i++) {
+ if( sd->queues[i] == -1 ) {
+ break;
+ }
+ }
+
+ if( i == sd->queues_count )
+ RECREATE(sd->queues, int, ++sd->queues_count);
+
+ sd->queues[i] = idx;
+ }
+
+ }
+ }
+ return false;
+}
+/* queueadd(.@queue_id,.@var_id); */
+/* adds a new entry to the queue, returns 1 if already in queue, 0 otherwise */
+BUILDIN(queueadd) {
+ int idx = script_getnum(st, 2);
+ int var = script_getnum(st, 3);
+
+ script_pushint(st,script->queue_add(idx,var)?1:0);
+
+ return true;
+}
+bool script_hqueue_remove(int idx, int var) {
+ if( idx < 0 || idx >= script->hqs || script->hq[idx].items == -1 ) {
+ ShowWarning("script_hqueue_remove: unknown queue id %d (used with var %d)\n",idx,var);
+ return true;
+ } else {
+ int i;
+
+ for(i = 0; i < script->hq[idx].items; i++) {
+ if( script->hq[idx].item[i] == var ) {
+ return true;
+ }
+ }
+
+ if( i != script->hq[idx].items ) {
+ struct map_session_data *sd;
+ script->hq[idx].item[i] = 0;
+
+ if( var >= START_ACCOUNT_NUM && (sd = iMap->id2sd(var)) ) {
+ for(i = 0; i < sd->queues_count; i++) {
+ if( sd->queues[i] == var ) {
+ break;
+ }
+ }
+
+ if( i != sd->queues_count )
+ sd->queues[i] = -1;
+ }
+
+ }
+ }
+ return false;
+}
+/* queueremove(.@queue_id,.@var_id); */
+/* removes a entry from the queue, returns 1 if not in queue, 0 otherwise */
+BUILDIN(queueremove) {
+ int idx = script_getnum(st, 2);
+ int var = script_getnum(st, 3);
+
+ script_pushint(st, script->queue_remove(idx,var)?1:0);
+
+ return true;
+}
+
+/* queueopt(.@queue_id,optionType,<optional val>); */
+/* modifies the queue's options, when val is not provided the option is removed */
+/* when OnMapChange event is triggered, it sets a temp char var @QMapChangeTo$ with the destination map name */
+/* returns 1 when fails, 0 on success */
+BUILDIN(queueopt) {
+ int idx = script_getnum(st, 2);
+ int var = script_getnum(st, 3);
+
+ if( idx < 0 || idx >= script->hqs || script->hq[idx].items == -1 ) {
+ ShowWarning("buildin_queueopt: unknown queue id %d\n",idx);
+ script_pushint(st, 1);
+ } else if( var <= HQO_NONE || var >= HQO_MAX ) {
+ ShowWarning("buildin_queueopt: unknown optionType %d\n",var);
+ script_pushint(st, 1);
+ } else {
+ switch( (enum hQueueOpt)var ) {
+ case HQO_OnDeath:
+ if( script_hasdata(st, 4) )
+ safestrncpy(script->hq[idx].onDeath, script_getstr(st, 4), EVENT_NAME_LENGTH);
+ else
+ script->hq[idx].onDeath[0] = '\0';
+ break;
+ case HQO_onLogOut:
+ if( script_hasdata(st, 4) )
+ safestrncpy(script->hq[idx].onLogOut, script_getstr(st, 4), EVENT_NAME_LENGTH);
+ else
+ script->hq[idx].onLogOut[0] = '\0';
+ break;
+ case HQO_OnMapChange:
+ if( script_hasdata(st, 4) )
+ safestrncpy(script->hq[idx].onMapChange, script_getstr(st, 4), EVENT_NAME_LENGTH);
+ else
+ script->hq[idx].onMapChange[0] = '\0';
+ break;
+ default:
+ ShowWarning("buildin_queueopt: unsupported optionType %d\n",var);
+ script_pushint(st, 1);
+ break;
+ }
+ }
+
+ return true;
+}
+bool script_hqueue_del(int idx) {
+ if( idx < 0 || idx >= script->hqs || script->hq[idx].items == -1 ) {
+ ShowWarning("script_queue_del: unknown queue id %d\n",idx);
+ return true;
+ } else {
+ struct map_session_data *sd;
+ int i;
+
+ for(i = 0; i < script->hq[idx].items; i++) {
+ if( script->hq[idx].item[i] >= START_ACCOUNT_NUM && (sd = iMap->id2sd(script->hq[idx].item[i])) ) {
+ int j;
+ for(j = 0; j < sd->queues_count; j++) {
+ if( sd->queues[j] == script->hq[idx].item[i] ) {
+ break;
+ }
+ }
+
+ if( j != sd->queues_count )
+ sd->queues[j] = -1;
+ }
+ }
+
+ script->hq[idx].items = -1;
+ }
+ return false;
+}
+/* queuedel(.@queue_id); */
+/* deletes queue of id .@queue_id, returns 1 if id not found, 0 otherwise */
+BUILDIN(queuedel) {
+ int idx = script_getnum(st, 2);
+
+ script_pushint(st,script->queue_del(idx)?1:0);
+
+ return true;
+}
+
+/* set .@id, queueiterator(.@queue_id); */
+/* creates a new queue iterator, returns its id */
+BUILDIN(queueiterator) {
+ int qid = script_getnum(st, 2);
+ struct hQueue *queue = NULL;
+ int idx = script->hqis;
+ int i;
+
+ if( qid < 0 || qid >= script->hqs || script->hq[idx].items == -1 || !(queue = script->queue(qid)) ) {
+ ShowWarning("queueiterator: invalid queue id %d\n",qid);
+ return true;
+ }
+
+ for(i = 0; i < script->hqis; i++) {
+ if( script->hqi[i].items == -1 ) {
+ break;
+ }
+ }
+
+ if( i == script->hqis )
+ RECREATE(script->hqi, struct hQueueIterator, ++script->hqis);
+ else
+ idx = i;
+
+ RECREATE(script->hqi[ idx ].item, int, queue->items);
+
+ memcpy(&script->hqi[idx].item, &queue->item, sizeof(int)*queue->items);
+
+ script->hqi[ idx ].items = queue->items;
+ script->hqi[ idx ].pos = 0;
+
+ script_pushint(st,idx);
+ return true;
+}
+/* Queue Iterator Get Next */
+/* returns next/first member in the iterator, 0 if none */
+BUILDIN(qiget) {
+ int idx = script_getnum(st, 2);
+
+ if( idx < 0 || idx >= script->hqis ) {
+ ShowWarning("buildin_qiget: unknown queue iterator id %d\n",idx);
+ script_pushint(st, 0);
+ } else if ( script->hqi[idx].pos == script->hqi[idx].items ) {
+ script_pushint(st, 0);
+ } else {
+ struct hQueueIterator *it = &script->hqi[idx];
+ script_pushint(st, it->item[it->pos++]);
+ }
+
+ return true;
+}
+/* Queue Iterator Check */
+/* returns 1:0 if there is a next member in the iterator */
+BUILDIN(qicheck) {
+ int idx = script_getnum(st, 2);
+
+ if( idx < 0 || idx >= script->hqis ) {
+ ShowWarning("buildin_qicheck: unknown queue iterator id %d\n",idx);
+ script_pushint(st, 0);
+ } else if ( script->hqi[idx].pos == script->hqi[idx].items ) {
+ script_pushint(st, 0);
+ } else {
+ script_pushint(st, 1);
+ }
+
+ return true;
+}
+/* Queue Iterator Check */
+BUILDIN(qiclear) {
+ int idx = script_getnum(st, 2);
+
+ if( idx < 0 || idx >= script->hqis ) {
+ ShowWarning("buildin_qiclear: unknown queue iterator id %d\n",idx);
+ script_pushint(st, 1);
+ } else {
+ script->hqi[idx].items = -1;
+ script_pushint(st, 0);
+ }
+
+ return true;
+}
+
// declarations that were supposed to be exported from npc_chat.c
#ifdef PCRE_SUPPORT
BUILDIN(defpattern);
@@ -17396,6 +17723,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF2(homunculus_evolution,"homevolution",""), //[orn]
BUILDIN_DEF2(homunculus_mutate,"hommutate","?"),
BUILDIN_DEF2(homunculus_shuffle,"homshuffle",""), //[Zephyrus]
+ BUILDIN_DEF(checkhomcall,""),
BUILDIN_DEF(eaclass,"?"), //[Skotlex]
BUILDIN_DEF(roclass,"i?"), //[Skotlex]
BUILDIN_DEF(checkvending,"?"),
@@ -17442,12 +17770,12 @@ void script_parse_builtin(void) {
BUILDIN_DEF(bg_updatescore,"sii"),
// Instancing
- BUILDIN_DEF(instance_create,"si"),
+ BUILDIN_DEF(instance_create,"si?"),
BUILDIN_DEF(instance_destroy,"?"),
- BUILDIN_DEF(instance_attachmap,"si?"),
+ BUILDIN_DEF(instance_attachmap,"si??"),
BUILDIN_DEF(instance_detachmap,"s?"),
BUILDIN_DEF(instance_attach,"i"),
- BUILDIN_DEF(instance_id,"?"),
+ BUILDIN_DEF(instance_id,""),
BUILDIN_DEF(instance_set_timeout,"ii?"),
BUILDIN_DEF(instance_init,"i"),
BUILDIN_DEF(instance_announce,"isi?????"),
@@ -17492,6 +17820,20 @@ void script_parse_builtin(void) {
BUILDIN_DEF(checkquest, "i?"),
BUILDIN_DEF(changequest, "ii"),
BUILDIN_DEF(showevent, "ii"),
+
+ /**
+ * hQueue [Ind/Hercules]
+ **/
+ BUILDIN_DEF(queue,""),
+ BUILDIN_DEF(queuesize,"i"),
+ BUILDIN_DEF(queueadd,"ii"),
+ BUILDIN_DEF(queueremove,"ii"),
+ BUILDIN_DEF(queueopt,"ii?"),
+ BUILDIN_DEF(queuedel,"i"),
+ BUILDIN_DEF(queueiterator,"i"),
+ BUILDIN_DEF(qicheck,"i"),
+ BUILDIN_DEF(qiget,"i"),
+ BUILDIN_DEF(qiclear,"i"),
};
int i,n, len = ARRAYLENGTH(BUILDIN), start = script->buildin_count;
char* p;
@@ -17545,6 +17887,11 @@ void script_parse_builtin(void) {
void script_defaults(void) {
script = &script_s;
+ script->hq = NULL;
+ script->hqi = NULL;
+ script->hqs = script->hqis = 0;
+ memset(&script->hqe, 0, sizeof(script->hqe));
+
script->buildin_count = 0;
script->buildin = NULL;
@@ -17555,4 +17902,10 @@ void script_defaults(void) {
script->addScript = script_hp_add;
script->conv_num = conv_num;
script->conv_str = conv_str;
+ script->rid2sd = script_rid2sd;
+
+ script->queue = script_hqueue_get;
+ script->queue_add = script_hqueue_add;
+ script->queue_del = script_hqueue_del;
+ script->queue_remove = script_hqueue_remove;
}
diff --git a/src/map/script.h b/src/map/script.h
index a0d282bfe..2e8dde5cf 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -4,6 +4,8 @@
#ifndef _SCRIPT_H_
#define _SCRIPT_H_
+#include "map.h" //EVENT_NAME_LENGTH
+
#define NUM_WHISPER_VAR 10
struct map_session_data;
@@ -110,6 +112,30 @@ struct script_stack {
struct DBMap* var_function;// scope variables
};
+enum hQueueOpt {
+ HQO_NONE,
+ HQO_onLogOut,
+ HQO_OnDeath,
+ HQO_OnMapChange,
+ HQO_MAX,
+};
+
+/* [Ind/Hercules] */
+struct hQueue {
+ int id;
+ int *item;
+ int items;
+ /* events */
+ char onLogOut[EVENT_NAME_LENGTH];
+ char onDeath[EVENT_NAME_LENGTH];
+ char onMapChange[EVENT_NAME_LENGTH];
+};
+
+struct hQueueIterator {
+ int *item;
+ int items;
+ int pos;
+};
//
// Script state
@@ -129,6 +155,7 @@ struct script_state {
int instance_id;
//For backing up purposes
struct script_state *bk_st;
+ unsigned char hIterator;
int bk_npcid;
unsigned freeloop : 1;// used by buildin_freeloop
unsigned op2ref : 1;// used by op_2
@@ -291,8 +318,14 @@ struct script_function {
char *name;
char *arg;
};
+
/* script.c interface (incomplete) */
struct script_interface {
+ /* */
+ struct hQueue *hq;
+ struct hQueueIterator *hqi;
+ int hqs, hqis;
+ int hqe[HQO_MAX];
/* */
char **buildin;
unsigned int buildin_count;
@@ -304,6 +337,12 @@ struct script_interface {
bool (*addScript) (char *name, char *args, bool (*func)(struct script_state *st));
int (*conv_num) (struct script_state *st,struct script_data *data);
const char* (*conv_str) (struct script_state *st,struct script_data *data);
+ TBL_PC *(*rid2sd) (struct script_state *st);
+ /* */
+ struct hQueue *(*queue) (int idx);
+ bool (*queue_add) (int idx, int var);
+ bool (*queue_del) (int idx);
+ bool (*queue_remove) (int idx, int var);
} script_s;
struct script_interface *script;
diff --git a/src/map/searchstore.c b/src/map/searchstore.c
index 7e1ee3e84..3cda77e4a 100644
--- a/src/map/searchstore.c
+++ b/src/map/searchstore.c
@@ -273,7 +273,7 @@ void searchstore_click(struct map_session_data* sd, int account_id, int store_id
return;
}
- if( ( pl_sd = map_id2sd(account_id) ) == NULL ) {// no longer online
+ if( ( pl_sd = iMap->id2sd(account_id) ) == NULL ) {// no longer online
clif->search_store_info_failed(sd, SSI_FAILED_SSILIST_CLICK_TO_OPEN_STORE);
return;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 06bfca5f8..676a6e463 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -189,57 +189,66 @@ void skill_chk(int16* skill_id) {
}
#define skill_get(var,id) { skill->chk(&id); if(!id) return 0; return var; }
-#define skill_get2(var,id,lv) { skill->chk(&id); if(!id) return 0; if( lv > MAX_SKILL_LEVEL ) { int lv2 = lv; lv = skill_db[id].max; return (var) + (lv2-lv); } return var; }
+#define skill_get2(var,id,lv) { \
+ skill->chk(&id); \
+ if(!id) return 0; \
+ if( lv >= MAX_SKILL_LEVEL && var > 1 ) { \
+ int lv2 = lv; lv = skill_db[id].max; \
+ return (var) + (lv2-lv);\
+ } \
+ return var;\
+}
+#define skill_glv(lv) min(lv,MAX_SKILL_LEVEL-1)
// Skill DB
int skill_get_hit( uint16 skill_id ) { skill_get (skill_db[skill_id].hit, skill_id); }
int skill_get_inf( uint16 skill_id ) { skill_get (skill_db[skill_id].inf, skill_id); }
-int skill_get_ele( uint16 skill_id , uint16 skill_lv ) { skill_get2 (skill_db[skill_id].element[skill_lv-1], skill_id, skill_lv); }
+int skill_get_ele( uint16 skill_id , uint16 skill_lv ) { skill_get (skill_db[skill_id].element[skill_glv(skill_lv-1)], skill_id); }
int skill_get_nk( uint16 skill_id ) { skill_get (skill_db[skill_id].nk, skill_id); }
int skill_get_max( uint16 skill_id ) { skill_get (skill_db[skill_id].max, skill_id); }
-int skill_get_range( uint16 skill_id , uint16 skill_lv ) { skill_get2 (skill_db[skill_id].range[skill_lv-1], skill_id, skill_lv); }
-int skill_get_splash( uint16 skill_id , uint16 skill_lv ) { skill_get2 ( (skill_db[skill_id].splash[skill_lv-1]>=0?skill_db[skill_id].splash[skill_lv-1]:AREA_SIZE), skill_id, skill_lv); }
-int skill_get_hp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].hp[skill_lv-1], skill_id, skill_lv); }
-int skill_get_sp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].sp[skill_lv-1], skill_id, skill_lv); }
-int skill_get_hp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].hp_rate[skill_lv-1], skill_id, skill_lv); }
-int skill_get_sp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].sp_rate[skill_lv-1], skill_id, skill_lv); }
+int skill_get_range( uint16 skill_id , uint16 skill_lv ) { skill_get2 (skill_db[skill_id].range[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_splash( uint16 skill_id , uint16 skill_lv ) { skill_get2 ( (skill_db[skill_id].splash[skill_glv(skill_lv-1)]>=0?skill_db[skill_id].splash[skill_glv(skill_lv-1)]:AREA_SIZE), skill_id, skill_lv); }
+int skill_get_hp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].hp[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_sp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].sp[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_hp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].hp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_sp_rate(uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].sp_rate[skill_glv(skill_lv-1)], skill_id, skill_lv); }
int skill_get_state(uint16 skill_id) { skill_get (skill_db[skill_id].state, skill_id); }
-int skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { skill_get2 (skill_db[skill_id].spiritball[skill_lv-1], skill_id, skill_lv); }
+int skill_get_spiritball(uint16 skill_id, uint16 skill_lv) { skill_get2 (skill_db[skill_id].spiritball[skill_glv(skill_lv-1)], skill_id, skill_lv); }
int skill_get_itemid(uint16 skill_id, int idx) { skill_get (skill_db[skill_id].itemid[idx], skill_id); }
int skill_get_itemqty(uint16 skill_id, int idx) { skill_get (skill_db[skill_id].amount[idx], skill_id); }
-int skill_get_zeny( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].zeny[skill_lv-1], skill_id, skill_lv); }
-int skill_get_num( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].num[skill_lv-1], skill_id, skill_lv); }
-int skill_get_cast( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].cast[skill_lv-1], skill_id, skill_lv); }
-int skill_get_delay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].delay[skill_lv-1], skill_id, skill_lv); }
-int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].walkdelay[skill_lv-1], skill_id, skill_lv); }
-int skill_get_time( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].upkeep_time[skill_lv-1], skill_id, skill_lv); }
-int skill_get_time2( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].upkeep_time2[skill_lv-1], skill_id, skill_lv); }
+int skill_get_zeny( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].zeny[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_num( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].num[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_cast( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].cast[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_delay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].delay[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_walkdelay( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].walkdelay[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_time( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].upkeep_time[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_time2( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].upkeep_time2[skill_glv(skill_lv-1)], skill_id, skill_lv); }
int skill_get_castdef( uint16 skill_id ) { skill_get (skill_db[skill_id].cast_def_rate, skill_id); }
int skill_get_weapontype( uint16 skill_id ) { skill_get (skill_db[skill_id].weapon, skill_id); }
int skill_get_ammotype( uint16 skill_id ) { skill_get (skill_db[skill_id].ammo, skill_id); }
-int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].ammo_qty[skill_lv-1], skill_id, skill_lv); }
+int skill_get_ammo_qty( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].ammo_qty[skill_glv(skill_lv-1)], skill_id, skill_lv); }
int skill_get_inf2( uint16 skill_id ) { skill_get (skill_db[skill_id].inf2, skill_id); }
int skill_get_castcancel( uint16 skill_id ) { skill_get (skill_db[skill_id].castcancel, skill_id); }
-int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].maxcount[skill_lv-1], skill_id, skill_lv); }
-int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].blewcount[skill_lv-1], skill_id, skill_lv); }
-int skill_get_mhp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].mhp[skill_lv-1], skill_id, skill_lv); }
-int skill_get_castnodex( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].castnodex[skill_lv-1], skill_id, skill_lv); }
-int skill_get_delaynodex( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].delaynodex[skill_lv-1], skill_id, skill_lv); }
+int skill_get_maxcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].maxcount[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_blewcount( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].blewcount[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_mhp( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].mhp[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_castnodex( uint16 skill_id ,uint16 skill_lv ) { skill_get2 (skill_db[skill_id].castnodex[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_delaynodex( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].delaynodex[skill_glv(skill_lv-1)], skill_id, skill_lv); }
int skill_get_type( uint16 skill_id ) { skill_get (skill_db[skill_id].skill_type, skill_id); }
int skill_get_unit_id ( uint16 skill_id, int flag ){ skill_get (skill_db[skill_id].unit_id[flag], skill_id); }
int skill_get_unit_interval( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_interval, skill_id); }
-int skill_get_unit_range( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].unit_range[skill_lv-1], skill_id, skill_lv); }
+int skill_get_unit_range( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].unit_range[skill_glv(skill_lv-1)], skill_id, skill_lv); }
int skill_get_unit_target( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_target&BCT_ALL, skill_id); }
int skill_get_unit_bl_target( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_target&BL_ALL, skill_id); }
int skill_get_unit_flag( uint16 skill_id ) { skill_get (skill_db[skill_id].unit_flag, skill_id); }
-int skill_get_unit_layout_type( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].unit_layout_type[skill_lv-1], skill_id, skill_lv); }
-int skill_get_cooldown( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].cooldown[skill_lv-1], skill_id, skill_lv); }
+int skill_get_unit_layout_type( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].unit_layout_type[skill_glv(skill_lv-1)], skill_id, skill_lv); }
+int skill_get_cooldown( uint16 skill_id, uint16 skill_lv ) { skill_get2 (skill_db[skill_id].cooldown[skill_glv(skill_lv-1)], skill_id, skill_lv); }
#ifdef RENEWAL_CAST
-int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].fixed_cast[skill_lv-1], skill_id, skill_lv); }
+int skill_get_fixed_cast( uint16 skill_id ,uint16 skill_lv ){ skill_get2 (skill_db[skill_id].fixed_cast[skill_glv(skill_lv-1)], skill_id, skill_lv); }
#endif
int skill_tree_get_max(uint16 skill_id, int b_class)
{
int i;
- b_class = pc_class2idx(b_class);
+ b_class = iPc->class2idx(b_class);
ARR_FIND( 0, MAX_SKILL_TREE, i, skill_tree[b_class][i].id == 0 || skill_tree[b_class][i].id == skill_id );
if( i < MAX_SKILL_TREE && skill_tree[b_class][i].id == skill_id )
@@ -313,7 +322,7 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
case RA_AIMEDBOLT:
case RA_WUGBITE:
if( bl->type == BL_PC )
- range += pc_checkskill((TBL_PC*)bl, AC_VULTURE);
+ range += iPc->checkskill((TBL_PC*)bl, AC_VULTURE);
else
range += 10; //Assume level 10?
break;
@@ -324,13 +333,13 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
case GS_SPREADATTACK:
case GS_GROUNDDRIFT:
if (bl->type == BL_PC)
- range += pc_checkskill((TBL_PC*)bl, GS_SNAKEEYE);
+ range += iPc->checkskill((TBL_PC*)bl, GS_SNAKEEYE);
else
range += 10; //Assume level 10?
break;
case NJ_KIRIKAGE:
if (bl->type == BL_PC)
- range = skill->get_range(NJ_SHADOWJUMP,pc_checkskill((TBL_PC*)bl,NJ_SHADOWJUMP));
+ range = skill->get_range(NJ_SHADOWJUMP,iPc->checkskill((TBL_PC*)bl,NJ_SHADOWJUMP));
break;
/**
* Warlock
@@ -348,7 +357,7 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
case WL_TETRAVORTEX:
case WL_RELEASE:
if( bl->type == BL_PC )
- range += pc_checkskill((TBL_PC*)bl, WL_RADIUS);
+ range += iPc->checkskill((TBL_PC*)bl, WL_RADIUS);
break;
/**
* Ranger Bonus
@@ -361,7 +370,7 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
case RA_FIRINGTRAP:
case RA_ICEBOUNDTRAP:
if( bl->type == BL_PC )
- range += (1 + pc_checkskill((TBL_PC*)bl, RA_RESEARCHTRAP))/2;
+ range += (1 + iPc->checkskill((TBL_PC*)bl, RA_RESEARCHTRAP))/2;
}
if( !range && bl->type != BL_PC )
@@ -383,7 +392,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk
hp = 30+5*skill_lv+5*(status_get_vit(src)/10); // HP recovery
#endif
if( sd )
- hp += 5*pc_checkskill(sd,BA_MUSICALLESSON);
+ hp += 5*iPc->checkskill(sd,BA_MUSICALLESSON);
break;
case PR_SANCTUARY:
hp = (skill_lv>6)?777:skill_lv*100;
@@ -397,13 +406,13 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk
#ifdef RENEWAL
/**
* Renewal Heal Formula
- * Formula: ( [(Base Level + INT) / 5] × 30 ) × (Heal Level / 10) × (Modifiers) + MATK
+ * Formula: ( [(Base Level + INT) / 5] � 30 ) � (Heal Level / 10) � (Modifiers) + MATK
**/
hp = (status_get_lv(src) + status_get_int(src)) / 5 * 30 * skill_lv / 10;
#else
- hp = ( status_get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? pc_checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8);
+ hp = ( status_get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? iPc->checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8);
#endif
- if( sd && ((skill = pc_checkskill(sd, HP_MEDITATIO)) > 0) )
+ if( sd && ((skill = iPc->checkskill(sd, HP_MEDITATIO)) > 0) )
hp += hp * skill * 2 / 100;
else if( src->type == BL_HOM && (skill = homun->checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0 )
hp += hp * skill * 2 / 100;
@@ -413,10 +422,10 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk
if( ( (target && target->type == BL_MER) || !heal ) && skill_id != NPC_EVILLAND )
hp >>= 1;
- if( sd && (skill = pc_skillheal_bonus(sd, skill_id)) )
+ if( sd && (skill = iPc->skillheal_bonus(sd, skill_id)) )
hp += hp*skill/100;
- if( tsd && (skill = pc_skillheal2_bonus(tsd, skill_id)) )
+ if( tsd && (skill = iPc->skillheal2_bonus(tsd, skill_id)) )
hp += hp*skill/100;
sc = status_get_sc(target);
@@ -523,7 +532,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd)
// allowing a skill to be cast. This is to prevent no-delay ACT files from spamming skills such as
// AC_DOUBLE which do not have a skill delay and are not regarded in terms of attack motion.
if( !sd->state.autocast && sd->skillitem != skill_id && sd->canskill_tick &&
- DIFF_TICK(gettick(), sd->canskill_tick) < (sd->battle_status.amotion * (battle_config.skill_amotion_leniency) / 100) )
+ DIFF_TICK(iTimer->gettick(), sd->canskill_tick) < (sd->battle_status.amotion * (battle_config.skill_amotion_leniency) / 100) )
{// attempted to cast a skill before the attack motion has finished
return 1;
}
@@ -595,7 +604,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd)
break;
case GD_EMERGENCYCALL:
if (
- !(battle_config.emergency_call&((agit_flag || agit2_flag)?2:1)) ||
+ !(battle_config.emergency_call&((iMap->agit_flag || iMap->agit2_flag)?2:1)) ||
!(battle_config.emergency_call&(map[m].flag.gvg || map[m].flag.gvg_castle?8:4)) ||
(battle_config.emergency_call&16 && map[m].flag.nowarpto && !map[m].flag.gvg_castle)
) {
@@ -692,7 +701,7 @@ struct s_skill_unit_layout* skill_get_unit_layout (uint16 skill_id, uint16 skill
if (pos != -1) // simple single-definition layout
return &skill_unit_layout[pos];
- dir = (src->x == x && src->y == y) ? 6 : map_calc_dir(src,x,y); // 6 - default aegis direction
+ dir = (src->x == x && src->y == y) ? 6 : iMap->calc_dir(src,x,y); // 6 - default aegis direction
if (skill_id == MG_FIREWALL)
return &skill_unit_layout [firewall_unit_pos + dir];
@@ -805,19 +814,19 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
break; // If a normal attack is a skill, it's splash damage. [Inkfish]
if(sd) {
// Automatic trigger of Blitz Beat
- if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (temp=pc_checkskill(sd,HT_BLITZBEAT))>0 &&
+ if (pc_isfalcon(sd) && sd->status.weapon == W_BOW && (temp=iPc->checkskill(sd,HT_BLITZBEAT))>0 &&
rnd()%1000 <= sstatus->luk*10/3+1 ) {
rate=(sd->status.job_level+9)/10;
skill->castend_damage_id(src,bl,HT_BLITZBEAT,(temp<rate)?temp:rate,tick,SD_LEVEL);
}
// Automatic trigger of Warg Strike [Jobbie]
- if( pc_iswug(sd) && (sd->status.weapon == W_BOW || sd->status.weapon == W_FIST) && (temp=pc_checkskill(sd,RA_WUGSTRIKE)) > 0 && rnd()%1000 <= sstatus->luk*10/3+1 )
+ if( pc_iswug(sd) && (sd->status.weapon == W_BOW || sd->status.weapon == W_FIST) && (temp=iPc->checkskill(sd,RA_WUGSTRIKE)) > 0 && rnd()%1000 <= sstatus->luk*10/3+1 )
skill->castend_damage_id(src,bl,RA_WUGSTRIKE,temp,tick,0);
// Gank
if(dstmd && sd->status.weapon != W_BOW &&
- (temp=pc_checkskill(sd,RG_SNATCHER)) > 0 &&
- (temp*15 + 55) + pc_checkskill(sd,TF_STEAL)*10 > rnd()%1000) {
- if(pc_steal_item(sd,bl,pc_checkskill(sd,TF_STEAL)))
+ (temp=iPc->checkskill(sd,RG_SNATCHER)) > 0 &&
+ (temp*15 + 55) + iPc->checkskill(sd,TF_STEAL)*10 > rnd()%1000) {
+ if(iPc->steal_item(sd,bl,iPc->checkskill(sd,TF_STEAL)))
clif->skill_nodamage(src,bl,TF_STEAL,temp,1);
else
clif->skill_fail(sd,RG_SNATCHER,USESKILL_FAIL_LEVEL,0);
@@ -865,7 +874,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
break;
case SM_BASH:
- if( sd && skill_lv > 5 && pc_checkskill(sd,SM_FATALBLOW)>0 ){
+ if( sd && skill_lv > 5 && iPc->checkskill(sd,SM_FATALBLOW)>0 ){
//TODO: How much % per base level it actually is?
sc_start(bl,SC_STUN,(5*(skill_lv-5)+(int)sd->status.base_level/10),
skill_lv,skill->get_time2(SM_FATALBLOW,skill_lv));
@@ -878,7 +887,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
case AS_VENOMKNIFE:
if (sd) //Poison chance must be that of Envenom. [Skotlex]
- skill_lv = pc_checkskill(sd, TF_POISON);
+ skill_lv = iPc->checkskill(sd, TF_POISON);
case TF_POISON:
case AS_SPLASHER:
if(!sc_start2(bl,SC_POISON,(4*skill_lv+10),skill_lv,src->id,skill->get_time2(skill_id,skill_lv))
@@ -1025,7 +1034,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
case DC_UGLYDANCE:
rate = 5+5*skill_lv;
- if(sd && (temp=pc_checkskill(sd,DC_DANCINGLESSON)))
+ if(sd && (temp=iPc->checkskill(sd,DC_DANCINGLESSON)))
rate += 5+temp;
status_zap(bl, 0, rate);
break;
@@ -1185,7 +1194,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
sc_start(bl,SC_CRITICALWOUND,100,skill_lv,skill->get_time2(skill_id,skill_lv));
break;
case RK_HUNDREDSPEAR:
- if( !sd || pc_checkskill(sd,KN_SPEARBOOMERANG) == 0 )
+ if( !sd || iPc->checkskill(sd,KN_SPEARBOOMERANG) == 0 )
break; // Spear Boomerang auto cast chance only works if you have mastered Spear Boomerang.
rate = 10 + 3 * skill_lv;
if( rnd()%100 < rate )
@@ -1222,11 +1231,11 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
sc_start(bl,SC_FREEZE,100,skill_lv,skill->get_time(skill_id,skill_lv));
break;
case RA_WUGBITE:
- sc_start(bl, SC_BITE, (sd ? pc_checkskill(sd,RA_TOOTHOFWUG)*2 : 0), skill_lv, (skill->get_time(skill_id,skill_lv) + (sd ? pc_checkskill(sd,RA_TOOTHOFWUG)*500 : 0)) );
+ sc_start(bl, SC_BITE, (sd ? iPc->checkskill(sd,RA_TOOTHOFWUG)*2 : 0), skill_lv, (skill->get_time(skill_id,skill_lv) + (sd ? iPc->checkskill(sd,RA_TOOTHOFWUG)*500 : 0)) );
break;
case RA_SENSITIVEKEEN:
if( rnd()%100 < 8 * skill_lv )
- skill->castend_damage_id(src, bl, RA_WUGBITE, sd ? pc_checkskill(sd, RA_WUGBITE):skill_lv, tick, SD_ANIMATION);
+ skill->castend_damage_id(src, bl, RA_WUGBITE, sd ? iPc->checkskill(sd, RA_WUGBITE):skill_lv, tick, SD_ANIMATION);
break;
case RA_FIRINGTRAP:
case RA_ICEBOUNDTRAP:
@@ -1252,7 +1261,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
case NC_POWERSWING:
sc_start(bl, SC_STUN, 5*skill_lv, skill_lv, skill->get_time(skill_id, skill_lv));
if( rnd()%100 < 5*skill_lv )
- skill->castend_damage_id(src, bl, NC_AXEBOOMERANG, pc_checkskill(sd, NC_AXEBOOMERANG), tick, 1);
+ skill->castend_damage_id(src, bl, NC_AXEBOOMERANG, iPc->checkskill(sd, NC_AXEBOOMERANG), tick, 1);
break;
case GC_WEAPONCRUSH:
skill->castend_nodamage_id(src,bl,skill_id,skill_lv,tick,BCT_ENEMY);
@@ -1261,14 +1270,14 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
sc_start(bl, SC_STUN, 30 + 8 * skill_lv, skill_lv, skill->get_time(skill_id,skill_lv));
break;
case LG_PINPOINTATTACK:
- rate = 30 + (((5 * (sd?pc_checkskill(sd,LG_PINPOINTATTACK):skill_lv)) + (sstatus->agi + status_get_lv(src))) / 10);
+ rate = 30 + (((5 * (sd?iPc->checkskill(sd,LG_PINPOINTATTACK):skill_lv)) + (sstatus->agi + status_get_lv(src))) / 10);
switch( skill_lv ) {
case 1:
sc_start2(bl,SC_BLEEDING,rate,skill_lv,src->id,skill->get_time(skill_id,skill_lv));
break;
case 2:
if( dstsd && dstsd->spiritball && rnd()%100 < rate )
- pc_delspiritball(dstsd, dstsd->spiritball, 0);
+ iPc->delspiritball(dstsd, dstsd->spiritball, 0);
break;
default:
skill->break_equip(bl,(skill_lv == 3) ? EQP_SHIELD : (skill_lv == 4) ? EQP_ARMOR : EQP_WEAPON,rate * 100,BCT_ENEMY);
@@ -1410,7 +1419,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
if (md && battle_config.summons_trigger_autospells && md->master_id && md->special_state.ai)
{ //Pass heritage to Master for status causing effects. [Skotlex]
- sd = map_id2sd(md->master_id);
+ sd = iMap->id2sd(md->master_id);
src = sd?&sd->bl:src;
}
@@ -1600,7 +1609,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
sd->autobonus[i].atk_type&attack_type&BF_RANGEMASK &&
sd->autobonus[i].atk_type&attack_type&BF_SKILLMASK))
continue; // one or more trigger conditions were not fulfilled
- pc_exeautobonus(sd,&sd->autobonus[i]);
+ iPc->exeautobonus(sd,&sd->autobonus[i]);
}
}
@@ -1713,7 +1722,7 @@ int skill_onskillusage(struct map_session_data *sd, struct block_list *bl, uint1
continue;
if( sd->autobonus3[i].atk_type != skill_id )
continue;
- pc_exeautobonus(sd,&sd->autobonus3[i]);
+ iPc->exeautobonus(sd,&sd->autobonus3[i]);
}
}
@@ -1798,9 +1807,9 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
if(sd && skill_id && attack_type&BF_MAGIC && status_isdead(bl) &&
!(skill->get_inf(skill_id)&(INF_GROUND_SKILL|INF_SELF_SKILL)) &&
- (rate=pc_checkskill(sd,HW_SOULDRAIN))>0
+ (rate=iPc->checkskill(sd,HW_SOULDRAIN))>0
){ //Soul Drain should only work on targetted spells [Skotlex]
- if (pc_issit(sd)) pc_setstand(sd); //Character stuck in attacking animation while 'sitting' fix. [Skotlex]
+ if (pc_issit(sd)) iPc->setstand(sd); //Character stuck in attacking animation while 'sitting' fix. [Skotlex]
clif->skill_nodamage(src,bl,HW_SOULDRAIN,rate,1);
status_heal(src, 0, status_get_lv(bl)*(95+15*rate)/100, 2);
}
@@ -1934,7 +1943,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
dstsd->autobonus2[i].atk_type&attack_type&BF_RANGEMASK &&
dstsd->autobonus2[i].atk_type&attack_type&BF_SKILLMASK))
continue; // one or more trigger conditions were not fulfilled
- pc_exeautobonus(dstsd,&dstsd->autobonus2[i]);
+ iPc->exeautobonus(dstsd,&dstsd->autobonus2[i]);
}
}
@@ -2027,7 +2036,7 @@ int skill_break_equip (struct block_list *bl, unsigned short where, int rate, in
}
if (flag) {
sd->status.inventory[j].attribute = 1;
- pc_unequipitem(sd, j, 3);
+ iPc->unequipitem(sd, j, 3);
}
}
clif->equiplist(sd);
@@ -2107,7 +2116,7 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in
}
if (dir == -1) // <optimized>: do the computation here instead of outside
- dir = map_calc_dir(target, src->x, src->y); // direction from src to target, reversed
+ dir = iMap->calc_dir(target, src->x, src->y); // direction from src to target, reversed
if (dir >= 0 && dir < 8)
{ // take the reversed 'direction' and reverse it
@@ -2246,9 +2255,9 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
//Spirit of Wizard blocks Kaite's reflection
if( type == 2 && sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_WIZARD )
{ //Consume one Fragment per hit of the casted skill? [Skotlex]
- type = tsd?pc_search_inventory (tsd, 7321):0;
+ type = tsd?iPc->search_inventory (tsd, 7321):0;
if (type >= 0) {
- if ( tsd ) pc_delitem(tsd, type, 1, 0, 1, LOG_TYPE_CONSUME);
+ if ( tsd ) iPc->delitem(tsd, type, 1, 0, 1, LOG_TYPE_CONSUME);
dmg.damage = dmg.damage2 = 0;
dmg.dmg_lv = ATK_MISS;
sc->data[SC_SPIRIT]->val3 = skill_id;
@@ -2345,12 +2354,12 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
case TK_STORMKICK:
case TK_DOWNKICK:
case TK_COUNTER:
- if (pc_famerank(sd->status.char_id,MAPID_TAEKWON)) {//Extend combo time.
+ if (iPc->famerank(sd->status.char_id,MAPID_TAEKWON)) {//Extend combo time.
sce->val1 = skill_id; //Update combo-skill
sce->val3 = skill_id;
if( sce->timer != INVALID_TIMER )
- delete_timer(sce->timer, status_change_timer);
- sce->timer = add_timer(tick+sce->val4, status_change_timer, src->id, SC_COMBO);
+ iTimer->delete_timer(sce->timer, status_change_timer);
+ sce->timer = iTimer->add_timer(tick+sce->val4, status_change_timer, src->id, SC_COMBO);
break;
}
unit_cancel_combo(src); // Cancel combo wait
@@ -2362,27 +2371,27 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
}
switch(skill_id) {
case MO_TRIPLEATTACK:
- if (pc_checkskill(sd, MO_CHAINCOMBO) > 0 || pc_checkskill(sd, SR_DRAGONCOMBO) > 0)
+ if (iPc->checkskill(sd, MO_CHAINCOMBO) > 0 || iPc->checkskill(sd, SR_DRAGONCOMBO) > 0)
flag=1;
break;
case MO_CHAINCOMBO:
- if(pc_checkskill(sd, MO_COMBOFINISH) > 0 && sd->spiritball > 0)
+ if(iPc->checkskill(sd, MO_COMBOFINISH) > 0 && sd->spiritball > 0)
flag=1;
break;
case MO_COMBOFINISH:
if (sd->status.party_id>0) //bonus from SG_FRIEND [Komurka]
- party_skill_check(sd, sd->status.party_id, MO_COMBOFINISH, skill_lv);
- if (pc_checkskill(sd, CH_TIGERFIST) > 0 && sd->spiritball > 0)
+ iParty->skill_check(sd, sd->status.party_id, MO_COMBOFINISH, skill_lv);
+ if (iPc->checkskill(sd, CH_TIGERFIST) > 0 && sd->spiritball > 0)
flag=1;
case CH_TIGERFIST:
- if (!flag && pc_checkskill(sd, CH_CHAINCRUSH) > 0 && sd->spiritball > 1)
+ if (!flag && iPc->checkskill(sd, CH_CHAINCRUSH) > 0 && sd->spiritball > 1)
flag=1;
case CH_CHAINCRUSH:
- if (!flag && pc_checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball > 0 && sd->sc.data[SC_EXPLOSIONSPIRITS])
+ if (!flag && iPc->checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball > 0 && sd->sc.data[SC_EXPLOSIONSPIRITS])
flag=1;
break;
case AC_DOUBLE:
- if( (tstatus->race == RC_BRUTE || tstatus->race == RC_INSECT) && pc_checkskill(sd, HT_POWER))
+ if( (tstatus->race == RC_BRUTE || tstatus->race == RC_INSECT) && iPc->checkskill(sd, HT_POWER))
{
//TODO: This code was taken from Triple Blows, is this even how it should be? [Skotlex]
sc_start2(src,SC_COMBO,100,HT_POWER,bl->id,2000);
@@ -2392,8 +2401,8 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
case TK_COUNTER:
{ //bonus from SG_FRIEND [Komurka]
int level;
- if(sd->status.party_id>0 && (level = pc_checkskill(sd,SG_FRIEND)))
- party_skill_check(sd, sd->status.party_id, TK_COUNTER,level);
+ if(sd->status.party_id>0 && (level = iPc->checkskill(sd,SG_FRIEND)))
+ iParty->skill_check(sd, sd->status.party_id, TK_COUNTER,level);
}
break;
case SL_STIN:
@@ -2406,11 +2415,11 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
sd->ud.attackabletime = sd->canuseitem_tick = sd->ud.canact_tick;
break;
case SR_DRAGONCOMBO:
- if( pc_checkskill(sd, SR_FALLENEMPIRE) > 0 )
+ if( iPc->checkskill(sd, SR_FALLENEMPIRE) > 0 )
flag = 1;
break;
case SR_FALLENEMPIRE:
- if( pc_checkskill(sd, SR_TIGERCANNON) > 0 || pc_checkskill(sd, SR_GATEOFHELL) > 0 )
+ if( iPc->checkskill(sd, SR_TIGERCANNON) > 0 || iPc->checkskill(sd, SR_GATEOFHELL) > 0 )
flag = 1;
break;
} //Switch End
@@ -2525,10 +2534,10 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
break;
}
- map_freeblock_lock();
+ iMap->freeblock_lock();
if(damage > 0 && dmg.flag&BF_SKILL && tsd
- && pc_checkskill(tsd,RG_PLAGIARISM)
+ && iPc->checkskill(tsd,RG_PLAGIARISM)
&& (!sc || !sc->data[SC_PRESERVE])
&& damage < tsd->battle_status.hp)
{ //Updated to not be able to copy skills if the blow will kill you. [Skotlex]
@@ -2570,7 +2579,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
if( sc && sc->data[SC__REPRODUCE] && (lv = sc->data[SC__REPRODUCE]->val1) ) {
//Level dependent and limitation.
lv = min(lv,skill->get_max(copy_skill));
- idx = skill->get_index(tsd->reproduceskill_id);
+
if( tsd->reproduceskill_id ) {
idx = skill->get_index(tsd->reproduceskill_id);
if(tsd->status.skill[idx].flag == SKILL_FLAG_PLAGIARIZED ) {
@@ -2601,16 +2610,16 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
}
}
- if ((type = pc_checkskill(tsd,RG_PLAGIARISM)) < lv)
+ if ((type = iPc->checkskill(tsd,RG_PLAGIARISM)) < lv)
lv = type;
tsd->cloneskill_id = copy_skill;
pc_setglobalreg(tsd, "CLONE_SKILL", copy_skill);
pc_setglobalreg(tsd, "CLONE_SKILL_LV", lv);
- tsd->status.skill[idx].id = copy_skill;
- tsd->status.skill[idx].lv = lv;
- tsd->status.skill[idx].flag = SKILL_FLAG_PLAGIARIZED;
+ tsd->status.skill[cidx].id = copy_skill;
+ tsd->status.skill[cidx].lv = lv;
+ tsd->status.skill[cidx].flag = SKILL_FLAG_PLAGIARIZED;
clif->addskill(tsd,copy_skill);
}
}
@@ -2659,7 +2668,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
dir = rand()%8;
break;
case WL_CRIMSONROCK:
- dir = map_calc_dir(bl,skill_area_temp[4],skill_area_temp[5]);
+ dir = iMap->calc_dir(bl,skill_area_temp[4],skill_area_temp[5]);
break;
}
@@ -2670,7 +2679,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
short dir_x, dir_y;
dir_x = dirx[(dir+4)%8];
dir_y = diry[(dir+4)%8];
- if( map_getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 )
+ if( iMap->getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 )
skill->addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skill_lv, BF_WEAPON, flag );
} else
skill->addtimerskill(src, tick + status_get_amotion(src), bl->id, 0, 0, LG_OVERBRAND_PLUSATK, skill_lv, BF_WEAPON, flag );
@@ -2680,7 +2689,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
short dir_x, dir_y;
dir_x = dirx[(dir+4)%8];
dir_y = diry[(dir+4)%8];
- if( map_getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 )
+ if( iMap->getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 )
skill->addtimerskill(src, tick + 300 * ((flag&2) ? 1 : 2), bl->id, 0, 0, skill_id, skill_lv, BF_WEAPON, flag|4);
}
break;
@@ -2706,7 +2715,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
if( sc && sc->data[SC_DEVOTION] && skill_id != PA_PRESSURE ) {
struct status_change_entry *sce = sc->data[SC_DEVOTION];
- struct block_list *d_bl = map_id2bl(sce->val1);
+ struct block_list *d_bl = iMap->id2bl(sce->val1);
if( d_bl && (
(d_bl->type == BL_MER && ((TBL_MER*)d_bl)->master && ((TBL_MER*)d_bl)->master->bl.id == bl->id) ||
@@ -2714,12 +2723,12 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
) && check_distance_bl(bl, d_bl, sce->val3) )
{
if(!rmdamage){
- clif->damage(d_bl,d_bl, gettick(), 0, 0, damage, 0, 0, 0);
+ clif->damage(d_bl,d_bl, iTimer->gettick(), 0, 0, damage, 0, 0, 0);
status_fix_damage(NULL,d_bl, damage, 0);
} else{ //Reflected magics are done directly on the target not on paladin
//This check is only for magical skill.
//For BF_WEAPON skills types track var rdamage and function battle_calc_return_damage
- clif->damage(bl,bl, gettick(), 0, 0, damage, 0, 0, 0);
+ clif->damage(bl,bl, iTimer->gettick(), 0, 0, damage, 0, 0, 0);
status_fix_damage(bl,bl, damage, 0);
}
}
@@ -2760,7 +2769,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
change = true;
if( change )
sd->state.autocast = 1;
- map_foreachinshootrange(battle->damage_area,bl,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,bl,dmg.amotion,sstatus->dmotion,rdamage,tstatus->race);
+ iMap->foreachinshootrange(battle->damage_area,bl,skill->get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,bl,dmg.amotion,sstatus->dmotion,rdamage,tstatus->race);
if( change )
sd->state.autocast = 0;
}
@@ -2794,7 +2803,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
}
break;
case WM_METALICSOUND:
- status_zap(bl, 0, damage*100/(100*(110-pc_checkskill(sd,WM_LESSON)*10)));
+ status_zap(bl, 0, damage*100/(100*(110-iPc->checkskill(sd,WM_LESSON)*10)));
break;
case SR_TIGERCANNON:
status_zap(bl, 0, damage/10); // 10% of damage dealt
@@ -2816,7 +2825,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
skill->addtimerskill(src, tick + dmg.amotion, bl->id, 0, 0, skill_id, skill_lv, BF_MAGIC, flag|2);
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return damage;
}
@@ -2928,7 +2937,7 @@ int skill_check_unit_range (struct block_list *bl, int x, int y, uint16 skill_id
}
range += layout_type;
- return map_foreachinarea(skill->check_unit_range_sub,bl->m,x-range,y-range,x+range,y+range,BL_SKILL,skill_id);
+ return iMap->foreachinarea(skill->check_unit_range_sub,bl->m,x-range,y-range,x+range,y+range,BL_SKILL,skill_id);
}
int skill_check_unit_range2_sub (struct block_list *bl, va_list ap) {
@@ -2975,7 +2984,7 @@ int skill_check_unit_range2 (struct block_list *bl, int x, int y, uint16 skill_i
else
type = BL_PC;
- return map_foreachinarea(skill->check_unit_range2_sub, bl->m,
+ return iMap->foreachinarea(skill->check_unit_range2_sub, bl->m,
x - range, y - range, x + range, y + range,
type, skill_id);
}
@@ -3089,7 +3098,7 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv,
{
index[i] = -1;
if( itemid[i] < 1 ) continue; // No item
- index[i] = pc_search_inventory(sd, itemid[i]);
+ index[i] = iPc->search_inventory(sd, itemid[i]);
if( index[i] < 0 || sd->status.inventory[index[i]].amount < amount[i] )
{
clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
@@ -3100,7 +3109,7 @@ int skill_check_condition_mercenary(struct block_list *bl, int skill_id, int lv,
// Consume items
for( i = 0; i < ARRAYLENGTH(itemid); i++ )
{
- if( index[i] >= 0 ) pc_delitem(sd, index[i], amount[i], 0, 1, LOG_TYPE_CONSUME);
+ if( index[i] >= 0 ) iPc->delitem(sd, index[i], amount[i], 0, 1, LOG_TYPE_CONSUME);
}
if( type&2 )
@@ -3123,7 +3132,7 @@ int skill_area_sub_count (struct block_list *src, struct block_list *target, uin
*
*------------------------------------------*/
int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
- struct block_list *src = map_id2bl(id),*target;
+ struct block_list *src = iMap->id2bl(id),*target;
struct unit_data *ud = unit_bl2ud(src);
struct skill_timerskill *skl;
int range;
@@ -3138,7 +3147,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
if(src->prev == NULL)
break; // Source not on Map
if(skl->target_id) {
- target = map_id2bl(skl->target_id);
+ target = iMap->id2bl(skl->target_id);
if( ( skl->skill_id == RG_INTIMIDATE || skl->skill_id == SC_FATALMENACE ) && (!target || target->prev == NULL || !check_distance_bl(src,target,AREA_SIZE)) )
target = src; //Required since it has to warp.
if(target == NULL)
@@ -3156,7 +3165,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
case RG_INTIMIDATE:
if (unit_warp(src,-1,-1,-1,CLR_TELEPORT) == 0) {
short x,y;
- map_search_freecell(src, 0, &x, &y, 1, 1, 0);
+ iMap->search_freecell(src, 0, &x, &y, 1, 1, 0);
if (target != src && !status_isdead(target))
unit_warp(target, -1, x, y, CLR_TELEPORT);
}
@@ -3164,16 +3173,16 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
case BA_FROSTJOKER:
case DC_SCREAM:
range= skill->get_splash(skl->skill_id, skl->skill_lv);
- map_foreachinarea(skill->frostjoke_scream,skl->map,skl->x-range,skl->y-range,
+ iMap->foreachinarea(skill->frostjoke_scream,skl->map,skl->x-range,skl->y-range,
skl->x+range,skl->y+range,BL_CHAR,src,skl->skill_id,skl->skill_lv,tick);
break;
case NPC_EARTHQUAKE:
if( skl->type > 1 )
skill->addtimerskill(src,tick+250,src->id,0,0,skl->skill_id,skl->skill_lv,skl->type-1,skl->flag);
- skill_area_temp[0] = map_foreachinrange(skill->area_sub, src, skill->get_splash(skl->skill_id, skl->skill_lv), BL_CHAR, src, skl->skill_id, skl->skill_lv, tick, BCT_ENEMY, skill->area_sub_count);
+ skill_area_temp[0] = iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skl->skill_id, skl->skill_lv), BL_CHAR, src, skl->skill_id, skl->skill_lv, tick, BCT_ENEMY, skill->area_sub_count);
skill_area_temp[1] = src->id;
skill_area_temp[2] = 0;
- map_foreachinrange(skill->area_sub, src, skill->get_splash(skl->skill_id, skl->skill_lv), splash_target(src), src, skl->skill_id, skl->skill_lv, tick, skl->flag, skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skl->skill_id, skl->skill_lv), splash_target(src), src, skl->skill_id, skl->skill_lv, tick, skl->flag, skill->castend_damage_id);
break;
case WZ_WATERBALL:
skill->toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify
@@ -3249,7 +3258,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
unit_warp(src, -1, skl->x, skl->y, 3);
else { // Target's Part
short x = skl->x, y = skl->y;
- map_search_freecell(NULL, target->m, &x, &y, 2, 2, 1);
+ iMap->search_freecell(NULL, target->m, &x, &y, 2, 2, 1);
unit_warp(target,-1,x,y,3);
}
break;
@@ -3270,7 +3279,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
skill->attack(BF_WEAPON, src, src, target, skl->skill_id, skl->skill_lv, tick, skl->flag|SD_LEVEL);
break;
case GN_SPORE_EXPLOSION:
- map_foreachinrange(skill->area_sub, target, skill->get_splash(skl->skill_id, skl->skill_lv), BL_CHAR,
+ iMap->foreachinrange(skill->area_sub, target, skill->get_splash(skl->skill_id, skl->skill_lv), BL_CHAR,
src, skl->skill_id, skl->skill_lv, 0, skl->flag|1|BCT_ENEMY, skill->castend_damage_id);
break;
case CH_PALMSTRIKE:
@@ -3304,7 +3313,7 @@ int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) {
break;
case GN_CRAZYWEED_ATK: {
int dummy = 1, i = skill->get_unit_range(skl->skill_id,skl->skill_lv);
- map_foreachinarea(skill->cell_overlap, src->m, skl->x-i, skl->y-i, skl->x+i, skl->y+i, BL_SKILL, skl->skill_id, &dummy, src);
+ iMap->foreachinarea(skill->cell_overlap, src->m, skl->x-i, skl->y-i, skl->x+i, skl->y+i, BL_SKILL, skl->skill_id, &dummy, src);
}
case WL_EARTHSTRAIN:
skill->unitsetting(src,skl->skill_id,skl->skill_lv,skl->x,skl->y,(skl->type<<16)|skl->flag);
@@ -3335,7 +3344,7 @@ int skill_addtimerskill (struct block_list *src, unsigned int tick, int target,
if( i == MAX_SKILLTIMERSKILL ) return 1;
ud->skilltimerskill[i] = ers_alloc(skill_timer_ers, struct skill_timerskill);
- ud->skilltimerskill[i]->timer = add_timer(tick, skill->timerskill, src->id, i);
+ ud->skilltimerskill[i]->timer = iTimer->add_timer(tick, skill->timerskill, src->id, i);
ud->skilltimerskill[i]->src_id = src->id;
ud->skilltimerskill[i]->target_id = target;
ud->skilltimerskill[i]->skill_id = skill_id;
@@ -3361,7 +3370,7 @@ int skill_cleartimerskill (struct block_list *src)
for(i=0;i<MAX_SKILLTIMERSKILL;i++) {
if(ud->skilltimerskill[i]) {
- delete_timer(ud->skilltimerskill[i]->timer, skill->timerskill);
+ iTimer->delete_timer(ud->skilltimerskill[i]->timer, skill->timerskill);
ers_free(skill_timer_ers, ud->skilltimerskill[i]);
ud->skilltimerskill[i]=NULL;
}
@@ -3374,8 +3383,8 @@ int skill_activate_reverbetion( struct block_list *bl, va_list ap) {
if( bl->type != BL_SKILL )
return 0;
if( su->alive && (sg = su->group) && sg->skill_id == WM_REVERBERATION ) {
- map_foreachinrange(skill->trap_splash, bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, gettick());
- su->limit=DIFF_TICK(gettick(),sg->tick);
+ iMap->foreachinrange(skill->trap_splash, bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, bl, iTimer->gettick());
+ su->limit=DIFF_TICK(iTimer->gettick(),sg->tick);
sg->unit_id = UNT_USED_TRAPS;
}
return 0;
@@ -3433,7 +3442,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
tstatus = status_get_status_data(bl);
- map_freeblock_lock();
+ iMap->freeblock_lock();
switch(skill_id) {
case MER_CRASH:
@@ -3558,7 +3567,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case NC_VULCANARM:
case NC_COLDSLOWER:
case NC_ARMSCANNON:
- if (sd) pc_overheat(sd,1);
+ if (sd) iPc->overheat(sd,1);
case RK_WINDCUTTER:
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag|SD_ANIMATION);
break;
@@ -3581,7 +3590,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case MO_COMBOFINISH:
if (!(flag&1) && sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_MONK)
{ //Becomes a splash attack when Soul Linked.
- map_foreachinrange(skill->area_sub, bl,
+ iMap->foreachinrange(skill->area_sub, bl,
skill->get_splash(skill_id, skill_lv),splash_target(src),
src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
skill->castend_damage_id);
@@ -3592,7 +3601,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case TK_STORMKICK: // Taekwon kicks [Dralnu]
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
skill_area_temp[1] = 0;
- map_foreachinrange(skill->attack_area, src,
+ iMap->foreachinrange(skill->attack_area, src,
skill->get_splash(skill_id, skill_lv), splash_target(src),
BF_WEAPON, src, src, skill_id, skill_lv, tick, flag, BCT_ENEMY);
break;
@@ -3600,7 +3609,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case KN_CHARGEATK: {
bool path = path_search_long(NULL, src->m, src->x, src->y, bl->x, bl->y,CELL_CHKWALL);
unsigned int dist = distance_bl(src, bl);
- uint8 dir = map_calc_dir(bl, src->x, src->y);
+ uint8 dir = iMap->calc_dir(bl, src->x, src->y);
// teleport to target (if not on WoE grounds)
if( !map_flag_gvg(src->m) && !map[src->m].flag.battleground && unit_movepos(src, bl->x, bl->y, 0, 1) )
@@ -3619,7 +3628,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
break;
case NC_FLAMELAUNCHER:
- if (sd) pc_overheat(sd,1);
+ if (sd) iPc->overheat(sd,1);
case SN_SHARPSHOOTING:
case MA_SHARPSHOOTING:
case NJ_KAMAITACHI:
@@ -3627,7 +3636,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
//It won't shoot through walls since on castend there has to be a direct
//line of sight between caster and target.
skill_area_temp[1] = bl->id;
- map_foreachinpath (skill->attack_area,src->m,src->x,src->y,bl->x,bl->y,
+ iMap->foreachinpath (skill->attack_area,src->m,src->x,src->y,bl->x,bl->y,
skill->get_splash(skill_id, skill_lv),skill->get_maxcount(skill_id,skill_lv), splash_target(src),
skill->get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY);
break;
@@ -3638,7 +3647,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case NPC_ICEBREATH:
case NPC_THUNDERBREATH:
skill_area_temp[1] = bl->id;
- map_foreachinpath(skill->attack_area,src->m,src->x,src->y,bl->x,bl->y,
+ iMap->foreachinpath(skill->attack_area,src->m,src->x,src->y,bl->x,bl->y,
skill->get_splash(skill_id, skill_lv),skill->get_maxcount(skill_id,skill_lv), splash_target(src),
skill->get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY);
break;
@@ -3650,8 +3659,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case RG_BACKSTAP:
{
- uint8 dir = map_calc_dir(src, bl->x, bl->y), t_dir = unit_getdir(bl);
- if ((!check_distance_bl(src, bl, 0) && !map_check_dir(dir, t_dir)) || bl->type == BL_SKILL) {
+ uint8 dir = iMap->calc_dir(src, bl->x, bl->y), t_dir = unit_getdir(bl);
+ if ((!check_distance_bl(src, bl, 0) && !iMap->check_dir(dir, t_dir)) || bl->type == BL_SKILL) {
status_change_end(src, SC_HIDING, INVALID_TIMER);
skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag);
dir = dir < 4 ? dir+4 : dir-4; // change direction [Celest]
@@ -3708,7 +3717,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
#endif
, 0);
- dir = map_calc_dir(src,bl->x,bl->y);
+ dir = iMap->calc_dir(src,bl->x,bl->y);
if( dir > 0 && dir < 4) x = -i;
else if( dir > 4 ) x = i;
else x = 0;
@@ -3821,10 +3830,10 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
//SD_LEVEL -> Forced splash damage for Auto Blitz-Beat -> count targets
//special case: Venom Splasher uses a different range for searching than for splashing
if( flag&SD_LEVEL || skill->get_nk(skill_id)&NK_SPLASHSPLIT )
- skill_area_temp[0] = map_foreachinrange(skill->area_sub, bl, (skill_id == AS_SPLASHER)?1:skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, BCT_ENEMY, skill->area_sub_count);
+ skill_area_temp[0] = iMap->foreachinrange(skill->area_sub, bl, (skill_id == AS_SPLASHER)?1:skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, BCT_ENEMY, skill->area_sub_count);
// recursive invocation of skill->castend_damage_id() with flag|1
- map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), ( skill_id == WM_REVERBERATION_MELEE || skill_id == WM_REVERBERATION_MAGIC )?BL_CHAR:splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), ( skill_id == WM_REVERBERATION_MELEE || skill_id == WM_REVERBERATION_MAGIC )?BL_CHAR:splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
}
break;
@@ -3852,13 +3861,13 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
for(i=0;i<c;i++){
if (!skill->blown(src,bl,1,(unit_getdir(src)+4)%8,0x1))
break; //Can't knockback
- skill_area_temp[0] = map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill->area_sub_count);
+ skill_area_temp[0] = iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill->area_sub_count);
if( skill_area_temp[0] > 1 ) break; // collision
}
clif->blown(bl); //Update target pos.
if (i!=c) { //Splash
skill_area_temp[1] = bl->id;
- map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
}
//Weirdo dual-hit property, two attacks for 500%
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0);
@@ -3874,14 +3883,14 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
skill->blown(src,bl,skill_area_temp[2],-1,0);
} else {
int x=bl->x,y=bl->y,i,dir;
- dir = map_calc_dir(bl,src->x,src->y);
+ dir = iMap->calc_dir(bl,src->x,src->y);
skill_area_temp[1] = bl->id;
skill_area_temp[2] = skill->get_blewcount(skill_id,skill_lv);
// all the enemies between the caster and the target are hit, as well as the target
if (skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,0))
skill->blown(src,bl,skill_area_temp[2],-1,0);
for (i=0;i<4;i++) {
- map_foreachincell(skill->area_sub,bl->m,x,y,BL_CHAR,
+ iMap->foreachincell(skill->area_sub,bl->m,x,y,BL_CHAR,
src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
x += dirx[dir];
y += diry[dir];
@@ -3894,7 +3903,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
{
skill_area_temp[1] = bl->id; //NOTE: This is used in skill->castend_nodamage_id to avoid affecting the target.
if (skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag))
- map_foreachinrange(skill->area_sub,bl,
+ iMap->foreachinrange(skill->area_sub,bl,
skill->get_splash(skill_id, skill_lv),BL_CHAR,
src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,
skill->castend_nodamage_id);
@@ -3977,11 +3986,11 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
for( y = src->y - range; y <= src->y + range; ++y )
for( x = src->x - range; x <= src->x + range; ++x )
{
- if( !map_find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL,1) )
+ if( !iMap->find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL,1) )
{
- if( src->type != BL_PC || map_getcell(src->m,x,y,CELL_CHKWATER) ) // non-players bypass the water requirement
+ if( src->type != BL_PC || iMap->getcell(src->m,x,y,CELL_CHKWATER) ) // non-players bypass the water requirement
count++; // natural water cell
- else if( (unit = map_find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL,1)) != NULL || (unit = map_find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL,1)) != NULL )
+ else if( (unit = iMap->find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL,1)) != NULL || (unit = iMap->find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL,1)) != NULL )
{
count++; // skill-induced water cell
skill->delunit(unit); // consume cell
@@ -4087,7 +4096,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
if( !map_flag_gvg(src->m) && !map[src->m].flag.battleground )
{ //You don't move on GVG grounds.
short x, y;
- map_search_freecell(bl, 0, &x, &y, 1, 1, 0);
+ iMap->search_freecell(bl, 0, &x, &y, 1, 1, 0);
if (unit_movepos(src, x, y, 0, 0))
clif->slide(src,src->x,src->y);
}
@@ -4095,7 +4104,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag);
break;
case RK_PHANTOMTHRUST:
- unit_setdir(src,map_calc_dir(src, bl->x, bl->y));
+ unit_setdir(src,iMap->calc_dir(src, bl->x, bl->y));
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
skill->blown(src,bl,distance_bl(src,bl)-1,unit_getdir(src),0);
@@ -4106,7 +4115,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case RK_STORMBLAST:
case RK_CRUSHSTRIKE:
if( sd ) {
- if( pc_checkskill(sd,RK_RUNEMASTERY) >= ( skill_id == RK_CRUSHSTRIKE ? 7 : 3 ) )
+ if( iPc->checkskill(sd,RK_RUNEMASTERY) >= ( skill_id == RK_CRUSHSTRIKE ? 7 : 3 ) )
skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag);
else
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -4116,7 +4125,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
case GC_DARKILLUSION:
{
short x, y;
- short dir = map_calc_dir(src,bl->x,bl->y);
+ short dir = iMap->calc_dir(src,bl->x,bl->y);
if( dir > 0 && dir < 4) x = 2;
else if( dir > 4 ) x = -2;
@@ -4328,7 +4337,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
if( sd && pc_isridingwug(sd) ){
short x[8]={0,-1,-1,-1,0,1,1,1};
short y[8]={1,1,0,-1,-1,-1,0,1};
- uint8 dir = map_calc_dir(bl, src->x, src->y);
+ uint8 dir = iMap->calc_dir(bl, src->x, src->y);
if( unit_movepos(src, bl->x+x[dir], bl->y+y[dir], 1, 1) )
{
@@ -4368,7 +4377,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
item_tmp.nameid = sg->item_id?sg->item_id:ITEMID_TRAP;
item_tmp.identify = 1;
if( item_tmp.nameid )
- map_addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0);
}
skill->delunit(su);
}
@@ -4385,9 +4394,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
}
else
{
- map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
clif->skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- if( sd ) pc_overheat(sd,1);
+ if( sd ) iPc->overheat(sd,1);
}
break;
@@ -4400,11 +4409,11 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
else
{
short x, y;
- map_search_freecell(src, 0, &x, &y, -1, -1, 0);
+ iMap->search_freecell(src, 0, &x, &y, -1, -1, 0);
// Destination area
skill_area_temp[4] = x;
skill_area_temp[5] = y;
- map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
skill->addtimerskill(src,tick + 800,src->id,x,y,skill_id,skill_lv,0,flag); // To teleport Self
clif->skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skill_id,skill_lv,6);
}
@@ -4466,7 +4475,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
status_change_end(bl, SC_HIDING, INVALID_TIMER);
status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER);
} else{
- map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
clif->skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
}
break;
@@ -4487,7 +4496,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag);
else {
clif->skill_nodamage(src, bl, skill_id, 0, 1);
- skill->addtimerskill(src, gettick() + skill->get_time(skill_id, skill_lv) - 1000, bl->id, 0, 0, skill_id, skill_lv, 0, 0);
+ skill->addtimerskill(src, iTimer->gettick() + skill->get_time(skill_id, skill_lv) - 1000, bl->id, 0, 0, skill_id, skill_lv, 0, 0);
}
break;
@@ -4503,7 +4512,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
clif->skill_nodamage(src,battle->get_master(src),skill_id,skill_lv,1);
clif->skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
if( rnd()%100 < 30 )
- map_foreachinrange(skill->area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
else
skill->attack(skill->get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag);
}
@@ -4526,7 +4535,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
clif->skill_nodamage(src,battle->get_master(src),skill_id,skill_lv,1);
clif->skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
if( rnd()%100 < 30 )
- map_foreachinrange(skill->area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub,bl,i,BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
else
skill->attack(skill->get_type(skill_id),src,src,bl,skill_id,skill_lv,tick,flag);
}
@@ -4572,7 +4581,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
if(flag & 1)
skill->attack(skill->get_type(skill_id), src, src, bl, skill_id, skill_lv, tick, flag);
else {
- map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag | BCT_ENEMY | SD_SPLASH | 1, skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag | BCT_ENEMY | SD_SPLASH | 1, skill->castend_damage_id);
}
break;
@@ -4600,7 +4609,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, SD_LEVEL|flag);
} else {
skill_area_temp[1] = bl->id;
- map_foreachinrange(skill->area_sub, bl,
+ iMap->foreachinrange(skill->area_sub, bl,
sd->bonus.splash_range, BL_CHAR,
src, skill_id, skill_lv, tick, flag | BCT_ENEMY | 1,
skill->castend_damage_id);
@@ -4614,18 +4623,18 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
clif->skill_damage(src, bl, tick, status_get_amotion(src), tstatus->dmotion,
0, abs(skill->get_num(skill_id, skill_lv)),
skill_id, skill_lv, skill->get_hit(skill_id));
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
if( sc && sc->data[SC_CURSEDCIRCLE_ATKER] ) //Should only remove after the skill has been casted.
status_change_end(src,SC_CURSEDCIRCLE_ATKER,INVALID_TIMER);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
if( sd && !(flag&1) )
{// ensure that the skill last-cast tick is recorded
- sd->canskill_tick = gettick();
+ sd->canskill_tick = iTimer->gettick();
if( sd->state.arrow_atk )
{// consume arrow on last invocation to this skill.
@@ -4749,7 +4758,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
battle->attr_fix(NULL, NULL, 100, i, tstatus->def_ele, tstatus->ele_lv) <= 0)
return 1; //Skills that cause an status should be blocked if the target element blocks its element.
- map_freeblock_lock();
+ iMap->freeblock_lock();
switch(skill_id) {
case HLIF_HEAL: //[orn]
case AL_HEAL:
@@ -4797,7 +4806,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
heal_get_jobexp = heal_get_jobexp * battle_config.heal_exp / 100;
if (heal_get_jobexp <= 0)
heal_get_jobexp = 1;
- pc_gainexp (sd, bl, 0, heal_get_jobexp, false);
+ iPc->gainexp (sd, bl, 0, heal_get_jobexp, false);
}
}
break;
@@ -4819,8 +4828,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
skill_area_temp[0] = 5 - skill_area_temp[0]; // The actual penalty...
if (skill_area_temp[0] > 0 && !map[src->m].flag.noexppenalty) { //Apply penalty
- sd->status.base_exp -= min(sd->status.base_exp, pc_nextbaseexp(sd) * skill_area_temp[0] * 2/1000); //0.2% penalty per each.
- sd->status.job_exp -= min(sd->status.job_exp, pc_nextjobexp(sd) * skill_area_temp[0] * 2/1000);
+ sd->status.base_exp -= min(sd->status.base_exp, iPc->nextbaseexp(sd) * skill_area_temp[0] * 2/1000); //0.2% penalty per each.
+ sd->status.job_exp -= min(sd->status.job_exp, iPc->nextjobexp(sd) * skill_area_temp[0] * 2/1000);
clif->updatestatus(sd,SP_BASEEXP);
clif->updatestatus(sd,SP_JOBEXP);
}
@@ -4864,16 +4873,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
int exp = 0,jexp = 0;
int lv = dstsd->status.base_level - sd->status.base_level, jlv = dstsd->status.job_level - sd->status.job_level;
- if(lv > 0 && pc_nextbaseexp(dstsd)) {
+ if(lv > 0 && iPc->nextbaseexp(dstsd)) {
exp = (int)((double)dstsd->status.base_exp * (double)lv * (double)battle_config.resurrection_exp / 1000000.);
if (exp < 1) exp = 1;
}
- if(jlv > 0 && pc_nextjobexp(dstsd)) {
+ if(jlv > 0 && iPc->nextjobexp(dstsd)) {
jexp = (int)((double)dstsd->status.job_exp * (double)lv * (double)battle_config.resurrection_exp / 1000000.);
if (jexp < 1) jexp = 1;
}
if(exp > 0 || jexp > 0)
- pc_gainexp (sd, bl, exp, jexp, false);
+ iPc->gainexp (sd, bl, exp, jexp, false);
}
}
}
@@ -4889,7 +4898,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (flag&1)
sc_start(bl,type, 23+skill_lv*4 +status_get_lv(src) -status_get_lv(bl), skill_lv,skill->get_time(skill_id,skill_lv));
else {
- map_foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
}
@@ -4945,7 +4954,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (!target_id)
break;
if (skill->get_casttype(abra_skill_id) == CAST_GROUND) {
- bl = map_id2bl(target_id);
+ bl = iMap->id2bl(target_id);
if (!bl) bl = src;
unit_skilluse_pos(src, bl->x, bl->y, abra_skill_id, abra_skill_lv);
} else
@@ -4985,7 +4994,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
case SA_LEVELUP:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- if (sd && pc_nextbaseexp(sd)) pc_gainexp(sd, NULL, pc_nextbaseexp(sd) * 10 / 100, 0, false);
+ if (sd && iPc->nextbaseexp(sd)) iPc->gainexp(sd, NULL, iPc->nextbaseexp(sd) * 10 / 100, 0, false);
break;
case SA_INSTANTDEATH:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
@@ -5033,7 +5042,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
case SA_FORTUNE:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- if(sd) pc_getzeny(sd,status_get_lv(bl)*100,LOG_TYPE_STEAL,NULL);
+ if(sd) iPc->getzeny(sd,status_get_lv(bl)*100,LOG_TYPE_STEAL,NULL);
break;
case SA_TAMINGMONSTER:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
@@ -5048,7 +5057,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if(sd && dstsd){ //Check they are not another crusader [Skotlex]
if ((dstsd->class_&MAPID_UPPERMASK) == MAPID_CRUSADER) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
}
@@ -5063,7 +5072,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( sd && dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER && dstsd->status.sex == sd->status.sex )
{// Cannot cast on another bard/dancer-type class of the same gender as caster
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
@@ -5087,7 +5096,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
}
@@ -5170,7 +5179,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case SM_MAGNUM:
case MS_MAGNUM:
skill_area_temp[1] = 0;
- map_foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_SKILL|BL_CHAR,
+ iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_SKILL|BL_CHAR,
src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
clif->skill_nodamage (src,src,skill_id,skill_lv,1);
// Initiate 10% of your damage becomes fire element.
@@ -5277,7 +5286,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case SO_STRIKING:
if (sd) {
int bonus = 25 + 10 * skill_lv;
- bonus += (pc_checkskill(sd, SA_FLAMELAUNCHER)+pc_checkskill(sd, SA_FROSTWEAPON)+pc_checkskill(sd, SA_LIGHTNINGLOADER)+pc_checkskill(sd, SA_SEISMICWEAPON))*5;
+ bonus += (iPc->checkskill(sd, SA_FLAMELAUNCHER)+iPc->checkskill(sd, SA_FROSTWEAPON)+iPc->checkskill(sd, SA_LIGHTNINGLOADER)+iPc->checkskill(sd, SA_SEISMICWEAPON))*5;
clif->skill_nodamage( src, bl, skill_id, skill_lv,
battle->check_target(src,bl,BCT_PARTY) > 0 ?
sc_start2(bl, type, 100, skill_lv, bonus, skill->get_time(skill_id,skill_lv)) :
@@ -5325,7 +5334,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv));
else
{
- map_foreachinrange(skill->area_sub, bl,
+ iMap->foreachinrange(skill->area_sub, bl,
skill->get_splash(skill_id, skill_lv), BL_PC,
src, skill_id, skill_lv, tick, flag|BCT_ALL|1,
skill->castend_nodamage_id);
@@ -5394,7 +5403,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
clif->skill_nodamage(src,bl,skill_id,skill_lv,
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
- map_foreachinrange( status_change_timer_sub, src,
+ iMap->foreachinrange( status_change_timer_sub, src,
skill->get_splash(skill_id, skill_lv), BL_CHAR,
src,NULL,type,tick);
}
@@ -5405,7 +5414,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case MER_PROVOKE:
if( (tstatus->mode&MD_BOSS) || battle->check_undead(tstatus->race,tstatus->def_ele) )
{
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
//TODO: How much does base level affects? Dummy value of 1% per level difference used. [Skotlex]
@@ -5415,7 +5424,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
unit_skillcastcancel(bl, 2);
@@ -5457,7 +5466,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
@@ -5472,7 +5481,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( i == count )
{ // No free slots, skill Fail
clif->skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
}
@@ -5494,7 +5503,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( sd->sc.data[SC_RAISINGDRAGON] )
limit += sd->sc.data[SC_RAISINGDRAGON]->val1;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- pc_addspiritball(sd,skill->get_time(skill_id,skill_lv),limit);
+ iPc->addspiritball(sd,skill->get_time(skill_id,skill_lv),limit);
}
break;
@@ -5505,13 +5514,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
limit += sd->sc.data[SC_RAISINGDRAGON]->val1;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
for (i = 0; i < limit; i++)
- pc_addspiritball(sd,skill->get_time(skill_id,skill_lv),limit);
+ iPc->addspiritball(sd,skill->get_time(skill_id,skill_lv),limit);
}
break;
case MO_KITRANSLATION:
if(dstsd && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER) {
- pc_addspiritball(dstsd,skill->get_time(skill_id,skill_lv),5);
+ iPc->addspiritball(dstsd,skill->get_time(skill_id,skill_lv),5);
}
break;
@@ -5528,7 +5537,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (dstsd && dstsd->spiritball && (sd == dstsd || map_flag_vs(src->m)) && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER)
{ // split the if for readability, and included gunslingers in the check so that their coins cannot be removed [Reddozen]
i = dstsd->spiritball * 7;
- pc_delspiritball(dstsd,dstsd->spiritball,0);
+ iPc->delspiritball(dstsd,dstsd->spiritball,0);
} else if (dstmd && !(tstatus->mode&MD_BOSS) && rnd() % 100 < 20)
{ // check if target is a monster and not a Boss, for the 20% chance to absorb 2 SP per monster's level [Reddozen]
i = 2 * dstmd->level;
@@ -5566,7 +5575,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RG_RAID:
skill_area_temp[1] = 0;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinrange(skill->area_sub, bl,
+ iMap->foreachinrange(skill->area_sub, bl,
skill->get_splash(skill_id, skill_lv), splash_target(src),
src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
skill->castend_damage_id);
@@ -5584,7 +5593,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case KO_HAPPOKUNAI:
skill_area_temp[1] = 0;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- i = map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src),
+ i = iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src),
src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_damage_id);
if( !i && ( skill_id == NC_AXETORNADO || skill_id == SR_SKYNETBLOW || skill_id == KO_HAPPOKUNAI ) )
clif->skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
@@ -5617,7 +5626,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
//Passive side of the attack.
status_change_end(src, SC_SIGHT, INVALID_TIMER);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinrange(skill->area_sub,src,
+ iMap->foreachinrange(skill->area_sub,src,
skill->get_splash(skill_id, skill_lv),BL_CHAR|BL_SKILL,
src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
skill->castend_damage_id);
@@ -5628,7 +5637,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case WZ_FROSTNOVA:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
skill_area_temp[1] = 0;
- map_foreachinrange(skill->attack_area, src,
+ iMap->foreachinrange(skill->attack_area, src,
skill->get_splash(skill_id, skill_lv), splash_target(src),
BF_MAGIC, src, src, skill_id, skill_lv, tick, flag, BCT_ENEMY);
break;
@@ -5640,12 +5649,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
i = ((!md || md->special_state.ai == 2) && !map_flag_vs(src->m))?
BCT_ENEMY:BCT_ALL;
clif->skill_nodamage(src, src, skill_id, -1, 1);
- map_delblock(src); //Required to prevent chain-self-destructions hitting back.
- map_foreachinrange(skill->area_sub, bl,
+ iMap->delblock(src); //Required to prevent chain-self-destructions hitting back.
+ iMap->foreachinrange(skill->area_sub, bl,
skill->get_splash(skill_id, skill_lv), splash_target(src),
src, skill_id, skill_lv, tick, flag|i,
skill->castend_damage_id);
- map_addblock(src);
+ iMap->addblock(src);
status_damage(src, src, sstatus->max_hp,0,0,1);
break;
@@ -5704,7 +5713,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( tsce )
{
clif->skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER));
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
@@ -5743,12 +5752,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (tsce)
{
clif->skill_nodamage(src,bl,skill_id,-1,status_change_end(bl, type, INVALID_TIMER)); //Hide skill-scream animation.
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
} else if( tsc && tsc->option&OPTION_MADOGEAR ) {
//Mado Gear cannot hide
if( sd ) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
clif->skill_nodamage(src,bl,skill_id,-1,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
@@ -5757,7 +5766,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (tsce)
{
clif->skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER));
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start4(bl,type,100,skill_lv,unit_getdir(bl),0,0,0));
@@ -5775,7 +5784,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_nodamage(src,bl,skill_id,( skill_id == LG_FORCEOFVANGUARD ) ? skill_lv : -1,i);
else if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
case RA_CAMOUFLAGE:
@@ -5831,7 +5840,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case TF_STEAL:
if(sd) {
- if(pc_steal_item(sd,bl,skill_lv))
+ if(iPc->steal_item(sd,bl,skill_lv))
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
else
clif->skill_fail(sd,skill_id,USESKILL_FAIL,0);
@@ -5840,7 +5849,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RG_STEALCOIN:
if(sd) {
- if(pc_steal_coin(sd,bl))
+ if(iPc->steal_coin(sd,bl))
{
dstmd->state.provoke_flag = src->id;
mob_target(dstmd, src, skill->get_range2(src,skill_id,skill_lv));
@@ -5879,7 +5888,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
// Level 6-10 doesn't consume a red gem if it fails [celest]
if (skill_lv > 5)
{ // not to consume items
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
}
@@ -6010,7 +6019,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case MC_VENDING:
if(sd)
{ //Prevent vending of GMs with unnecessary Level to trade/drop. [Skotlex]
- if ( !pc_can_give_items(sd) )
+ if ( !iPc->can_give_items(sd) )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
else {
sd->state.prevend = 1;
@@ -6035,9 +6044,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( sd->state.autocast || ( (sd->skillitem == AL_TELEPORT || battle_config.skip_teleport_lv1_menu) && skill_lv == 1 ) || skill_lv == 3 )
{
if( skill_lv == 1 )
- pc_randomwarp(sd,CLR_TELEPORT);
+ iPc->randomwarp(sd,CLR_TELEPORT);
else
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
}
@@ -6076,10 +6085,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
item_tmp.identify = 1;
tbl.id = 0;
clif->takeitem(&sd->bl,&tbl);
- eflag = pc_additem(sd,&item_tmp,1,LOG_TYPE_PRODUCE);
+ eflag = iPc->additem(sd,&item_tmp,1,LOG_TYPE_PRODUCE);
if(eflag) {
clif->additem(sd,0,0,eflag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
break;
@@ -6164,29 +6173,30 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case AM_BERSERKPITCHER:
case AM_POTIONPITCHER: {
- int i,hp = 0,sp = 0;
+ int i,sp = 0;
+ int64 hp = 0;
if( dstmd && dstmd->class_ == MOBID_EMPERIUM ) {
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
if( sd ) {
int x,bonus=100;
x = skill_lv%11 - 1;
- i = pc_search_inventory(sd,skill_db[skill_id].itemid[x]);
+ i = iPc->search_inventory(sd,skill_db[skill_id].itemid[x]);
if( i < 0 || skill_db[skill_id].itemid[x] <= 0 ) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
if(sd->inventory_data[i] == NULL || sd->status.inventory[i].amount < skill_db[skill_id].amount[x]) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
if( skill_id == AM_BERSERKPITCHER ) {
if( dstsd && dstsd->status.base_level < (unsigned int)sd->inventory_data[i]->elv ) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
}
@@ -6199,23 +6209,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
bonus += sd->status.base_level;
if( potion_per_hp > 0 || potion_per_sp > 0 ) {
hp = tstatus->max_hp * potion_per_hp / 100;
- hp = hp * (100 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
+ hp = hp * (100 + iPc->checkskill(sd,AM_POTIONPITCHER)*10 + iPc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
if( dstsd ) {
sp = dstsd->status.max_sp * potion_per_sp / 100;
- sp = sp * (100 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
+ sp = sp * (100 + iPc->checkskill(sd,AM_POTIONPITCHER)*10 + iPc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
}
} else {
if( potion_hp > 0 ) {
- hp = potion_hp * (100 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
+ hp = potion_hp * (100 + iPc->checkskill(sd,AM_POTIONPITCHER)*10 + iPc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
hp = hp * (100 + (tstatus->vit<<1)) / 100;
if( dstsd )
- hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10) / 100;
+ hp = hp * (100 + iPc->checkskill(dstsd,SM_RECOVERY)*10) / 100;
}
if( potion_sp > 0 ) {
- sp = potion_sp * (100 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
+ sp = potion_sp * (100 + iPc->checkskill(sd,AM_POTIONPITCHER)*10 + iPc->checkskill(sd,AM_LEARNINGPOTION)*5)*bonus/10000;
sp = sp * (100 + (tstatus->int_<<1)) / 100;
if( dstsd )
- sp = sp * (100 + pc_checkskill(dstsd,MG_SRECOVERY)*10) / 100;
+ sp = sp * (100 + iPc->checkskill(dstsd,MG_SRECOVERY)*10) / 100;
}
}
@@ -6224,7 +6234,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sp += sp * sd->itemgrouphealrate[IG_POTION] / 100;
}
- if( (i = pc_skillheal_bonus(sd, skill_id)) ) {
+ if( (i = iPc->skillheal_bonus(sd, skill_id)) ) {
hp += hp * i / 100;
sp += sp * i / 100;
}
@@ -6232,9 +6242,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
hp = (1 + rnd()%400) * (100 + skill_lv*10) / 100;
hp = hp * (100 + (tstatus->vit<<1)) / 100;
if( dstsd )
- hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10) / 100;
+ hp = hp * (100 + iPc->checkskill(dstsd,SM_RECOVERY)*10) / 100;
}
- if( dstsd && (i = pc_skillheal2_bonus(dstsd, skill_id)) ) {
+ if( dstsd && (i = iPc->skillheal2_bonus(dstsd, skill_id)) ) {
hp += hp * i / 100;
sp += sp * i / 100;
}
@@ -6254,14 +6264,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
if( hp > 0 || (skill_id == AM_POTIONPITCHER && sp <= 0) )
- clif->skill_nodamage(NULL,bl,AL_HEAL,hp,1);
+ clif->skill_nodamage(NULL,bl,AL_HEAL,(int)hp,1);
if( sp > 0 )
clif->skill_nodamage(NULL,bl,MG_SRECOVERY,sp,1);
#ifdef RENEWAL
if( tsc && tsc->data[SC_EXTREMITYFIST2] )
sp = 0;
#endif
- status_heal(bl,hp,sp,0);
+ status_heal(bl,(int)hp,sp,0);
}
break;
case AM_CP_WEAPON:
@@ -6271,9 +6281,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
unsigned int equip[] = {EQP_WEAPON, EQP_SHIELD, EQP_ARMOR, EQP_HEAD_TOP};
- if( sd && ( bl->type != BL_PC || ( dstsd && pc_checkequip(dstsd,equip[skill_id - AM_CP_WEAPON]) < 0 ) ) ){
+ if( sd && ( bl->type != BL_PC || ( dstsd && iPc->checkequip(dstsd,equip[skill_id - AM_CP_WEAPON]) < 0 ) ) ){
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock(); // Don't consume item requirements
+ iMap->freeblock_unlock(); // Don't consume item requirements
return 0;
}
@@ -6299,7 +6309,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
case AM_TWILIGHT3:
if (sd) {
- int ebottle = pc_search_inventory(sd,713);
+ int ebottle = iPc->search_inventory(sd,713);
if( ebottle >= 0 )
ebottle = sd->status.inventory[ebottle].amount;
//check if you can produce all three, if not, then fail:
@@ -6414,7 +6424,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
}
//Affect all targets on splash area.
- map_foreachinrange(skill->area_sub, bl, i, BL_CHAR,
+ iMap->foreachinrange(skill->area_sub, bl, i, BL_CHAR,
src, skill_id, skill_lv, tick, flag|1,
skill->castend_damage_id);
break;
@@ -6440,7 +6450,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
clif->skill_nodamage(src,bl,TK_HIGHJUMP,skill_lv,1);
- if(!map_count_oncell(src->m,x,y,BL_PC|BL_NPC|BL_MOB) && map_getcell(src->m,x,y,CELL_CHKREACH)) {
+ if(!iMap->count_oncell(src->m,x,y,BL_PC|BL_NPC|BL_MOB) && iMap->getcell(src->m,x,y,CELL_CHKREACH)) {
clif->slide(src,x,y);
unit_movepos(src, x, y, 1, 0);
}
@@ -6551,7 +6561,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case BS_GREED:
if(sd){
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinrange(skill->greed,bl,
+ iMap->foreachinrange(skill->greed,bl,
skill->get_splash(skill_id, skill_lv),BL_ITEM,bl);
}
break;
@@ -6660,7 +6670,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
// not really needed... but adding here anyway ^^
if (md && md->master_id > 0) {
struct block_list *mbl, *tbl;
- if ((mbl = map_id2bl(md->master_id)) == NULL ||
+ if ((mbl = iMap->id2bl(md->master_id)) == NULL ||
(tbl = battle->get_targeted(mbl)) == NULL)
break;
md->state.provoke_flag = tbl->id;
@@ -6671,7 +6681,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case NPC_RUN:
{
const int mask[8][2] = {{0,-1},{1,-1},{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1}};
- uint8 dir = (bl == src)?unit_getdir(src):map_calc_dir(src,bl->x,bl->y); //If cast on self, run forward, else run away.
+ uint8 dir = (bl == src)?unit_getdir(src):iMap->calc_dir(src,bl->x,bl->y); //If cast on self, run forward, else run away.
unit_stop_attack(src);
//Run skillv tiles overriding the can-move check.
if (unit_walktoxy(src, src->x + skill_lv * mask[dir][0], src->y + skill_lv * mask[dir][1], 2) && md)
@@ -6756,12 +6766,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
// parent-baby skills
case WE_BABY:
if(sd){
- struct map_session_data *f_sd = pc_get_father(sd);
- struct map_session_data *m_sd = pc_get_mother(sd);
+ struct map_session_data *f_sd = iPc->get_father(sd);
+ struct map_session_data *m_sd = iPc->get_mother(sd);
// if neither was found
if(!f_sd && !m_sd){
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
status_change_start(bl,SC_STUN,10000,skill_lv,0,0,0,skill->get_time2(skill_id,skill_lv),8);
@@ -6809,10 +6819,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = skill_db[su->group->skill_id].itemid[i];
item_tmp.identify = 1;
- if( item_tmp.nameid && (flag=pc_additem(sd,&item_tmp,skill_db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) )
+ if( item_tmp.nameid && (flag=iPc->additem(sd,&item_tmp,skill_db[su->group->skill_id].amount[i],LOG_TYPE_OTHER)) )
{
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,skill_db[su->group->skill_id].amount[i],sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,skill_db[su->group->skill_id].amount[i],sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -6823,10 +6833,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = su->group->item_id?su->group->item_id:ITEMID_TRAP;
item_tmp.identify = 1;
- if( item_tmp.nameid && (flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) )
+ if( item_tmp.nameid && (flag=iPc->additem(sd,&item_tmp,1,LOG_TYPE_OTHER)) )
{
clif->additem(sd,0,0,flag);
- map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
}
@@ -6881,7 +6891,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
#endif
) {
if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,
@@ -6894,14 +6904,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case PF_MINDBREAKER:
{
if(tstatus->mode&MD_BOSS || battle->check_undead(tstatus->race,tstatus->def_ele) ) {
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
if (tsce)
{ //HelloKitty2 (?) explained that this silently fails when target is
//already inflicted. [Skotlex]
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
@@ -6910,7 +6920,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,type,55+5*skill_lv,skill_lv,skill->get_time(skill_id,skill_lv))))
{
if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
@@ -6967,9 +6977,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sp = sp * (100 + (tstatus->int_<<1))/100;
if (dstsd) {
if (hp)
- hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10 + pc_skillheal2_bonus(dstsd, skill_id))/100;
+ hp = hp * (100 + iPc->checkskill(dstsd,SM_RECOVERY)*10 + iPc->skillheal2_bonus(dstsd, skill_id))/100;
if (sp)
- sp = sp * (100 + pc_checkskill(dstsd,MG_SRECOVERY)*10 + pc_skillheal2_bonus(dstsd, skill_id))/100;
+ sp = sp * (100 + iPc->checkskill(dstsd,MG_SRECOVERY)*10 + iPc->skillheal2_bonus(dstsd, skill_id))/100;
}
if( tsc && tsc->count ) {
if (tsc->data[SC_CRITICALWOUND]) {
@@ -6999,14 +7009,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
int i, s = 0, skilltime = skill->get_time(skill_id,skill_lv);
for (i=0 ; i<4; i++) {
- if( bl->type != BL_PC || ( dstsd && pc_checkequip(dstsd,equip[i]) < 0 ) )
+ if( bl->type != BL_PC || ( dstsd && iPc->checkequip(dstsd,equip[i]) < 0 ) )
continue;
sc_start(bl,(sc_type)(SC_CP_WEAPON + i),100,skill_lv,skilltime);
s++;
}
if( sd && !s ){
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock(); // Don't consume item requirements
+ iMap->freeblock_unlock(); // Don't consume item requirements
return 0;
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
@@ -7036,7 +7046,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
status_zap(src,0,skill_db[skill->get_index(skill_id)].sp[skill_lv]); // consume sp only if succeeded [Inkfish]
@@ -7189,7 +7199,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id, skill_lv));
} else if (status_get_guild_id(src)) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinrange(skill->area_sub, src,
+ iMap->foreachinrange(skill->area_sub, src,
skill->get_splash(skill_id, skill_lv), BL_PC,
src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
skill->castend_nodamage_id);
@@ -7203,7 +7213,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id, skill_lv));
} else if (status_get_guild_id(src)) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinrange(skill->area_sub, src,
+ iMap->foreachinrange(skill->area_sub, src,
skill->get_splash(skill_id, skill_lv), BL_PC,
src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
skill->castend_nodamage_id);
@@ -7217,7 +7227,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_nodamage(src,bl,AL_HEAL,status_percent_heal(bl,90,90),1);
} else if (status_get_guild_id(src)) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinrange(skill->area_sub, src,
+ iMap->foreachinrange(skill->area_sub, src,
skill->get_splash(skill_id, skill_lv), BL_PC,
src,skill_id,skill_lv,tick, flag|BCT_GUILD|1,
skill->castend_nodamage_id);
@@ -7241,9 +7251,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if ((dstsd = g->member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd)) {
if (map[dstsd->bl.m].flag.nowarp && !map_flag_gvg2(dstsd->bl.m))
continue;
- if(map_getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH))
+ if(iMap->getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH))
dx[j] = dy[j] = 0;
- pc_setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN);
+ iPc->setpos(dstsd, map_id2index(src->m), src->x+dx[j], src->y+dy[j], CLR_RESPAWN);
}
}
if (sd)
@@ -7264,7 +7274,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case SG_HATE:
if (sd) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- if (!pc_set_hate_mob(sd, skill_lv-1, bl))
+ if (!iPc->set_hate_mob(sd, skill_lv-1, bl))
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
}
break;
@@ -7273,9 +7283,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if(sd) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
if(rnd()%100 < (20+10*skill_lv))
- pc_addspiritball(sd,skill->get_time(skill_id,skill_lv),10);
+ iPc->addspiritball(sd,skill->get_time(skill_id,skill_lv),10);
else if(sd->spiritball > 0)
- pc_delspiritball(sd,1,0);
+ iPc->delspiritball(sd,1,0);
}
break;
@@ -7323,7 +7333,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
//TODO: Shouldn't also players and the like switch targets?
- map_foreachinrange(skill->chastle_mob_changetarget,src,
+ iMap->foreachinrange(skill->chastle_mob_changetarget,src,
AREA_SIZE, BL_MOB, bl, src);
}
}
@@ -7343,7 +7353,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
else if(r<per[i][1]) //Master
bl = battle->get_master(src);
else //Enemy
- bl = map_id2bl(battle->get_target(src));
+ bl = iMap->id2bl(battle->get_target(src));
if (!bl) bl = src;
i = skill->calc_heal(src, bl, skill_id, 1+rnd()%skill_lv, true);
@@ -7395,7 +7405,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
else {
skill_area_temp[2] = 0; //For SD_PREAMBLE
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinrange(skill->area_sub, bl,
+ iMap->foreachinrange(skill->area_sub, bl,
skill->get_splash(skill_id, skill_lv),BL_CHAR,
src,skill_id,skill_lv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1,
skill->castend_nodamage_id);
@@ -7407,7 +7417,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
else {
skill_area_temp[2] = 0; //For SD_PREAMBLE
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinrange(skill->area_sub, bl,
+ iMap->foreachinrange(skill->area_sub, bl,
skill->get_splash(skill_id, skill_lv),BL_CHAR,
src,skill_id,skill_lv,tick, flag|BCT_ENEMY|SD_PREAMBLE|1,
skill->castend_nodamage_id);
@@ -7447,7 +7457,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
skill_area_temp[2] = 0;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinrange(skill->area_sub, src,
+ iMap->foreachinrange(skill->area_sub, src,
skill->get_splash(skill_id,skill_lv),BL_CHAR,
src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|1,
skill->castend_nodamage_id);
@@ -7459,13 +7469,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
i = skill->get_splash(skill_id,skill_lv);
if( skill_id == LG_EARTHDRIVE ) {
int dummy = 1;
- map_foreachinarea(skill->cell_overlap, src->m, src->x-i, src->y-i, src->x+i, src->y+i, BL_SKILL, LG_EARTHDRIVE, &dummy, src);
+ iMap->foreachinarea(skill->cell_overlap, src->m, src->x-i, src->y-i, src->x+i, src->y+i, BL_SKILL, LG_EARTHDRIVE, &dummy, src);
}
- map_foreachinrange(skill->area_sub, bl,i,BL_CHAR,
+ iMap->foreachinrange(skill->area_sub, bl,i,BL_CHAR,
src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
break;
case RK_STONEHARDSKIN:
- if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 4 )
+ if( sd && iPc->checkskill(sd,RK_RUNEMASTERY) >= 4 )
{
int heal = sstatus->hp / 4; // 25% HP
if( status_charge(bl,heal,0) )
@@ -7475,7 +7485,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
break;
case RK_REFRESH:
- if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 8 )
+ if( sd && iPc->checkskill(sd,RK_RUNEMASTERY) >= 8 )
{
int heal = status_get_max_hp(bl) * 25 / 100;
clif->skill_nodamage(src,bl,skill_id,skill_lv,
@@ -7486,7 +7496,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
case RK_MILLENNIUMSHIELD:
- if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 9 )
+ if( sd && iPc->checkskill(sd,RK_RUNEMASTERY) >= 9 )
{
short shields = (rnd()%100<50) ? 4 : ((rnd()%100<80) ? 3 : 2);
sc_start4(bl,type,100,skill_lv,shields,1000,0,skill->get_time(skill_id,skill_lv));
@@ -7508,7 +7518,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
lv = 6;
else if( skill_id == RK_CRUSHSTRIKE )
lv = 7;
- if( pc_checkskill(sd,RK_RUNEMASTERY) >= lv )
+ if( iPc->checkskill(sd,RK_RUNEMASTERY) >= lv )
clif->skill_nodamage(src,bl,skill_id,skill_lv,sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv)));
}
break;
@@ -7516,10 +7526,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RK_FIGHTINGSPIRIT:
if( flag&1 ) {
if( src == bl )
- sc_start2(bl,type,100,skill_area_temp[5],10*(sd?pc_checkskill(sd,RK_RUNEMASTERY):10),skill->get_time(skill_id,skill_lv));
+ sc_start2(bl,type,100,skill_area_temp[5],10*(sd?iPc->checkskill(sd,RK_RUNEMASTERY):10),skill->get_time(skill_id,skill_lv));
else
sc_start(bl,type,100,skill_area_temp[5]/4,skill->get_time(skill_id,skill_lv));
- } else if( sd && pc_checkskill(sd,RK_RUNEMASTERY) >= 5 ) {
+ } else if( sd && iPc->checkskill(sd,RK_RUNEMASTERY) >= 5 ) {
if( sd->status.party_id ) {
i = party_foreachsamemap(skill->area_sub,sd,skill->get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,BCT_PARTY,skill->area_sub_count);
skill_area_temp[5] = 7 * i; // ATK
@@ -7536,7 +7546,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
{
short count = 1;
skill_area_temp[2] = 0;
- map_foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|SD_SPLASH|1,skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_PREAMBLE|SD_SPLASH|1,skill->castend_damage_id);
if( tsc && tsc->data[SC_ROLLINGCUTTER] )
{ // Every time the skill is casted the status change is reseted adding a counter.
count += (short)tsc->data[SC_ROLLINGCUTTER]->val1;
@@ -7590,7 +7600,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case GC_PHANTOMMENACE:
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,
+ iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,
src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
break;
@@ -7622,8 +7632,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case AB_CLEMENTIA:
case AB_CANTO:
{
- int bless_lv = pc_checkskill(sd,AL_BLESSING) + (sd->status.job_level / 10);
- int agi_lv = pc_checkskill(sd,AL_INCAGI) + (sd->status.job_level / 10);
+ int bless_lv = iPc->checkskill(sd,AL_BLESSING) + (sd->status.job_level / 10);
+ int agi_lv = iPc->checkskill(sd,AL_INCAGI) + (sd->status.job_level / 10);
if( sd == NULL || sd->status.party_id == 0 || flag&1 )
clif->skill_nodamage(bl, bl, skill_id, skill_lv, sc_start(bl,type,100,
(skill_id == AB_CLEMENTIA)? bless_lv : (skill_id == AB_CANTO)? agi_lv : skill_lv, skill->get_time(skill_id,skill_lv)));
@@ -7642,7 +7652,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case AB_CHEAL:
if( sd == NULL || sd->status.party_id == 0 || flag&1 ) {
if( sd && tstatus && !battle->check_undead(tstatus->race, tstatus->def_ele) ) {
- i = skill->calc_heal(src, bl, AL_HEAL, pc_checkskill(sd, AL_HEAL), true);
+ i = skill->calc_heal(src, bl, AL_HEAL, iPc->checkskill(sd, AL_HEAL), true);
if( (dstsd && pc_ismadogear(dstsd)) || status_isimmune(bl))
i = 0; // Should heal by 0 or won't do anything?? in iRO it breaks the healing to members.. [malufett]
@@ -7662,7 +7672,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl, type, 40 + 5 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv));
else
{
- map_foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
}
@@ -7776,12 +7786,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
break;
}
- map_foreachinrange(skill->area_sub, bl, i, BL_CHAR, src, skill_id, skill_lv, tick, flag|1, skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub, bl, i, BL_CHAR, src, skill_id, skill_lv, tick, flag|1, skill->castend_damage_id);
break;
case AB_SILENTIUM:
// Should the level of Lex Divina be equivalent to the level of Silentium or should the highest level learned be used? [LimitLine]
- map_foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id, skill_lv), BL_CHAR,
src, PR_LEXDIVINA, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
break;
@@ -7793,7 +7803,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv));
else
{
- map_foreachinrange(skill->area_sub,src,skill->get_splash(skill_id, skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,(map_flag_vs(src->m)?BCT_ALL:BCT_ENEMY|BCT_SELF)|flag|1,skill->castend_nodamage_id);
+ iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id, skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,(map_flag_vs(src->m)?BCT_ALL:BCT_ENEMY|BCT_SELF)|flag|1,skill->castend_nodamage_id);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
}
break;
@@ -7823,12 +7833,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case WL_FROSTMISTY:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill->castend_damage_id);
break;
case WL_JACKFROST:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_foreachinshootrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ iMap->foreachinshootrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
break;
case WL_MARSHOFABYSS:
@@ -7863,7 +7873,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( rate ) {
skill_area_temp[1] = bl->id;
- map_foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_nodamage_id);
+ iMap->foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_nodamage_id);
}
// Doesn't send failure packet if it fails on defense.
}
@@ -7937,9 +7947,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RA_WUGMASTERY:
if( sd ) {
if( !pc_iswug(sd) )
- pc_setoption(sd,sd->sc.option|OPTION_WUG);
+ iPc->setoption(sd,sd->sc.option|OPTION_WUG);
else
- pc_setoption(sd,sd->sc.option&~OPTION_WUG);
+ iPc->setoption(sd,sd->sc.option&~OPTION_WUG);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
break;
@@ -7947,11 +7957,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RA_WUGRIDER:
if( sd ) {
if( !pc_isridingwug(sd) && pc_iswug(sd) ) {
- pc_setoption(sd,sd->sc.option&~OPTION_WUG);
- pc_setoption(sd,sd->sc.option|OPTION_WUGRIDER);
+ iPc->setoption(sd,sd->sc.option&~OPTION_WUG);
+ iPc->setoption(sd,sd->sc.option|OPTION_WUGRIDER);
} else if( pc_isridingwug(sd) ) {
- pc_setoption(sd,sd->sc.option&~OPTION_WUGRIDER);
- pc_setoption(sd,sd->sc.option|OPTION_WUG);
+ iPc->setoption(sd,sd->sc.option&~OPTION_WUGRIDER);
+ iPc->setoption(sd,sd->sc.option|OPTION_WUG);
}
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
@@ -7960,7 +7970,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RA_WUGDASH:
if( tsce ) {
clif->skill_nodamage(src,bl,skill_id,skill_lv,status_change_end(bl, type, INVALID_TIMER));
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
if( sd && pc_isridingwug(sd) ) {
@@ -7972,7 +7982,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case RA_SENSITIVEKEEN:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
clif->skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- map_foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR|BL_SKILL,src,skill_id,skill_lv,tick,flag|BCT_ENEMY,skill->castend_damage_id);
break;
/**
* Mechanic
@@ -7991,7 +8001,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case NC_SELFDESTRUCTION:
if( sd ) {
if( pc_ismadogear(sd) )
- pc_setmadogear(sd, 0);
+ iPc->setmadogear(sd, 0);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
skill->castend_damage_id(src, src, skill_id, skill_lv, tick, flag);
status_set_sp(src, 0, 0);
@@ -8002,15 +8012,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
clif->skill_nodamage(src, bl, skill_id, skill_lv,
sc_start(bl,type, 30 + 12 * skill_lv,skill_lv,skill->get_time(skill_id,skill_lv)));
- if( sd ) pc_overheat(sd,1);
+ if( sd ) iPc->overheat(sd,1);
break;
case NC_MAGNETICFIELD:
if( (i = sc_start2(bl,type,100,skill_lv,src->id,skill->get_time(skill_id,skill_lv))) )
{
- map_foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),splash_target(src),src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_SPLASH|1,skill->castend_damage_id);;
+ iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),splash_target(src),src,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_SPLASH|1,skill->castend_damage_id);;
clif->skill_damage(src,src,tick,status_get_amotion(src),0,-30000,1,skill_id,skill_lv,6);
- if (sd) pc_overheat(sd,1);
+ if (sd) iPc->overheat(sd,1);
}
clif->skill_nodamage(src,src,skill_id,skill_lv,i);
break;
@@ -8036,7 +8046,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case NC_DISJOINT:
{
if( bl->type != BL_MOB ) break;
- md = map_id2md(bl->id);
+ md = iMap->id2md(bl->id);
if( md && md->class_ >= MOBID_SILVERSNIPER && md->class_ <= MOBID_MAGICDECOY_WIND )
status_kill(bl);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
@@ -8080,7 +8090,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
} else {
clif->skill_nodamage(src, bl, skill_id, 0, 1);
- map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
}
break;
@@ -8118,7 +8128,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case LG_TRAMPLE:
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- map_foreachinrange(skill->destroy_trap,bl,skill->get_splash(skill_id,skill_lv),BL_SKILL,tick);
+ iMap->foreachinrange(skill->destroy_trap,bl,skill->get_splash(skill_id,skill_lv),BL_SKILL,tick);
break;
case LG_REFLECTDAMAGE:
@@ -8158,7 +8168,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,SC_SHIELDSPELL_DEF,100,opt,-1);
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
if( rate < brate )
- map_foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
status_change_end(bl,SC_SHIELDSPELL_DEF,INVALID_TIMER);
break;
case 2:
@@ -8186,14 +8196,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,SC_SHIELDSPELL_MDEF,100,opt,-1);
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
if( rate < brate )
- map_foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|2,skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|2,skill->castend_damage_id);
status_change_end(bl,SC_SHIELDSPELL_MDEF,INVALID_TIMER);
break;
case 2:
sc_start(bl,SC_SHIELDSPELL_MDEF,100,opt,-1);
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
if( rate < brate )
- map_foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_nodamage_id);
+ iMap->foreachinrange(skill->area_sub,src,skill->get_splash(skill_id,skill_lv),BL_CHAR,src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_nodamage_id);
break;
case 3:
if( sc_start(bl,SC_SHIELDSPELL_MDEF,brate,opt,sd->bonus.shieldmdef * 30000) )
@@ -8245,15 +8255,15 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl,type,100,skill_lv,skill->get_time(skill_id,skill_lv));
else {
skill_area_temp[2] = 0;
- map_foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_PC,src,skill_id,skill_lv,tick,flag|SD_PREAMBLE|BCT_PARTY|BCT_SELF|1,skill->castend_nodamage_id);
+ iMap->foreachinrange(skill->area_sub,bl,skill->get_splash(skill_id,skill_lv),BL_PC,src,skill_id,skill_lv,tick,flag|SD_PREAMBLE|BCT_PARTY|BCT_SELF|1,skill->castend_nodamage_id);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
break;
case LG_INSPIRATION:
if( sd && !map[sd->bl.m].flag.noexppenalty && sd->status.base_level != MAX_LEVEL ) {
- sd->status.base_exp -= min(sd->status.base_exp, pc_nextbaseexp(sd) * 1 / 100); // 1% penalty.
- sd->status.job_exp -= min(sd->status.job_exp, pc_nextjobexp(sd) * 1 / 100);
+ sd->status.base_exp -= min(sd->status.base_exp, iPc->nextbaseexp(sd) * 1 / 100); // 1% penalty.
+ sd->status.job_exp -= min(sd->status.job_exp, iPc->nextjobexp(sd) * 1 / 100);
clif->updatestatus(sd,SP_BASEEXP);
clif->updatestatus(sd,SP_JOBEXP);
}
@@ -8265,18 +8275,18 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( is_boss(bl) ) break;
if( sc_start2(bl, type, 100, skill_lv, src->id, skill->get_time(skill_id, skill_lv))) {
if( bl->type == BL_MOB )
- mob_unlocktarget((TBL_MOB*)bl,gettick());
+ mob_unlocktarget((TBL_MOB*)bl,iTimer->gettick());
unit_stop_attack(bl);
clif->bladestop(src, bl->id, 1);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
} else {
int count = 0;
clif->skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- count = map_forcountinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv), (sd)?sd->spiritball_old:15, // Assume 15 spiritballs in non-charactors
+ count = iMap->forcountinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv), (sd)?sd->spiritball_old:15, // Assume 15 spiritballs in non-charactors
BL_CHAR, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
- if( sd ) pc_delspiritball(sd, count, 0);
+ if( sd ) iPc->delspiritball(sd, count, 0);
clif->skill_nodamage(src, src, skill_id, skill_lv,
sc_start2(src, SC_CURSEDCIRCLE_ATKER, 100, skill_lv, count, skill->get_time(skill_id,skill_lv)));
}
@@ -8287,7 +8297,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
short max = 5 + skill_lv;
sc_start(bl, SC_EXPLOSIONSPIRITS, 100, skill_lv, skill->get_time(skill_id, skill_lv));
for( i = 0; i < max; i++ ) // Don't call more than max available spheres.
- pc_addspiritball(sd, skill->get_time(skill_id, skill_lv), max);
+ iPc->addspiritball(sd, skill->get_time(skill_id, skill_lv), max);
clif->skill_nodamage(src, bl, skill_id, skill_lv, sc_start(bl, type, 100, skill_lv,skill->get_time(skill_id, skill_lv)));
}
break;
@@ -8298,13 +8308,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( dstsd && dstsd->spiritball && (sd == dstsd || map_flag_vs(src->m)) && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER )
{
i = dstsd->spiritball; //1%sp per spiritball.
- pc_delspiritball(dstsd, dstsd->spiritball, 0);
+ iPc->delspiritball(dstsd, dstsd->spiritball, 0);
}
if( i ) status_percent_heal(src, 0, i);
clif->skill_nodamage(src, bl, skill_id, skill_lv, i ? 1:0);
} else {
clif->skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
- map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF|SD_SPLASH|1, skill->castend_nodamage_id);
+ iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF|SD_SPLASH|1, skill->castend_nodamage_id);
}
break;
@@ -8313,8 +8323,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
if( sd && dstsd->spiritball <= 5 ) {
for(i = 0; i <= 5; i++) {
- pc_addspiritball(dstsd, skill->get_time(MO_CALLSPIRITS, pc_checkskill(sd,MO_CALLSPIRITS)), i);
- pc_delspiritball(sd, sd->spiritball, 0);
+ iPc->addspiritball(dstsd, skill->get_time(MO_CALLSPIRITS, iPc->checkskill(sd,MO_CALLSPIRITS)), i);
+ iPc->delspiritball(sd, sd->spiritball, 0);
}
}
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
@@ -8368,7 +8378,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case MI_RUSH_WINDMILL:
case MI_ECHOSONG:
if( sd == NULL || sd->status.party_id == 0 || (flag & 1) )
- sc_start4(bl,type,100,skill_lv,6*skill_lv,(sd?pc_checkskill(sd,WM_LESSON):0),(sd?sd->status.job_level:0),skill->get_time(skill_id,skill_lv));
+ sc_start4(bl,type,100,skill_lv,6*skill_lv,(sd?iPc->checkskill(sd,WM_LESSON):0),(sd?sd->status.job_level:0),skill->get_time(skill_id,skill_lv));
else if( sd ) { // Only shows effects on caster.
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
party_foreachsamemap(skill->area_sub, sd, skill->get_splash(skill_id, skill_lv), src, skill_id, skill_lv, tick, flag|BCT_PARTY|1, skill->castend_nodamage_id);
@@ -8393,7 +8403,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
tstatus->hp = heal;
tstatus->sp -= tstatus->sp * ( 120 - 20 * skill_lv ) / 100;
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- pc_revive((TBL_PC*)bl,heal,0);
+ iPc->revive((TBL_PC*)bl,heal,0);
clif->resurrection(bl,1);
}
}
@@ -8407,16 +8417,16 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( flag&1 ) {
sc_start2(bl,type,(skill_id==WM_VOICEOFSIREN)?20+10*skill_lv:100,skill_lv,(skill_id==WM_VOICEOFSIREN)?src->id:0,skill->get_time(skill_id,skill_lv));
} else {
- map_foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),(skill_id==WM_VOICEOFSIREN)?BL_CHAR|BL_SKILL:BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
+ iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),(skill_id==WM_VOICEOFSIREN)?BL_CHAR|BL_SKILL:BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
break;
case WM_GLOOMYDAY:
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- if( dstsd && ( pc_checkskill(dstsd,KN_BRANDISHSPEAR) || pc_checkskill(dstsd,LK_SPIRALPIERCE) ||
- pc_checkskill(dstsd,CR_SHIELDCHARGE) || pc_checkskill(dstsd,CR_SHIELDBOOMERANG) ||
- pc_checkskill(dstsd,PA_SHIELDCHAIN) || pc_checkskill(dstsd,LG_SHIELDPRESS) ) )
+ if( dstsd && ( iPc->checkskill(dstsd,KN_BRANDISHSPEAR) || iPc->checkskill(dstsd,LK_SPIRALPIERCE) ||
+ iPc->checkskill(dstsd,CR_SHIELDCHARGE) || iPc->checkskill(dstsd,CR_SHIELDBOOMERANG) ||
+ iPc->checkskill(dstsd,PA_SHIELDCHAIN) || iPc->checkskill(dstsd,LG_SHIELDPRESS) ) )
{
sc_start(bl,SC_GLOOMYDAY_SK,100,skill_lv,skill->get_time(skill_id,skill_lv));
break;
@@ -8437,12 +8447,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
clif->skill_fail(sd,skill_id,USESKILL_FAIL_NEED_HELPER,0);
break;
}
- if( map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id,skill_lv),
+ if( iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id,skill_lv),
BL_PC, src, skill_id, skill_lv, tick, BCT_ENEMY, skill->area_sub_count) > 7 )
flag |= 2;
else
flag |= 1;
- map_foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF, skill->castend_nodamage_id);
+ iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|BCT_SELF, skill->castend_nodamage_id);
clif->skill_nodamage(src, bl, skill_id, skill_lv,
sc_start(src,SC_STOP,100,skill_lv,skill->get_time2(skill_id,skill_lv)));
if( flag&2 ) // Dealed here to prevent conflicts
@@ -8476,7 +8486,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
} else { // These affect to all targets arround the caster.
short lv = (short)skill_lv;
skill_area_temp[0] = (sd) ? skill->check_pc_partner(sd,skill_id,&lv,skill->get_splash(skill_id,skill_lv),1) : 50; // 50% chance in non BL_PC (clones).
- map_foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
+ iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
}
break;
@@ -8515,7 +8525,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (!target_id)
break;
if (skill->get_casttype(improv_skill_id) == CAST_GROUND) {
- bl = map_id2bl(target_id);
+ bl = iMap->id2bl(target_id);
if (!bl) bl = src;
unit_skilluse_pos(src, bl->x, bl->y, improv_skill_id, improv_skill_lv);
} else
@@ -8549,10 +8559,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if(!mapindex)
{ //Given map not found?
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
- pc_setpos(sd, mapindex, x, y, CLR_TELEPORT);
+ iPc->setpos(sd, mapindex, x, y, CLR_TELEPORT);
}
break;
@@ -8569,7 +8579,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case SO_ARRULLO:
{
- // [(15 + 5 * Skill Level) + ( Caster’s INT / 5 ) + ( Caster’s Job Level / 5 ) - ( Target’s INT / 6 ) - ( Target’s LUK / 10 )] %
+ // [(15 + 5 * Skill Level) + ( Caster�s INT / 5 ) + ( Caster�s Job Level / 5 ) - ( Target�s INT / 6 ) - ( Target�s LUK / 10 )] %
int rate = (15 + 5 * skill_lv) + status_get_int(src)/5 + (sd ? sd->status.job_level : 0);
rate -= status_get_int(bl)/6 - status_get_luk(bl)/10;
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
@@ -8579,13 +8589,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
case WM_LULLABY_DEEPSLEEP:
if( flag&1 ){
- //[(Skill Level x 4) + (Voice Lessons Skill Level x 2) + (Caster’s Base Level / 15) + (Caster’s Job Level / 5)] %
- int rate = (4 * skill_lv) + ( (sd) ? pc_checkskill(sd,WM_LESSON)*2 + sd->status.job_level/5 : 0 ) + status_get_lv(src) / 15;
+ //[(Skill Level x 4) + (Voice Lessons Skill Level x 2) + (Caster�s Base Level / 15) + (Caster�s Job Level / 5)] %
+ int rate = (4 * skill_lv) + ( (sd) ? iPc->checkskill(sd,WM_LESSON)*2 + sd->status.job_level/5 : 0 ) + status_get_lv(src) / 15;
if( bl != src )
sc_start(bl,type,rate,skill_lv,skill->get_time(skill_id,skill_lv));
}else {
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
- map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
src, skill_id, skill_lv, tick, flag|BCT_ALL|1, skill->castend_nodamage_id);
}
break;
@@ -8704,7 +8714,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
sc_start(bl, type, 25 + 10 * skill_lv, skill_lv, skill->get_time(skill_id, skill_lv))) )
status_zap(bl, 0, status_get_max_sp(bl) * (25 + 5 * skill_lv) / 100);
} else
- map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
+ iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), BL_CHAR,
src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
break;
@@ -8721,7 +8731,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if( itemdb_is_GNbomb(ammo_id) ) {
if(battle->check_target(src,bl,BCT_ENEMY) > 0) {// Only attack if the target is an enemy.
if( ammo_id == 13263 )
- map_foreachincell(skill->area_sub,bl->m,bl->x,bl->y,BL_CHAR,src,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ iMap->foreachincell(skill->area_sub,bl->m,bl->x,bl->y,BL_CHAR,src,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
else
skill->attack(BF_WEAPON,src,src,bl,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag);
} else //Otherwise, it fails, shows animation and removes items.
@@ -8826,7 +8836,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if(sd) {
int ttype = skill->get_ele(skill_id, skill_lv);
clif->skill_nodamage(src, bl, skill_id, skill_lv, 1);
- pc_add_talisman(sd, skill->get_time(skill_id, skill_lv), 10, ttype);
+ iPc->add_talisman(sd, skill->get_time(skill_id, skill_lv), 10, ttype);
}
break;
@@ -8840,10 +8850,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
md->master_id = src->id;
md->special_state.ai = AI_ZANZOU;
if( md->deletetimer != INVALID_TIMER )
- delete_timer(md->deletetimer, mob_timer_delete);
- md->deletetimer = add_timer (gettick() + skill->get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0);
+ iTimer->delete_timer(md->deletetimer, mob_timer_delete);
+ md->deletetimer = iTimer->add_timer (iTimer->gettick() + skill->get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0);
mob_spawn( md );
- pc_setinvincibletimer(sd,500);// unlock target lock
+ iPc->setinvincibletimer(sd,500);// unlock target lock
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
skill->blown(src,bl,skill->get_blewcount(skill_id,skill_lv),unit_getdir(bl),0);
}
@@ -8932,7 +8942,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
}else{
skill_area_temp[2] = 0;
- map_foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_nodamage_id);
+ iMap->foreachinrange(skill->area_sub, bl, skill->get_splash(skill_id, skill_lv), splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill->castend_nodamage_id);
}
break;
@@ -9017,8 +9027,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
if (md) {
md->master_id = src->id;
if (md->deletetimer != INVALID_TIMER)
- delete_timer(md->deletetimer, mob_timer_delete);
- md->deletetimer = add_timer(gettick() + skill->get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0);
+ iTimer->delete_timer(md->deletetimer, mob_timer_delete);
+ md->deletetimer = iTimer->add_timer(iTimer->gettick() + skill->get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0);
mob_spawn(md); //Now it is ready for spawning.
sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_ASSIST, 0, 60000);
}
@@ -9030,7 +9040,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
default:
ShowWarning("skill_castend_nodamage_id: Unknown skill used:%d\n",skill_id);
clif->skill_nodamage(src,bl,skill_id,skill_lv,1);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
}
@@ -9046,7 +9056,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
}
if( sd && !(flag&1) ) { // ensure that the skill last-cast tick is recorded
- sd->canskill_tick = gettick();
+ sd->canskill_tick = iTimer->gettick();
if( sd->state.arrow_atk ) { // consume arrow on last invocation to this skill.
battle->consume_ammo(sd, skill_id, skill_lv);
@@ -9056,7 +9066,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
skill->consume_requirement(sd,skill_id,skill_lv,2);
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
@@ -9072,7 +9082,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
struct status_change *sc = NULL;
int inf,inf2,flag = 0;
- src = map_id2bl(id);
+ src = iMap->id2bl(id);
if( src == NULL )
{
ShowDebug("skill_castend_id: src == NULL (tid=%d, id=%d)\n", tid, id);
@@ -9101,7 +9111,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
- if( sd && ud->skilltimer != INVALID_TIMER && (pc_checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK) )
+ if( sd && ud->skilltimer != INVALID_TIMER && (iPc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK) )
{// restore original walk speed
ud->skilltimer = INVALID_TIMER;
status_calc_bl(&sd->bl, SCB_SPEED);
@@ -9113,7 +9123,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
if (ud->skilltarget == id)
target = src;
else
- target = map_id2bl(ud->skilltarget);
+ target = iMap->id2bl(ud->skilltarget);
// Use a do so that you can break out of it when the skill fails.
do {
@@ -9133,7 +9143,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
inf2 = skill->get_splash(ud->skill_id, ud->skill_lv);
ud->skillx = target->x + inf2;
ud->skilly = target->y + inf2;
- if (inf2 && !map_random_dir(target, &ud->skillx, &ud->skilly)) {
+ if (inf2 && !iMap->random_dir(target, &ud->skillx, &ud->skilly)) {
ud->skillx = target->x;
ud->skilly = target->y;
}
@@ -9147,8 +9157,8 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
}
if(ud->skill_id == RG_BACKSTAP) {
- uint8 dir = map_calc_dir(src,target->x,target->y),t_dir = unit_getdir(target);
- if(check_distance_bl(src, target, 0) || map_check_dir(dir,t_dir)) {
+ uint8 dir = iMap->calc_dir(src,target->x,target->y),t_dir = unit_getdir(target);
+ if(check_distance_bl(src, target, 0) || iMap->check_dir(dir,t_dir)) {
break;
}
}
@@ -9289,8 +9299,8 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
case NPC_GRANDDARKNESS:
if( (sc = status_get_sc(src)) && sc->data[SC_STRIPSHIELD] )
{
- const struct TimerData *timer = get_timer(sc->data[SC_STRIPSHIELD]->timer);
- if( timer && timer->func == status_change_timer && DIFF_TICK(timer->tick,gettick()+skill->get_time(ud->skill_id, ud->skill_lv)) > 0 )
+ const struct TimerData *timer = iTimer->get_timer(sc->data[SC_STRIPSHIELD]->timer);
+ if( timer && timer->func == status_change_timer && DIFF_TICK(timer->tick,iTimer->gettick()+skill->get_time(ud->skill_id, ud->skill_lv)) > 0 )
break;
}
sc_start2(src, SC_STRIPSHIELD, 100, 0, 1, skill->get_time(ud->skill_id, ud->skill_lv));
@@ -9304,7 +9314,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
ShowInfo("Type %d, ID %d skill castend id [id =%d, lv=%d, target ID %d]\n",
src->type, src->id, ud->skill_id, ud->skill_lv, target->id);
- map_freeblock_lock();
+ iMap->freeblock_lock();
// SC_MAGICPOWER needs to switch states before any damage is actually dealt
skill->toggle_magicpower(src, ud->skill_id);
@@ -9336,7 +9346,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
else ud->skill_id = 0; //mobs can't clear this one as it is used for skill condition 'afterskill'
ud->skill_lv = ud->skilltarget = 0;
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
} while(0);
@@ -9358,7 +9368,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
if (target && target->m == src->m)
{ //Move character to target anyway.
int dir, x, y;
- dir = map_calc_dir(src,target->x,target->y);
+ dir = iMap->calc_dir(src,target->x,target->y);
if( dir > 0 && dir < 4) x = -2;
else if( dir > 4 ) x = 2;
else x = 0;
@@ -9392,7 +9402,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data)
*------------------------------------------*/
int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data)
{
- struct block_list* src = map_id2bl(id);
+ struct block_list* src = iMap->id2bl(id);
int maxcount;
struct map_session_data *sd;
struct unit_data *ud = unit_bl2ud(src);
@@ -9415,7 +9425,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data)
return 0;
}
- if( sd && ud->skilltimer != INVALID_TIMER && ( pc_checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK ) )
+ if( sd && ud->skilltimer != INVALID_TIMER && ( iPc->checkskill(sd,SA_FREECAST) > 0 || ud->skill_id == LG_EXEEDBREAK ) )
{// restore original walk speed
ud->skilltimer = INVALID_TIMER;
status_calc_bl(&sd->bl, SCB_SPEED);
@@ -9519,7 +9529,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data)
// }
unit_set_walkdelay(src, tick, battle_config.default_walk_delay+skill->get_walkdelay(ud->skill_id, ud->skill_lv), 1);
status_change_end(src,SC_CAMOUFLAGE, INVALID_TIMER);// only normal attack and auto cast skills benefit from its bonuses
- map_freeblock_lock();
+ iMap->freeblock_lock();
skill->castend_pos2(src,ud->skillx,ud->skilly,ud->skill_id,ud->skill_lv,tick,0);
if( sd && sd->skillitem != AL_WARP ) // Warp-Portal thru items will clear data in skill_castend_map. [Inkfish]
@@ -9531,7 +9541,7 @@ int skill_castend_pos(int tid, unsigned int tick, int id, intptr_t data)
ud->skill_lv = ud->skillx = ud->skilly = 0;
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 1;
} while(0);
@@ -9600,11 +9610,11 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case PR_BENEDICTIO:
skill_area_temp[1] = src->id;
i = skill->get_splash(skill_id, skill_lv);
- map_foreachinarea(skill->area_sub,
+ iMap->foreachinarea(skill->area_sub,
src->m, x-i, y-i, x+i, y+i, BL_PC,
src, skill_id, skill_lv, tick, flag|BCT_ALL|1,
skill->castend_nodamage_id);
- map_foreachinarea(skill->area_sub,
+ iMap->foreachinarea(skill->area_sub,
src->m, x-i, y-i, x+i, y+i, BL_CHAR,
src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1,
skill->castend_damage_id);
@@ -9612,7 +9622,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case BS_HAMMERFALL:
i = skill->get_splash(skill_id, skill_lv);
- map_foreachinarea (skill->area_sub,
+ iMap->foreachinarea (skill->area_sub,
src->m, x-i, y-i, x+i, y+i, BL_CHAR,
src, skill_id, skill_lv, tick, flag|BCT_ENEMY|2,
skill->castend_nodamage_id);
@@ -9620,17 +9630,17 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case HT_DETECTING:
i = skill->get_splash(skill_id, skill_lv);
- map_foreachinarea( status_change_timer_sub,
+ iMap->foreachinarea( status_change_timer_sub,
src->m, x-i, y-i, x+i,y+i,BL_CHAR,
src,NULL,SC_SIGHT,tick);
if(battle_config.traps_setting&1)
- map_foreachinarea( skill_reveal_trap,
+ iMap->foreachinarea( skill_reveal_trap,
src->m, x-i, y-i, x+i,y+i,BL_SKILL);
break;
case SR_RIDEINLIGHTNING:
i = skill->get_splash(skill_id, skill_lv);
- map_foreachinarea(skill->area_sub, src->m, x-i, y-i, x+i, y+i, BL_CHAR,
+ iMap->foreachinarea(skill->area_sub, src->m, x-i, y-i, x+i, y+i, BL_CHAR,
src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_damage_id);
break;
@@ -9641,7 +9651,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
struct skill_unit_group *sg;
if ((sg= skill->locate_element_field(src)) != NULL && ( sg->skill_id == SA_VOLCANO || sg->skill_id == SA_DELUGE || sg->skill_id == SA_VIOLENTGALE ))
{
- if (sg->limit - DIFF_TICK(gettick(), sg->tick) > 0) {
+ if (sg->limit - DIFF_TICK(iTimer->gettick(), sg->tick) > 0) {
skill->unitsetting(src,skill_id,skill_lv,x,y,0);
return 0; // not to consume items
} else
@@ -9768,7 +9778,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
if( sc->data[SC_BASILICA] )
status_change_end(src, SC_BASILICA, INVALID_TIMER); // Cancel Basilica
else { // Create Basilica. Start SC on caster. Unit timer start SC on others.
- if( map_foreachinrange(skill_count_wos, src, 2, BL_MOB|BL_PC, src) ) {
+ if( iMap->foreachinrange(skill_count_wos, src, 2, BL_MOB|BL_PC, src) ) {
if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL,0);
return 1;
@@ -9789,7 +9799,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
break;
case RG_CLEANER: // [Valaris]
i = skill->get_splash(skill_id, skill_lv);
- map_foreachinarea(skill->graffitiremover,src->m,x-i,y-i,x+i,y+i,BL_SKILL);
+ iMap->foreachinarea(skill->graffitiremover,src->m,x-i,y-i,x+i,y+i,BL_SKILL);
break;
case SO_WARMER:
@@ -9866,8 +9876,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
md->master_id = src->id;
md->special_state.ai = (skill_id == AM_SPHEREMINE) ? AI_SPHERE : AI_FLORA;
if( md->deletetimer != INVALID_TIMER )
- delete_timer(md->deletetimer, mob_timer_delete);
- md->deletetimer = add_timer (gettick() + skill->get_time(skill_id,skill_lv), mob_timer_delete, md->bl.id, 0);
+ iTimer->delete_timer(md->deletetimer, mob_timer_delete);
+ md->deletetimer = iTimer->add_timer (iTimer->gettick() + skill->get_time(skill_id,skill_lv), mob_timer_delete, md->bl.id, 0);
mob_spawn (md); //Now it is ready for spawning.
}
}
@@ -9877,7 +9887,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case CR_SLIMPITCHER:
if (sd) {
int i = skill_lv%11 - 1;
- int j = pc_search_inventory(sd,skill_db[skill_id].itemid[i]);
+ int j = iPc->search_inventory(sd,skill_db[skill_id].itemid[i]);
if( j < 0 || skill_db[skill_id].itemid[i] <= 0 || sd->inventory_data[j] == NULL || sd->status.inventory[j].amount < skill_db[skill_id].amount[i] )
{
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -9889,17 +9899,17 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
run_script(sd->inventory_data[j]->script,0,sd->bl.id,0);
potion_flag = 0;
//Apply skill bonuses
- i = pc_checkskill(sd,CR_SLIMPITCHER)*10
- + pc_checkskill(sd,AM_POTIONPITCHER)*10
- + pc_checkskill(sd,AM_LEARNINGPOTION)*5
- + pc_skillheal_bonus(sd, skill_id);
+ i = iPc->checkskill(sd,CR_SLIMPITCHER)*10
+ + iPc->checkskill(sd,AM_POTIONPITCHER)*10
+ + iPc->checkskill(sd,AM_LEARNINGPOTION)*5
+ + iPc->skillheal_bonus(sd, skill_id);
potion_hp = potion_hp * (100+i)/100;
potion_sp = potion_sp * (100+i)/100;
if(potion_hp > 0 || potion_sp > 0) {
i = skill->get_splash(skill_id, skill_lv);
- map_foreachinarea(skill->area_sub,
+ iMap->foreachinarea(skill->area_sub,
src->m,x-i,y-i,x+i,y+i,BL_CHAR,
src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1,
skill->castend_nodamage_id);
@@ -9921,7 +9931,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
if(potion_hp > 0 || potion_sp > 0) {
i = skill->get_splash(skill_id, skill_lv);
- map_foreachinarea(skill->area_sub,
+ iMap->foreachinarea(skill->area_sub,
src->m,x-i,y-i,x+i,y+i,BL_CHAR,
src,skill_id,skill_lv,tick,flag|BCT_PARTY|BCT_GUILD|1,
skill->castend_nodamage_id);
@@ -9934,7 +9944,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
int dummy = 1;
clif->skill_poseffect(src,skill_id,skill_lv,x,y,tick);
i = skill->get_splash(skill_id, skill_lv);
- map_foreachinarea(skill->cell_overlap, src->m, x-i, y-i, x+i, y+i, BL_SKILL, HW_GANBANTEIN, &dummy, src);
+ iMap->foreachinarea(skill->cell_overlap, src->m, x-i, y-i, x+i, y+i, BL_SKILL, HW_GANBANTEIN, &dummy, src);
} else {
if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 1;
@@ -9950,7 +9960,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
// Plant Cultivation [Celest]
case CR_CULTIVATION:
if (sd) {
- if( map_count_oncell(src->m,x,y,BL_CHAR) > 0 )
+ if( iMap->count_oncell(src->m,x,y,BL_CHAR) > 0 )
{
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 1;
@@ -9965,8 +9975,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
if ((i = skill->get_time(skill_id, skill_lv)) > 0)
{
if( md->deletetimer != INVALID_TIMER )
- delete_timer(md->deletetimer, mob_timer_delete);
- md->deletetimer = add_timer (tick + i, mob_timer_delete, md->bl.id, 0);
+ iTimer->delete_timer(md->deletetimer, mob_timer_delete);
+ md->deletetimer = iTimer->add_timer (tick + i, mob_timer_delete, md->bl.id, 0);
}
mob_spawn (md);
}
@@ -10018,13 +10028,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case NC_ARMSCANNON:
case RK_DRAGONBREATH:
i = skill->get_splash(skill_id,skill_lv);
- map_foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
+ iMap->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
break;
case SO_ARRULLO:
i = skill->get_splash(skill_id,skill_lv);
- map_foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
+ iMap->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill->castend_nodamage_id);
break;
/**
@@ -10046,7 +10056,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case AB_EPICLESIS:
if( (sg = skill->unitsetting(src, skill_id, skill_lv, x, y, 0)) ) {
i = sg->unit->range;
- map_foreachinarea(skill->area_sub, src->m, x - i, y - i, x + i, y + i, BL_CHAR, src, ALL_RESURRECTION, 1, tick, flag|BCT_NOENEMY|1,skill->castend_nodamage_id);
+ iMap->foreachinarea(skill->area_sub, src->m, x - i, y - i, x + i, y + i, BL_CHAR, src, ALL_RESURRECTION, 1, tick, flag|BCT_NOENEMY|1,skill->castend_nodamage_id);
}
break;
/**
@@ -10058,12 +10068,12 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
sc->comet_y = y;
}
i = skill->get_splash(skill_id,skill_lv);
- map_foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
+ iMap->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
break;
case WL_EARTHSTRAIN:
{
- int i, wave = skill_lv + 4, dir = map_calc_dir(src,x,y);
+ int i, wave = skill_lv + 4, dir = iMap->calc_dir(src,x,y);
int sx = x = src->x, sy = y = src->y; // Store first caster's location to avoid glitch on unit setting
for( i = 1; i <= wave; i++ )
@@ -10074,7 +10084,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case 2: sx = x - i; break;
case 6: sx = x + i; break;
}
- skill->addtimerskill(src,gettick() + (150 * i),0,sx,sy,skill_id,skill_lv,dir,flag&2);
+ skill->addtimerskill(src,iTimer->gettick() + (150 * i),0,sx,sy,skill_id,skill_lv,dir,flag&2);
}
}
break;
@@ -10083,7 +10093,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
**/
case RA_DETONATOR:
i = skill->get_splash(skill_id, skill_lv);
- map_foreachinarea(skill->detonator, src->m, x-i, y-i, x+i, y+i, BL_SKILL, src);
+ iMap->foreachinarea(skill->detonator, src->m, x-i, y-i, x+i, y+i, BL_SKILL, src);
clif->skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skill_id, skill_lv, 6);
break;
/**
@@ -10094,7 +10104,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
skill->clear_unitgroup(src); // To remove previous skills - cannot used combined
if( (sg = skill->unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) {
sc_start2(src,skill_id == NC_NEUTRALBARRIER ? SC_NEUTRALBARRIER_MASTER : SC_STEALTHFIELD_MASTER,100,skill_lv,sg->group_id,skill->get_time(skill_id,skill_lv));
- if( sd ) pc_overheat(sd,1);
+ if( sd ) iPc->overheat(sd,1);
}
break;
@@ -10109,8 +10119,8 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
md->master_id = src->id;
md->special_state.ai = AI_FLORA;
if( md->deletetimer != INVALID_TIMER )
- delete_timer(md->deletetimer, mob_timer_delete);
- md->deletetimer = add_timer (gettick() + skill->get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0);
+ iTimer->delete_timer(md->deletetimer, mob_timer_delete);
+ md->deletetimer = iTimer->add_timer (iTimer->gettick() + skill->get_time(skill_id, skill_lv), mob_timer_delete, md->bl.id, 0);
mob_spawn( md );
}
}
@@ -10132,10 +10142,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
int width;//according to data from irowiki it actually is a square
for( width = 0; width < 7; width++ )
for( i = 0; i < 7; i++ )
- map_foreachincell(skill->area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, LG_OVERBRAND_BRANDISH, skill_lv, tick, flag|BCT_ENEMY,skill->castend_damage_id);
+ iMap->foreachincell(skill->area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, LG_OVERBRAND_BRANDISH, skill_lv, tick, flag|BCT_ENEMY,skill->castend_damage_id);
for( width = 0; width < 7; width++ )
for( i = 0; i < 7; i++ )
- map_foreachincell(skill->area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY,skill->castend_damage_id);
+ iMap->foreachincell(skill->area_sub, src->m, x-2+i, y-2+width, splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY,skill->castend_damage_id);
}
break;
@@ -10144,7 +10154,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
status_change_end(src,SC_BANDING,INVALID_TIMER);
else if( (sg = skill->unitsetting(src,skill_id,skill_lv,src->x,src->y,0)) != NULL ) {
sc_start4(src,SC_BANDING,100,skill_lv,0,0,sg->group_id,skill->get_time(skill_id,skill_lv));
- if( sd ) pc_banding(sd,skill_lv);
+ if( sd ) iPc->banding(sd,skill_lv);
}
clif->skill_nodamage(src,src,skill_id,skill_lv,1);
break;
@@ -10152,7 +10162,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case LG_RAYOFGENESIS:
if( status_charge(src,status_get_max_hp(src)*3*skill_lv / 100,0) ) {
i = skill->get_splash(skill_id,skill_lv);
- map_foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
+ iMap->foreachinarea(skill->area_sub,src->m,x-i,y-i,x+i,y+i,splash_target(src),
src,skill_id,skill_lv,tick,flag|BCT_ENEMY|1,skill->castend_damage_id);
} else if( sd )
clif->skill_fail(sd,skill_id,USESKILL_FAIL,0);
@@ -10160,13 +10170,13 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
case WM_DOMINION_IMPULSE:
i = skill->get_splash(skill_id, skill_lv);
- map_foreachinarea( skill->activate_reverberation,
+ iMap->foreachinarea( skill->activate_reverberation,
src->m, x-i, y-i, x+i,y+i,BL_SKILL);
break;
case WM_GREAT_ECHO:
flag|=1; // Should counsume 1 item per skill usage.
- map_foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub, src, skill->get_splash(skill_id,skill_lv),splash_target(src), src, skill_id, skill_lv, tick, flag|BCT_ENEMY, skill->castend_damage_id);
break;
case GN_CRAZYWEED: {
int area = skill->get_splash(GN_CRAZYWEED_ATK, skill_lv);
@@ -10198,10 +10208,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
clif->changetraplook(&ud->skillunit[i]->unit->bl, UNT_FIRE_EXPANSION_TEAR_GAS);
break;
case 5:
- map_foreachinarea(skill->area_sub, src->m,
+ iMap->foreachinarea(skill->area_sub, src->m,
ud->skillunit[i]->unit->bl.x - 3, ud->skillunit[i]->unit->bl.y - 3,
ud->skillunit[i]->unit->bl.x + 3, ud->skillunit[i]->unit->bl.y + 3, BL_CHAR,
- src, CR_ACIDDEMONSTRATION, sd ? pc_checkskill(sd, CR_ACIDDEMONSTRATION) : skill_lv, tick, flag|BCT_ENEMY|1|SD_LEVEL, skill->castend_damage_id);
+ src, CR_ACIDDEMONSTRATION, sd ? iPc->checkskill(sd, CR_ACIDDEMONSTRATION) : skill_lv, tick, flag|BCT_ENEMY|1|SD_LEVEL, skill->castend_damage_id);
skill->delunit(ud->skillunit[i]->unit);
break;
default:
@@ -10244,7 +10254,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui
status_change_end(src,SC_CURSEDCIRCLE_ATKER,INVALID_TIMER);
if( sd ) {// ensure that the skill last-cast tick is recorded
- sd->canskill_tick = gettick();
+ sd->canskill_tick = iTimer->gettick();
if( sd->state.arrow_atk && !(flag&1) ) {
// consume arrow if this is a ground skill
@@ -10284,7 +10294,7 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
sd->sc.data[SC_ROKISWEIL] ||
sd->sc.data[SC_AUTOCOUNTER] ||
sd->sc.data[SC_STEELBODY] ||
- (sd->sc.data[SC_DANCING] && skill_id < RK_ENCHANTBLADE && !pc_checkskill(sd, WM_LESSON)) ||
+ (sd->sc.data[SC_DANCING] && skill_id < RK_ENCHANTBLADE && !iPc->checkskill(sd, WM_LESSON)) ||
sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] ||
sd->sc.data[SC_BASILICA] ||
sd->sc.data[SC_MARIONETTE] ||
@@ -10313,9 +10323,9 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
switch(skill_id) {
case AL_TELEPORT:
if(strcmp(map,"Random")==0)
- pc_randomwarp(sd,CLR_TELEPORT);
+ iPc->randomwarp(sd,CLR_TELEPORT);
else if (sd->menuskill_val > 1) //Need lv2 to be able to warp here.
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
+ iPc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
break;
case AL_WARP:
@@ -10350,7 +10360,7 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char
}
}
- lv = sd->skillitem==skill_id?sd->skillitemlv:pc_checkskill(sd,skill_id);
+ lv = sd->skillitem==skill_id?sd->skillitemlv:iPc->checkskill(sd,skill_id);
wx = sd->menuskill_val>>16;
wy = sd->menuskill_val&0xffff;
@@ -10431,7 +10441,7 @@ int skill_dance_overlap(struct skill_unit* unit, int flag) {
unit->val2 &= ~UF_ENSEMBLE;
}
- return map_foreachincell(skill->dance_overlap_sub, unit->bl.m,unit->bl.x,unit->bl.y,BL_SKILL, unit,flag);
+ return iMap->foreachincell(skill->dance_overlap_sub, unit->bl.m,unit->bl.x,unit->bl.y,BL_SKILL, unit,flag);
}
/*==========================================
@@ -10494,14 +10504,14 @@ int skill_icewall_block(struct block_list *bl,va_list ap) {
nullpo_ret(bl);
nullpo_ret(md);
- if( !md->target_id || ( target = map_id2bl(md->target_id) ) == NULL )
+ if( !md->target_id || ( target = iMap->id2bl(md->target_id) ) == NULL )
return 0;
if( path_search_long(NULL,bl->m,bl->x,bl->y,target->x,target->y,CELL_CHKICEWALL) )
return 0;
if( !check_distance_bl(bl, target, status_get_range(bl) ) ) {
- mob_unlocktarget(md,gettick());
+ mob_unlocktarget(md,iTimer->gettick());
mob_stop_walking(md,1);
}
@@ -10572,7 +10582,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
{ //Warp Portal morphing to active mode, extract relevant data from src. [Skotlex]
if( src->type != BL_SKILL ) return NULL;
group = ((TBL_SKILL*)src)->group;
- src = map_id2bl(group->src_id);
+ src = iMap->id2bl(group->src_id);
if( !src ) return NULL;
val2 = group->val2; //Copy the (x,y) position you warp to
val3 = group->val3; //as well as the mapindex to warp to.
@@ -10588,7 +10598,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
break;
case WZ_FIREPILLAR:
- if( map_getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) )
+ if( iMap->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) )
return NULL;
if((flag&1)!=0)
limit=1000;
@@ -10653,7 +10663,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
old_sg->skill_id == SA_VIOLENTGALE
) && old_sg->limit > 0)
{ //Use the previous limit (minus the elapsed time) [Skotlex]
- limit = old_sg->limit - DIFF_TICK(gettick(), old_sg->tick);
+ limit = old_sg->limit - DIFF_TICK(iTimer->gettick(), old_sg->tick);
if (limit < 0) //This can happen...
limit = skill->get_time(skill_id,skill_lv);
}
@@ -10670,8 +10680,8 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
val1 = skill_lv +status->agi/10; // Flee increase
val2 = ((skill_lv+1)/2)+status->luk/10; // Perfect dodge increase
if(sd){
- val1 += pc_checkskill(sd,BA_MUSICALLESSON);
- val2 += pc_checkskill(sd,BA_MUSICALLESSON);
+ val1 += iPc->checkskill(sd,BA_MUSICALLESSON);
+ val2 += iPc->checkskill(sd,BA_MUSICALLESSON);
}
break;
case DC_HUMMING:
@@ -10680,47 +10690,47 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
val1 *= 2;
#endif
if(sd)
- val1 += pc_checkskill(sd,DC_DANCINGLESSON);
+ val1 += iPc->checkskill(sd,DC_DANCINGLESSON);
break;
case BA_POEMBRAGI:
val1 = 3*skill_lv+status->dex/10; // Casting time reduction
//For some reason at level 10 the base delay reduction is 50%.
val2 = (skill_lv<10?3*skill_lv:50)+status->int_/5; // After-cast delay reduction
if(sd){
- val1 += 2*pc_checkskill(sd,BA_MUSICALLESSON);
- val2 += 2*pc_checkskill(sd,BA_MUSICALLESSON);
+ val1 += 2*iPc->checkskill(sd,BA_MUSICALLESSON);
+ val2 += 2*iPc->checkskill(sd,BA_MUSICALLESSON);
}
break;
case DC_DONTFORGETME:
val1 = status->dex/10 + 3*skill_lv + 5; // ASPD decrease
val2 = status->agi/10 + 3*skill_lv + 5; // Movement speed adjustment.
if(sd){
- val1 += pc_checkskill(sd,DC_DANCINGLESSON);
- val2 += pc_checkskill(sd,DC_DANCINGLESSON);
+ val1 += iPc->checkskill(sd,DC_DANCINGLESSON);
+ val2 += iPc->checkskill(sd,DC_DANCINGLESSON);
}
break;
case BA_APPLEIDUN:
val1 = 5+2*skill_lv+status->vit/10; // MaxHP percent increase
if(sd)
- val1 += pc_checkskill(sd,BA_MUSICALLESSON);
+ val1 += iPc->checkskill(sd,BA_MUSICALLESSON);
break;
case DC_SERVICEFORYOU:
val1 = 15+skill_lv+(status->int_/10); // MaxSP percent increase TO-DO: this INT bonus value is guessed
val2 = 20+3*skill_lv+(status->int_/10); // SP cost reduction
if(sd){
- val1 += pc_checkskill(sd,DC_DANCINGLESSON); //TO-DO This bonus value is guessed
- val2 += pc_checkskill(sd,DC_DANCINGLESSON); //TO-DO Should be half this value
+ val1 += iPc->checkskill(sd,DC_DANCINGLESSON); //TO-DO This bonus value is guessed
+ val2 += iPc->checkskill(sd,DC_DANCINGLESSON); //TO-DO Should be half this value
}
break;
case BA_ASSASSINCROSS:
val1 = 100+(10*skill_lv)+(status->agi/10); // ASPD increase
if(sd)
- val1 += 5*pc_checkskill(sd,BA_MUSICALLESSON);
+ val1 += 5*iPc->checkskill(sd,BA_MUSICALLESSON);
break;
case DC_FORTUNEKISS:
val1 = 10+skill_lv+(status->luk/10); // Critical increase
if(sd)
- val1 += pc_checkskill(sd,DC_DANCINGLESSON);
+ val1 += iPc->checkskill(sd,DC_DANCINGLESSON);
val1*=10; //Because every 10 crit is an actual cri point.
break;
case BD_DRUMBATTLEFIELD:
@@ -10809,7 +10819,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
interval = limit;
val2 = 1;
case WM_POEMOFNETHERWORLD: // Can't be placed on top of Land Protector.
- if( map_getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) )
+ if( iMap->getcell(src->m, x, y, CELL_CHKLANDPROTECTOR) )
return NULL;
break;
case SO_CLOUD_KILL:
@@ -10838,7 +10848,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
val2 = i; // aura type
limit += val1 * 1000;
subunt = i - 1;
- pc_del_talisman(sd, sd->talisman[i], i);
+ iPc->del_talisman(sd, sd->talisman[i], i);
}
}
break;
@@ -10855,7 +10865,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
group->state.guildaura = ( skill_id >= GD_LEADERSHIP && skill_id <= GD_HAWKEYES )?1:0;
group->item_id = req_item;
//if tick is greater than current, do not invoke onplace function just yet. [Skotlex]
- if (DIFF_TICK(group->tick, gettick()) > SKILLUNITTIMER_INTERVAL)
+ if (DIFF_TICK(group->tick, iTimer->gettick()) > SKILLUNITTIMER_INTERVAL)
active_flag = 0;
if(skill_id==HT_TALKIEBOX || skill_id==RG_GRAFFITI){
@@ -10888,7 +10898,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
int val2 = 0;
int alive = 1;
- if( !group->state.song_dance && !map_getcell(src->m,ux,uy,CELL_CHKREACH) )
+ if( !group->state.song_dance && !iMap->getcell(src->m,ux,uy,CELL_CHKREACH) )
continue; // don't place skill units on walls (except for songs/dances/encores)
if( battle_config.skill_wall_check && skill->get_unit_flag(skill_id)&UF_PATHCHECK && !path_search_long(NULL,src->m,ux,uy,x,y,CELL_CHKWALL) )
continue; // no path between cell and center of casting.
@@ -10900,7 +10910,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
break;
case WZ_ICEWALL:
val1 = (skill_lv <= 1) ? 500 : 200 + 200*skill_lv;
- val2 = map_getcell(src->m, ux, uy, CELL_GETTYPE);
+ val2 = iMap->getcell(src->m, ux, uy, CELL_GETTYPE);
break;
case HT_LANDMINE:
case MA_LANDMINE:
@@ -10953,7 +10963,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
val2 |= UF_RANGEDSINGLEUNIT; // center.
if( range <= 0 )
- map_foreachincell(skill->cell_overlap,src->m,ux,uy,BL_SKILL,skill_id, &alive, src);
+ iMap->foreachincell(skill->cell_overlap,src->m,ux,uy,BL_SKILL,skill_id, &alive, src);
if( !alive )
continue;
@@ -10969,7 +10979,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
// execute on all targets standing on this cell
if (range==0 && active_flag)
- map_foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),1);
+ iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,iTimer->gettick(),1);
}
if (!group->alive_count) { //No cells? Something that was blocked completely by Land Protector?
@@ -10980,7 +10990,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
//success, unit created.
switch( skill_id ) {
case WZ_ICEWALL:
- map_foreachinrange(skill->icewall_block, src, AREA_SIZE, BL_MOB);
+ iMap->foreachinrange(skill->icewall_block, src, AREA_SIZE, BL_MOB);
break;
case NJ_TATAMIGAESHI: //Store number of tiles.
group->val1 = group->alive_count;
@@ -11008,9 +11018,9 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
return 0;
nullpo_ret(sg=src->group);
- nullpo_ret(ss=map_id2bl(sg->src_id));
+ nullpo_ret(ss=iMap->id2bl(sg->src_id));
- if( skill->get_type(sg->skill_id) == BF_MAGIC && map_getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) && sg->skill_id != SA_LANDPROTECTOR )
+ if( skill->get_type(sg->skill_id) == BF_MAGIC && iMap->getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) && sg->skill_id != SA_LANDPROTECTOR )
return 0; //AoE skills are ineffective. [Skotlex]
sc = status_get_sc(bl);
@@ -11030,10 +11040,10 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
} else if( sc && battle->check_target(&sg->unit->bl,bl,sg->target_flag) > 0 ) {
int sec = skill->get_time2(sg->skill_id,sg->skill_lv);
if( status_change_start(bl,type,10000,sg->skill_lv,1,sg->group_id,0,sec,8) ) {
- const struct TimerData* td = sc->data[type]?get_timer(sc->data[type]->timer):NULL;
+ const struct TimerData* td = sc->data[type]?iTimer->get_timer(sc->data[type]->timer):NULL;
if( td )
sec = DIFF_TICK(td->tick, tick);
- map_moveblock(bl, src->bl.x, src->bl.y, tick);
+ iMap->moveblock(bl, src->bl.x, src->bl.y, tick);
clif->fixpos(bl);
sg->val2 = bl->id;
}
@@ -11058,11 +11068,11 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
break; //Does not affect the caster.
if (!sce) {
TBL_PC *sd = BL_CAST(BL_PC, bl); //prevent fullheal exploit
- if (sd && sd->bloodylust_tick && DIFF_TICK(gettick(), sd->bloodylust_tick) < skill->get_time2(SC_BLOODYLUST, 1))
+ if (sd && sd->bloodylust_tick && DIFF_TICK(iTimer->gettick(), sd->bloodylust_tick) < skill->get_time2(SC_BLOODYLUST, 1))
clif->skill_nodamage(&src->bl,bl,sg->skill_id,sg->skill_lv,
sc_start4(bl, type, 100, sg->skill_lv, 1, 0, 0, skill->get_time(LK_BERSERK, sg->skill_lv)));
else {
- if (sd) sd->bloodylust_tick = gettick();
+ if (sd) sd->bloodylust_tick = iTimer->gettick();
clif->skill_nodamage(&src->bl,bl,sg->skill_id,sg->skill_lv,
sc_start4(bl, type, 100, sg->skill_lv, 0, 0, 0, skill->get_time(LK_BERSERK, sg->skill_lv)));
}
@@ -11085,15 +11095,15 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
if( --count <= 0 )
skill->del_unitgroup(sg,ALC_MARK);
- if ( map_mapindex2mapid(sg->val3) == sd->bl.m && x == sd->bl.x && y == sd->bl.y )
+ if ( iMap->mapindex2mapid(sg->val3) == sd->bl.m && x == sd->bl.x && y == sd->bl.y )
working = 1;/* we break it because officials break it, lovely stuff. */
sg->val1 = (count<<16)|working;
- pc_setpos(sd,m,x,y,CLR_TELEPORT);
+ iPc->setpos(sd,m,x,y,CLR_TELEPORT);
}
} else if(bl->type == BL_MOB && battle_config.mob_warp&2) {
- int16 m = map_mapindex2mapid(sg->val3);
+ int16 m = iMap->mapindex2mapid(sg->val3);
if (m < 0) break; //Map not available on this map-server.
unit_warp(bl,m,sg->val2>>16,sg->val2&0xffff,CLR_TELEPORT);
}
@@ -11152,8 +11162,8 @@ int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, unsigned
else if (sce->val4 == 1) {
//Readjust timers since the effect will not last long.
sce->val4 = 0;
- delete_timer(sce->timer, status_change_timer);
- sce->timer = add_timer(tick+sg->limit, status_change_timer, bl->id, type);
+ iTimer->delete_timer(sce->timer, status_change_timer);
+ sce->timer = iTimer->add_timer(tick+sg->limit, status_change_timer, bl->id, type);
}
break;
@@ -11231,7 +11241,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
return 0;
nullpo_ret(sg=src->group);
- nullpo_ret(ss=map_id2bl(sg->src_id));
+ nullpo_ret(ss=iMap->id2bl(sg->src_id));
tsd = BL_CAST(BL_PC, bl);
tsc = status_get_sc(bl);
@@ -11263,7 +11273,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
ts->tick = tick+sg->interval;
if ((skill_id==CR_GRANDCROSS || skill_id==NPC_GRANDDARKNESS) && !battle_config.gx_allhit)
- ts->tick += sg->interval*(map_count_oncell(bl->m,bl->x,bl->y,BL_CHAR)-1);
+ ts->tick += sg->interval*(iMap->count_oncell(bl->m,bl->x,bl->y,BL_CHAR)-1);
}
switch (sg->unit_id) {
@@ -11413,7 +11423,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
if( sg->val2 == 0 && tsc && (sg->unit_id == UNT_ANKLESNARE || bl->id != sg->src_id) ) {
int sec = skill->get_time2(sg->skill_id,sg->skill_lv);
if( status_change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,sec, 8) ) {
- const struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL;
+ const struct TimerData* td = tsc->data[type]?iTimer->get_timer(tsc->data[type]->timer):NULL;
if( td )
sec = DIFF_TICK(td->tick, tick);
if( sg->unit_id == UNT_MANHOLE || battle_config.skill_trap_type || !map_flag_gvg(src->bl.m) ) {
@@ -11444,12 +11454,12 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
break;
if( status_change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill->get_time2(sg->skill_id, sg->skill_lv), 8) ) {
- map_moveblock(bl, src->bl.x, src->bl.y, tick);
+ iMap->moveblock(bl, src->bl.x, src->bl.y, tick);
clif->fixpos(bl);
}
- map_foreachinrange(skill->trap_splash, &src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl, tick);
+ iMap->foreachinrange(skill->trap_splash, &src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl, tick);
sg->unit_id = UNT_USED_TRAPS; //Changed ID so it does not invoke a for each in area again.
}
break;
@@ -11479,7 +11489,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
case UNT_FLASHER:
case UNT_FREEZINGTRAP:
case UNT_FIREPILLAR_ACTIVE:
- map_foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
+ iMap->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
if (sg->unit_id != UNT_FIREPILLAR_ACTIVE)
clif->changetraplook(&src->bl, sg->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS);
sg->limit=DIFF_TICK(tick,sg->tick)+1500 +
@@ -11665,7 +11675,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
case UNT_GROUNDDRIFT_POISON:
case UNT_GROUNDDRIFT_WATER:
case UNT_GROUNDDRIFT_FIRE:
- map_foreachinrange(skill->trap_splash,&src->bl,
+ iMap->foreachinrange(skill->trap_splash,&src->bl,
skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag,
&src->bl,tick);
sg->unit_id = UNT_USED_TRAPS;
@@ -11715,14 +11725,14 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
case UNT_DIMENSIONDOOR:
if( tsd && !map[bl->m].flag.noteleport )
- pc_randomwarp(tsd,3);
+ iPc->randomwarp(tsd,3);
else if( bl->type == BL_MOB && battle_config.mob_warp&8 )
unit_warp(bl,-1,-1,-1,3);
break;
case UNT_REVERBERATION:
clif->changetraplook(&src->bl,UNT_USED_TRAPS);
- map_foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
+ iMap->foreachinrange(skill->trap_splash,&src->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl,tick);
sg->limit = DIFF_TICK(tick,sg->tick)+1000;
sg->unit_id = UNT_USED_TRAPS;
break;
@@ -11745,10 +11755,10 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
if( !sg->val2 ) {
int sec = skill->get_time2(sg->skill_id, sg->skill_lv);
if( sc_start(bl, type, 100, sg->skill_lv, sec) ) {
- const struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL;
+ const struct TimerData* td = tsc->data[type]?iTimer->get_timer(tsc->data[type]->timer):NULL;
if( td )
sec = DIFF_TICK(td->tick, tick);
- ///map_moveblock(bl, src->bl.x, src->bl.y, tick); // in official server it doesn't behave like this. [malufett]
+ ///iMap->moveblock(bl, src->bl.x, src->bl.y, tick); // in official server it doesn't behave like this. [malufett]
clif->fixpos(bl);
sg->val2 = bl->id;
} else
@@ -11772,7 +11782,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
break;
case 3:
skill->attack(skill->get_type(CR_ACIDDEMONSTRATION), ss, &src->bl, bl,
- CR_ACIDDEMONSTRATION, sd ? pc_checkskill(sd, CR_ACIDDEMONSTRATION) : sg->skill_lv, tick, 0);
+ CR_ACIDDEMONSTRATION, sd ? iPc->checkskill(sd, CR_ACIDDEMONSTRATION) : sg->skill_lv, tick, 0);
break;
}
@@ -11963,7 +11973,7 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in
break;
case UNT_SPIDERWEB: {
- struct block_list *target = map_id2bl(sg->val2);
+ struct block_list *target = iMap->id2bl(sg->val2);
if (target && target==bl)
{
if (sce && sce->val3 == sg->group_id)
@@ -12053,11 +12063,11 @@ static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned i
case DC_FORTUNEKISS:
case DC_SERVICEFORYOU:
if (sce) {
- delete_timer(sce->timer, status_change_timer);
+ iTimer->delete_timer(sce->timer, status_change_timer);
//NOTE: It'd be nice if we could get the skill_lv for a more accurate extra time, but alas...
//not possible on our current implementation.
sce->val4 = 1; //Store the fact that this is a "reduced" duration effect.
- sce->timer = add_timer(tick+skill->get_time2(skill_id,1), status_change_timer, bl->id, type);
+ sce->timer = iTimer->add_timer(tick+skill->get_time2(skill_id,1), status_change_timer, bl->id, type);
}
break;
case PF_FOGWALL:
@@ -12067,8 +12077,8 @@ static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned i
if (bl->type == BL_PC) //Players get blind ended inmediately, others have it still for 30 secs. [Skotlex]
status_change_end(bl, SC_BLIND, INVALID_TIMER);
else {
- delete_timer(sce->timer, status_change_timer);
- sce->timer = add_timer(30000+tick, status_change_timer, bl->id, SC_BLIND);
+ iTimer->delete_timer(sce->timer, status_change_timer);
+ sce->timer = iTimer->add_timer(30000+tick, status_change_timer, bl->id, SC_BLIND);
}
}
}
@@ -12199,7 +12209,7 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) {
switch(skill_id) {
case PR_BENEDICTIO: {
- uint8 dir = map_calc_dir(&sd->bl,tsd->bl.x,tsd->bl.y);
+ uint8 dir = iMap->calc_dir(&sd->bl,tsd->bl.x,tsd->bl.y);
dir = (unit_getdir(&sd->bl) + dir)%8; //This adjusts dir to account for the direction the sd is facing.
if ((tsd->class_&MAPID_BASEMASK) == MAPID_ACOLYTE && (dir == 2 || dir == 6) //Must be standing to the left/right of Priest.
&& sd->status.sp >= 10)
@@ -12228,7 +12238,7 @@ int skill_check_condition_char_sub (struct block_list *bl, va_list ap) {
return 0;
if (sd->status.sex != tsd->status.sex &&
(tsd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER &&
- (skill_lv = pc_checkskill(tsd, skill_id)) > 0 &&
+ (skill_lv = iPc->checkskill(tsd, skill_id)) > 0 &&
(tsd->weapontype1==W_MUSICAL || tsd->weapontype1==W_WHIP) &&
sd->status.party_id && tsd->status.party_id &&
sd->status.party_id == tsd->status.party_id &&
@@ -12264,26 +12274,26 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, short*
switch (skill_id) {
case PR_BENEDICTIO:
for (i = 0; i < c; i++) {
- if ((tsd = map_id2sd(p_sd[i])) != NULL)
+ if ((tsd = iMap->id2sd(p_sd[i])) != NULL)
status_charge(&tsd->bl, 0, 10);
}
return c;
case AB_ADORAMUS:
- if( c > 0 && (tsd = map_id2sd(p_sd[0])) != NULL ) {
+ if( c > 0 && (tsd = iMap->id2sd(p_sd[0])) != NULL ) {
i = 2 * (*skill_lv);
status_charge(&tsd->bl, 0, i);
}
break;
case WM_GREAT_ECHO:
for( i = 0; i < c; i++ ) {
- if( (tsd = map_id2sd(p_sd[i])) != NULL )
+ if( (tsd = iMap->id2sd(p_sd[i])) != NULL )
status_zap(&tsd->bl,0,skill->get_sp(skill_id,*skill_lv)/c);
}
break;
default: //Warning: Assuming Ensemble skills here (for speed)
if( is_chorus )
break;//Chorus skills are not to be parsed as ensambles
- if (c > 0 && sd->sc.data[SC_DANCING] && (tsd = map_id2sd(p_sd[0])) != NULL) {
+ if (c > 0 && sd->sc.data[SC_DANCING] && (tsd = iMap->id2sd(p_sd[0])) != NULL) {
sd->sc.data[SC_DANCING]->val4 = tsd->bl.id;
sc_start4(&tsd->bl,SC_DANCING,100,skill_id,sd->sc.data[SC_DANCING]->val2,*skill_lv,sd->bl.id,skill->get_time(skill_id,*skill_lv)+1000);
clif->skill_nodamage(&tsd->bl, &sd->bl, skill_id, *skill_lv, 1);
@@ -12300,7 +12310,7 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, short*
if( is_chorus )
i = party_foreachsamemap(skill->check_condition_char_sub,sd,AREA_SIZE,&sd->bl, &c, &p_sd, skill_id, *skill_lv);
else
- i = map_foreachinrange(skill->check_condition_char_sub, &sd->bl, range, BL_PC, &sd->bl, &c, &p_sd, skill_id);
+ i = iMap->foreachinrange(skill->check_condition_char_sub, &sd->bl, range, BL_PC, &sd->bl, &c, &p_sd, skill_id);
if ( skill_id != PR_BENEDICTIO && skill_id != AB_ADORAMUS && skill_id != WL_COMET ) //Apply the average lv to encore skills.
*skill_lv = (i+(*skill_lv))/(c+1); //I know c should be one, but this shows how it could be used for the average of n partners.
@@ -12407,7 +12417,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
if( skill_id == WZ_EARTHSPIKE && sc && sc->data[SC_EARTHSCROLL] && rnd()%100 > sc->data[SC_EARTHSCROLL]->val2 ) // [marquis007]
; //Do not consume item.
else if( sd->status.inventory[i].expire_time == 0 )
- pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME); // Rental usable items are not consumed until expiration
+ iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME); // Rental usable items are not consumed until expiration
}
return 1;
}
@@ -12585,7 +12595,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
status_change_end(&sd->bl, SC_COMBO, INVALID_TIMER);
return 0;
}
- if(sc->data[SC_COMBO]->val1 != skill_id && !( sd && sd->status.base_level >= 90 && pc_famerank(sd->status.char_id, MAPID_TAEKWON) )) { //Cancel combo wait.
+ if(sc->data[SC_COMBO]->val1 != skill_id && !( sd && sd->status.base_level >= 90 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON) )) { //Cancel combo wait.
unit_cancel_combo(&sd->bl);
return 0;
}
@@ -12642,7 +12652,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
for (i=0;i<size*size;i++) {
x = sd->bl.x+(i%size-range);
y = sd->bl.y+(i/size-range);
- if (map_getcell(sd->bl.m,x,y,CELL_CHKWALL)) {
+ if (iMap->getcell(sd->bl.m,x,y,CELL_CHKWALL)) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -12652,8 +12662,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
case PR_REDEMPTIO:
{
int exp;
- if( ((exp = pc_nextbaseexp(sd)) > 0 && get_percentage(sd->status.base_exp, exp) < 1) ||
- ((exp = pc_nextjobexp(sd)) > 0 && get_percentage(sd->status.job_exp, exp) < 1)) {
+ if( ((exp = iPc->nextbaseexp(sd)) > 0 && get_percentage(sd->status.base_exp, exp) < 1) ||
+ ((exp = iPc->nextjobexp(sd)) > 0 && get_percentage(sd->status.job_exp, exp) < 1)) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); //Not enough exp.
return 0;
}
@@ -12661,7 +12671,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
}
case AM_TWILIGHT2:
case AM_TWILIGHT3:
- if (!party_skill_check(sd, sd->status.party_id, skill_id, skill_lv))
+ if (!iParty->skill_check(sd, sd->status.party_id, skill_id, skill_lv))
{
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -12794,7 +12804,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
* Warlock
**/
case WL_COMET:
- if( skill->check_pc_partner(sd,skill_id,&skill_lv,1,0) <= 0 && ((i = pc_search_inventory(sd,require.itemid[0])) < 0 || sd->status.inventory[i].amount < require.amount[0]) )
+ if( skill->check_pc_partner(sd,skill_id,&skill_lv,1,0) <= 0 && ((i = iPc->search_inventory(sd,require.itemid[0])) < 0 || sd->status.inventory[i].amount < require.amount[0]) )
{
//clif->skill_fail(sd,skill_id,USESKILL_FAIL_NEED_ITEM,require.amount[0],require.itemid[0]);
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -12908,7 +12918,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
break;
case SR_CURSEDCIRCLE:
if (map_flag_gvg(sd->bl.m)) {
- if (map_foreachinrange(mob_count_sub, &sd->bl, skill->get_splash(skill_id, skill_lv), BL_MOB,
+ if (iMap->foreachinrange(mob_count_sub, &sd->bl, skill->get_splash(skill_id, skill_lv), BL_MOB,
MOBID_EMPERIUM, MOBID_GUARIDAN_STONE1, MOBID_GUARIDAN_STONE2)) {
char output[128];
sprintf(output, "You're too close to a stone or emperium to do this skill");
@@ -13062,7 +13072,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
break;
case ST_MOVE_ENABLE:
if (sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == skill_id)
- sd->ud.canmove_tick = gettick(); //When using a combo, cancel the can't move delay to enable the skill. [Skotlex]
+ sd->ud.canmove_tick = iTimer->gettick(); //When using a combo, cancel the can't move delay to enable the skill. [Skotlex]
if (!unit_can_move(&sd->bl)) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
@@ -13072,7 +13082,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
case ST_WATER:
if (sc && (sc->data[SC_DELUGE] || sc->data[SC_SUITON]))
break;
- if (map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKWATER))
+ if (iMap->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKWATER))
break;
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -13252,7 +13262,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
int maxcount = (skill_id==AM_CANNIBALIZE)? 6-skill_lv : skill->get_maxcount(skill_id,skill_lv);
int mob_class = (skill_id==AM_CANNIBALIZE)? summons[skill_lv-1] :1142;
if(battle_config.land_skill_limit && maxcount>0 && (battle_config.land_skill_limit&BL_PC)) {
- i = map_foreachinmap(skill->check_condition_mob_master_sub ,sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c);
+ i = iMap->foreachinmap(skill->check_condition_mob_master_sub ,sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c);
if(c >= maxcount ||
(skill_id==AM_CANNIBALIZE && c != i && battle_config.summon_flora&2))
{ //Fails when: exceed max limit. There are other plant types already out.
@@ -13273,9 +13283,9 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
if( battle_config.land_skill_limit && maxcount > 0 && ( battle_config.land_skill_limit&BL_PC ) ) {
if( skill_id == NC_MAGICDECOY ) {
for( j = mob_class; j <= 2046; j++ )
- map_foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, j, skill_id, &c);
+ iMap->foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, j, skill_id, &c);
} else
- map_foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c);
+ iMap->foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill_id, &c);
if( c >= maxcount ) {
clif->skill_fail(sd , skill_id, USESKILL_FAIL_LEVEL, 0);
return 0;
@@ -13285,7 +13295,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
break;
case KO_ZANZOU: {
int c = 0;
- i = map_foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, 2308, skill_id, &c);
+ i = iMap->foreachinmap(skill->check_condition_mob_master_sub, sd->bl.m, BL_MOB, sd->bl.id, 2308, skill_id, &c);
if( c >= skill->get_maxcount(skill_id,skill_lv) || c != i) {
clif->skill_fail(sd , skill_id, USESKILL_FAIL_LEVEL, 0);
return 0;
@@ -13332,7 +13342,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
for( i = 0; i < MAX_SKILL_ITEM_REQUIRE; ++i ) {
if( !require.itemid[i] )
continue;
- index[i] = pc_search_inventory(sd,require.itemid[i]);
+ index[i] = iPc->search_inventory(sd,require.itemid[i]);
if( index[i] < 0 || sd->status.inventory[index[i]].amount < require.amount[i] ) {
if( require.itemid[i] == ITEMID_RED_GEMSTONE )
clif->skill_fail(sd,skill_id,USESKILL_FAIL_REDJAMSTONE,0);// red gemstone required
@@ -13365,7 +13375,7 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin
status_zap(&sd->bl, req.hp, req.sp);
if(req.spiritball > 0)
- pc_delspiritball(sd,req.spiritball,0);
+ iPc->delspiritball(sd,req.spiritball,0);
if(req.zeny > 0)
{
@@ -13373,7 +13383,7 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin
req.zeny = 0; //Zeny is reduced on skill->attack.
if( sd->status.zeny < req.zeny )
req.zeny = sd->status.zeny;
- pc_payzeny(sd,req.zeny,LOG_TYPE_CONSUME,NULL);
+ iPc->payzeny(sd,req.zeny,LOG_TYPE_CONSUME,NULL);
}
}
@@ -13415,8 +13425,8 @@ int skill_consume_requirement( struct map_session_data *sd, uint16 skill_id, uin
break;
}
- if( (n = pc_search_inventory(sd,req.itemid[i])) >= 0 )
- pc_delitem(sd,n,req.amount[i],0,1,LOG_TYPE_CONSUME);
+ if( (n = iPc->search_inventory(sd,req.itemid[i])) >= 0 )
+ iPc->delitem(sd,n,req.amount[i],0,1,LOG_TYPE_CONSUME);
}
}
@@ -13583,9 +13593,9 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
req.amount[i] = 1; // Hocus Pocus allways use at least 1 gem
}
}
- if( skill_id >= HT_SKIDTRAP && skill_id <= HT_TALKIEBOX && pc_checkskill(sd, RA_RESEARCHTRAP) > 0){
+ if( skill_id >= HT_SKIDTRAP && skill_id <= HT_TALKIEBOX && iPc->checkskill(sd, RA_RESEARCHTRAP) > 0){
int16 itIndex;
- if( (itIndex = pc_search_inventory(sd,req.itemid[i])) < 0 || ( itIndex >= 0 && sd->status.inventory[itIndex].amount < req.amount[i] ) ){
+ if( (itIndex = iPc->search_inventory(sd,req.itemid[i])) < 0 || ( itIndex >= 0 && sd->status.inventory[itIndex].amount < req.amount[i] ) ){
req.itemid[i] = ITEMID_TRAP_ALLOY;
req.amount[i] = 1;
}
@@ -13613,7 +13623,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
// Check for cost reductions due to skills & SCs
switch(skill_id) {
case MC_MAMMONITE:
- if(pc_checkskill(sd,BS_UNFAIRLYTRICK)>0)
+ if(iPc->checkskill(sd,BS_UNFAIRLYTRICK)>0)
req.zeny -= req.zeny*10/100;
break;
case AL_HOLYLIGHT:
@@ -13624,7 +13634,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
case SL_STUN:
case SL_STIN:
{
- int kaina_lv = pc_checkskill(sd,SL_KAINA);
+ int kaina_lv = iPc->checkskill(sd,SL_KAINA);
if(kaina_lv==0 || sd->status.base_level<70)
break;
@@ -13682,7 +13692,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
case SO_SUMMON_AQUA:
case SO_SUMMON_VENTUS:
case SO_SUMMON_TERA:
- req.sp -= req.sp * (5 + 5 * pc_checkskill(sd,SO_EL_SYMPATHY)) / 100;
+ req.sp -= req.sp * (5 + 5 * iPc->checkskill(sd,SO_EL_SYMPATHY)) / 100;
break;
case SO_PSYCHIC_WAVE:
if( sc && sc->data[SC_BLAST_OPTION] )
@@ -13856,7 +13866,7 @@ int skill_vfcastfix (struct block_list *bl, double time, uint16 skill_id, uint16
fixcast_r = max(fixcast_r, sc->data[SC__LAZINESS]->val2);
if( sc->data[SC_SECRAMENT] )
fixcast_r = max(fixcast_r, sc->data[SC_SECRAMENT]->val2);
- if( sd && ( skill_lv = pc_checkskill(sd, WL_RADIUS) ) && skill_id >= WL_WHITEIMPRISON && skill_id <= WL_FREEZE_SP )
+ if( sd && ( skill_lv = iPc->checkskill(sd, WL_RADIUS) ) && skill_id >= WL_WHITEIMPRISON && skill_id <= WL_FREEZE_SP )
fixcast_r = max(fixcast_r, 5 + skill_lv * 5);
// Fixed cast non percentage bonuses
if( sc->data[SC_MANDRAGORA] )
@@ -14101,7 +14111,7 @@ void skill_brandishspear_dir (struct square* tc, uint8 dir, int are) {
void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 skill_id, uint16 skill_lv, unsigned int tick, int flag)
{
int c,n=4;
- uint8 dir = map_calc_dir(src,bl->x,bl->y);
+ uint8 dir = iMap->calc_dir(src,bl->x,bl->y);
struct square tc;
int x=bl->x,y=bl->y;
skill->brandishspear_first(&tc,dir,x,y);
@@ -14110,7 +14120,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s
if(skill_lv > 9){
for(c=1;c<4;c++){
- map_foreachincell(skill->area_sub,
+ iMap->foreachincell(skill->area_sub,
bl->m,tc.val1[c],tc.val2[c],BL_CHAR,
src,skill_id,skill_lv,tick, flag|BCT_ENEMY|n,
skill->castend_damage_id);
@@ -14126,7 +14136,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s
if(skill_lv > 3){
for(c=0;c<5;c++){
- map_foreachincell(skill->area_sub,
+ iMap->foreachincell(skill->area_sub,
bl->m,tc.val1[c],tc.val2[c],BL_CHAR,
src,skill_id,skill_lv,tick, flag|BCT_ENEMY|n,
skill->castend_damage_id);
@@ -14138,7 +14148,7 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, uint16 s
}
for(c=0;c<10;c++){
if(c==0||c==5) skill->brandishspear_dir(&tc,dir,-1);
- map_foreachincell(skill->area_sub,
+ iMap->foreachincell(skill->area_sub,
bl->m,tc.val1[c%5],tc.val2[c%5],BL_CHAR,
src,skill_id,skill_lv,tick, flag|BCT_ENEMY|1,
skill->castend_damage_id);
@@ -14156,7 +14166,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) {
nullpo_retv(sd);
- if ( !( target_sd = map_id2sd(sd->menuskill_val) ) ) //Failed....
+ if ( !( target_sd = iMap->id2sd(sd->menuskill_val) ) ) //Failed....
return;
if( idx == 0xFFFF ) // No item selected ('Cancel' clicked)
@@ -14177,7 +14187,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) {
material = materials [ target_sd->inventory_data[idx]->wlv - 1 ]; // Lv1/2/3/4 weapons consume 1 Iron Ore/Iron/Steel/Rough Oridecon
else
material = materials [2]; // Armors consume 1 Steel
- if ( pc_search_inventory(sd,material) < 0 ) {
+ if ( iPc->search_inventory(sd,material) < 0 ) {
clif->skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0);
return;
}
@@ -14188,7 +14198,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) {
clif->equiplist(target_sd);
- pc_delitem(sd,pc_search_inventory(sd,material),1,0,0,LOG_TYPE_CONSUME);
+ iPc->delitem(sd,iPc->search_inventory(sd,material),1,0,0,LOG_TYPE_CONSUME);
clif->item_repaireffect(sd,idx,0);
@@ -14234,7 +14244,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
if( item->refine >= sd->menuskill_val
|| item->refine >= 10 // if it's no longer refineable
|| ditem->flag.no_refine // if the item isn't refinable
- || (i = pc_search_inventory(sd, material [ditem->wlv])) < 0 )
+ || (i = iPc->search_inventory(sd, material [ditem->wlv])) < 0 )
{
clif->skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0);
return;
@@ -14243,20 +14253,20 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
per = status_get_refine_chance(ditem->wlv, (int)item->refine);
per += (((signed int)sd->status.job_level)-50)/2; //Updated per the new kro descriptions. [Skotlex]
- pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
+ iPc->delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER);
if (per > rnd() % 100) {
logs->pick_pc(sd, LOG_TYPE_OTHER, -1, item, ditem);
item->refine++;
logs->pick_pc(sd, LOG_TYPE_OTHER, 1, item, ditem);
if(item->equip) {
ep = item->equip;
- pc_unequipitem(sd,idx,3);
+ iPc->unequipitem(sd,idx,3);
}
clif->refine(sd->fd,0,idx,item->refine);
clif->delitem(sd,idx,1,3);
clif->additem(sd,idx,1,0);
if (ep)
- pc_equipitem(sd,idx,ep);
+ iPc->equipitem(sd,idx,ep);
clif->misceffect(&sd->bl,3);
if(item->refine == 10 &&
item->card[0] == CARD0_FORGE &&
@@ -14264,22 +14274,22 @@ void skill_weaponrefine (struct map_session_data *sd, int idx)
{ // Fame point system [DracoRPG]
switch(ditem->wlv){
case 1:
- pc_addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
+ iPc->addfame(sd,1); // Success to refine to +10 a lv1 weapon you forged = +1 fame point
break;
case 2:
- pc_addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
+ iPc->addfame(sd,25); // Success to refine to +10 a lv2 weapon you forged = +25 fame point
break;
case 3:
- pc_addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
+ iPc->addfame(sd,1000); // Success to refine to +10 a lv3 weapon you forged = +1000 fame point
break;
}
}
} else {
item->refine = 0;
if(item->equip)
- pc_unequipitem(sd,idx,3);
+ iPc->unequipitem(sd,idx,3);
clif->refine(sd->fd,1,idx,item->refine);
- pc_delitem(sd,idx,1,0,2, LOG_TYPE_OTHER);
+ iPc->delitem(sd,idx,1,0,2, LOG_TYPE_OTHER);
clif->misceffect(&sd->bl,2);
clif->emotion(&sd->bl, E_OMG);
}
@@ -14298,7 +14308,7 @@ int skill_autospell (struct map_session_data *sd, uint16 skill_id)
nullpo_ret(sd);
skill_lv = sd->menuskill_val;
- lv=pc_checkskill(sd,skill_id);
+ lv=iPc->checkskill(sd,skill_id);
if(!skill_lv || !lv) return 0; // Player must learn the skill before doing auto-spell [Lance]
@@ -14341,10 +14351,10 @@ int skill_sit_count (struct block_list *bl, va_list ap) {
if(!pc_issit(sd))
return 0;
- if(type&1 && pc_checkskill(sd,RG_GANGSTER) > 0)
+ if(type&1 && iPc->checkskill(sd,RG_GANGSTER) > 0)
return 1;
- if(type&2 && (pc_checkskill(sd,TK_HPTIME) > 0 || pc_checkskill(sd,TK_SPTIME) > 0))
+ if(type&2 && (iPc->checkskill(sd,TK_HPTIME) > 0 || iPc->checkskill(sd,TK_SPTIME) > 0))
return 1;
return 0;
@@ -14359,10 +14369,10 @@ int skill_sit_in (struct block_list *bl, va_list ap) {
if(!pc_issit(sd))
return 0;
- if(type&1 && pc_checkskill(sd,RG_GANGSTER) > 0)
+ if(type&1 && iPc->checkskill(sd,RG_GANGSTER) > 0)
sd->state.gangsterparadise=1;
- if(type&2 && (pc_checkskill(sd,TK_HPTIME) > 0 || pc_checkskill(sd,TK_SPTIME) > 0 )) {
+ if(type&2 && (iPc->checkskill(sd,TK_HPTIME) > 0 || iPc->checkskill(sd,TK_SPTIME) > 0 )) {
sd->state.rest=1;
status_calc_regen(bl, &sd->battle_status, &sd->regen);
status_calc_regen_rate(bl, &sd->regen, &sd->sc);
@@ -14392,15 +14402,15 @@ int skill_sit (struct map_session_data *sd, int type)
nullpo_ret(sd);
- if((lv = pc_checkskill(sd,RG_GANGSTER)) > 0) {
+ if((lv = iPc->checkskill(sd,RG_GANGSTER)) > 0) {
flag|=1;
range = skill->get_splash(RG_GANGSTER, lv);
}
- if((lv = pc_checkskill(sd,TK_HPTIME)) > 0) {
+ if((lv = iPc->checkskill(sd,TK_HPTIME)) > 0) {
flag|=2;
range = skill->get_splash(TK_HPTIME, lv);
}
- else if ((lv = pc_checkskill(sd,TK_SPTIME)) > 0) {
+ else if ((lv = iPc->checkskill(sd,TK_SPTIME)) > 0) {
flag|=2;
range = skill->get_splash(TK_SPTIME, lv);
}
@@ -14414,11 +14424,11 @@ int skill_sit (struct map_session_data *sd, int type)
if (!flag) return 0;
if(type) {
- if (map_foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) > 1)
- map_foreachinrange(skill->sit_in,&sd->bl, range, BL_PC, flag);
+ if (iMap->foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) > 1)
+ iMap->foreachinrange(skill->sit_in,&sd->bl, range, BL_PC, flag);
} else {
- if (map_foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) < 2)
- map_foreachinrange(skill->sit_out,&sd->bl, range, BL_PC, flag);
+ if (iMap->foreachinrange(skill->sit_count,&sd->bl, range, BL_PC, flag) < 2)
+ iMap->foreachinrange(skill->sit_out,&sd->bl, range, BL_PC, flag);
}
return 0;
}
@@ -14464,7 +14474,7 @@ void skill_unitsetmapcell (struct skill_unit *src, uint16 skill_id, uint16 skill
for( y = src->bl.y - range; y <= src->bl.y + range; ++y )
for( x = src->bl.x - range; x <= src->bl.x + range; ++x )
- map_setcell(src->bl.m, x, y, cell, flag);
+ map[src->bl.m].setcell(src->bl.m, x, y, cell, flag);
}
/*==========================================
@@ -14603,7 +14613,7 @@ int skill_greed (struct block_list *bl, va_list ap) {
nullpo_ret(src = va_arg(ap, struct block_list *));
if(src->type == BL_PC && (sd=(struct map_session_data *)src) && bl->type==BL_ITEM && (fitem=(struct flooritem_data *)bl))
- pc_takeitem(sd, fitem);
+ iPc->takeitem(sd, fitem);
return 0;
}
@@ -14637,11 +14647,11 @@ int skill_detonator(struct block_list *bl, va_list ap)
clif->talkiebox(bl,unit->group->valstr);
unit->group->val2 = -1;
} else
- map_foreachinrange(skill->trap_splash,bl,skill->get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag,bl,unit->group->tick);
+ iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag,bl,unit->group->tick);
clif->changetraplook(bl,unit_id == UNT_FIRINGTRAP ? UNT_DUMMYSKILL : UNT_USED_TRAPS);
unit->group->unit_id = UNT_USED_TRAPS;
- unit->group->limit = DIFF_TICK(gettick(),unit->group->tick) +
+ unit->group->limit = DIFF_TICK(iTimer->gettick(),unit->group->tick) +
(unit_id == UNT_TALKIEBOX ? 5000 : (unit_id == UNT_CLUSTERBOMB || unit_id == UNT_ICEBOUNDTRAP? 2500 : 1500) );
break;
}
@@ -14790,7 +14800,7 @@ int skill_trap_splash (struct block_list *bl, va_list ap) {
return 0;
nullpo_ret(sg = unit->group);
- nullpo_ret(ss = map_id2bl(sg->src_id));
+ nullpo_ret(ss = iMap->id2bl(sg->src_id));
if(battle->check_target(src,bl,sg->target_flag) <= 0)
return 0;
@@ -14878,7 +14888,7 @@ bool skill_check_cloaking(struct block_list *bl, struct status_change_entry *sce
|| (bl->type != BL_PC && battle_config.monster_cloak_check_type&1) )
{ //Check for walls.
int i;
- ARR_FIND( 0, 8, i, map_getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
+ ARR_FIND( 0, 8, i, iMap->getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
if( i == 8 )
wall = false;
}
@@ -14909,7 +14919,7 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s
if( bl->type == BL_PC ) { //Check for walls.
int i;
- ARR_FIND( 0, 8, i, map_getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
+ ARR_FIND( 0, 8, i, iMap->getcell(bl->m, bl->x+dx[i], bl->y+dy[i], CELL_CHKNOPASS) != 0 );
if( i == 8 )
wall = false;
}
@@ -14942,7 +14952,7 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int
if(!unit->alive)
group->alive_count++;
- unit->bl.id=map_get_new_object_id();
+ unit->bl.id=iMap->get_new_object_id();
unit->bl.type=BL_SKILL;
unit->bl.m=group->map;
unit->bl.x=x;
@@ -14953,13 +14963,13 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int
unit->val2=val2;
idb_put(skillunit_db, unit->bl.id, unit);
- map_addiddb(&unit->bl);
- map_addblock(&unit->bl);
+ iMap->addiddb(&unit->bl);
+ iMap->addblock(&unit->bl);
// perform oninit actions
switch (group->skill_id) {
case WZ_ICEWALL:
- map_setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,5);
+ iMap->setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,5);
clif->changemapcell(0,unit->bl.m,unit->bl.x,unit->bl.y,5,AREA);
skill->unitsetmapcell(unit,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,true);
map[unit->bl.m].icewall_num++;
@@ -15002,18 +15012,18 @@ int skill_delunit (struct skill_unit* unit) {
// invoke onout event
if( !unit->range )
- map_foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),4);
+ iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,iTimer->gettick(),4);
// perform ondelete actions
switch (group->skill_id) {
case HT_ANKLESNARE: {
- struct block_list* target = map_id2bl(group->val2);
+ struct block_list* target = iMap->id2bl(group->val2);
if( target )
status_change_end(target, SC_ANKLE, INVALID_TIMER);
}
break;
case WZ_ICEWALL:
- map_setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,unit->val2);
+ iMap->setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,unit->val2);
clif->changemapcell(0,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2,ALL_SAMEMAP); // hack to avoid clientside cell bug
skill->unitsetmapcell(unit,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,false);
map[unit->bl.m].icewall_num--;
@@ -15025,7 +15035,7 @@ int skill_delunit (struct skill_unit* unit) {
skill->unitsetmapcell(unit,HP_BASILICA,group->skill_lv,CELL_BASILICA,false);
break;
case RA_ELECTRICSHOCKER: {
- struct block_list* target = map_id2bl(group->val2);
+ struct block_list* target = iMap->id2bl(group->val2);
if( target )
status_change_end(target, SC_ELECTRICSHOCKER, INVALID_TIMER);
}
@@ -15035,7 +15045,7 @@ int skill_delunit (struct skill_unit* unit) {
break;
case SC_MANHOLE: // Note : Removing the unit don't remove the status (official info)
if( group->val2 ) { // Someone Traped
- struct status_change *tsc = status_get_sc( map_id2bl(group->val2));
+ struct status_change *tsc = status_get_sc( iMap->id2bl(group->val2));
if( tsc && tsc->data[SC__MANHOLE] )
tsc->data[SC__MANHOLE]->val4 = 0; // Remove the Unit ID
}
@@ -15045,8 +15055,8 @@ int skill_delunit (struct skill_unit* unit) {
clif->skill_delunit(unit);
unit->group=NULL;
- map_delblock(&unit->bl); // don't free yet
- map_deliddb(&unit->bl);
+ iMap->delblock(&unit->bl); // don't free yet
+ iMap->deliddb(&unit->bl);
idb_remove(skillunit_db, unit->bl.id);
if(--group->alive_count==0)
skill->del_unitgroup(group,ALC_MARK);
@@ -15104,7 +15114,7 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count,
if(i == MAX_SKILLUNITGROUP) {
// array is full, make room by discarding oldest group
int j=0;
- unsigned maxdiff=0,x,tick=gettick();
+ unsigned maxdiff=0,x,tick=iTimer->gettick();
for(i=0;i<MAX_SKILLUNITGROUP && ud->skillunit[i];i++)
if((x=DIFF_TICK(tick,ud->skillunit[i]->tick))>maxdiff){
maxdiff=x;
@@ -15133,7 +15143,7 @@ struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count,
group->map = src->m;
group->limit = limit;
group->interval = interval;
- group->tick = gettick();
+ group->tick = iTimer->gettick();
group->valstr = NULL;
ud->skillunit[i] = group;
@@ -15160,7 +15170,7 @@ int skill_delunitgroup(struct skill_unit_group *group, const char* file, int lin
return 0;
}
- src=map_id2bl(group->src_id);
+ src=iMap->id2bl(group->src_id);
ud = unit_bl2ud(src);
if(!src || !ud) {
ShowError("skill_delunitgroup: Group's source not found! (src_id: %d skill_id: %d)\n", group->src_id, group->skill_id);
@@ -15262,7 +15272,7 @@ int skill_delunitgroup(struct skill_unit_group *group, const char* file, int lin
}
idb_remove(group_db, group->group_id);
- map_freeblock(&group->unit->bl); // schedules deallocation of whole array (HACK)
+ iMap->freeblock(&group->unit->bl); // schedules deallocation of whole array (HACK)
group->unit=NULL;
group->group_id=0;
group->unit_count=0;
@@ -15326,7 +15336,7 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_lis
}
if (j == -1) {
- ShowWarning ("skill_unitgrouptickset_search: tickset is full\n");
+ ShowWarning ("skill_unitgrouptickset_search: tickset is full. ( failed for skill '%s' on unit %d )\n",skill->get_name(group->skill_id),bl->type);
j = id % MAX_SKILLUNITGROUPTICKSET;
}
@@ -15348,7 +15358,7 @@ int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
nullpo_ret(group);
- if( !(skill->get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP|INF2_NOLP)) && map_getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) )
+ if( !(skill->get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP|INF2_NOLP)) && iMap->getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) )
return 0; //AoE skills are ineffective. [Skotlex]
if( battle->check_target(&unit->bl,bl,group->target_flag) <= 0 )
@@ -15363,7 +15373,7 @@ int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
* @see DBApply
*/
int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
- struct skill_unit* unit = DB->data2ptr(data);
+ struct skill_unit* unit = iDB->data2ptr(data);
struct skill_unit_group* group = unit->group;
unsigned int tick = va_arg(ap,unsigned int);
bool dissonance;
@@ -15421,13 +15431,13 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
{
struct block_list* src;
- if( unit->val1 > 0 && (src = map_id2bl(group->src_id)) != NULL && src->type == BL_PC )
+ if( unit->val1 > 0 && (src = iMap->id2bl(group->src_id)) != NULL && src->type == BL_PC )
{ // revert unit back into a trap
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = group->item_id?group->item_id:ITEMID_TRAP;
item_tmp.identify = 1;
- map_addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0);
+ iMap->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0);
}
skill->delunit(unit);
}
@@ -15441,23 +15451,23 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
group->limit = skill->get_time(group->skill_id,group->skill_lv);
unit->limit = skill->get_time(group->skill_id,group->skill_lv);
// apply effect to all units standing on it
- map_foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,gettick(),1);
+ iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,iTimer->gettick(),1);
break;
case UNT_CALLFAMILY:
{
struct map_session_data *sd = NULL;
if(group->val1) {
- sd = map_charid2sd(group->val1);
+ sd = iMap->charid2sd(group->val1);
group->val1 = 0;
if (sd && !map[sd->bl.m].flag.nowarp)
- pc_setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
+ iPc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
}
if(group->val2) {
- sd = map_charid2sd(group->val2);
+ sd = iMap->charid2sd(group->val2);
group->val2 = 0;
if (sd && !map[sd->bl.m].flag.nowarp)
- pc_setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
+ iPc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
}
skill->delunit(unit);
}
@@ -15469,23 +15479,23 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
break;
}
clif->changetraplook(bl,UNT_USED_TRAPS);
- map_foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
+ iMap->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
group->limit = DIFF_TICK(tick,group->tick)+1000;
unit->limit = DIFF_TICK(tick,group->tick)+1000;
group->unit_id = UNT_USED_TRAPS;
break;
case UNT_FEINTBOMB: {
- struct block_list *src = map_id2bl(group->src_id);
+ struct block_list *src = iMap->id2bl(group->src_id);
if( src )
- map_foreachinrange(skill->area_sub, &group->unit->bl, unit->range, splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, BCT_ENEMY|SD_ANIMATION|1, skill->castend_damage_id);
+ iMap->foreachinrange(skill->area_sub, &group->unit->bl, unit->range, splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, BCT_ENEMY|SD_ANIMATION|1, skill->castend_damage_id);
skill->delunit(unit);
break;
}
case UNT_BANDING:
{
- struct block_list *src = map_id2bl(group->src_id);
+ struct block_list *src = iMap->id2bl(group->src_id);
struct status_change *sc;
if( !src || (sc = status_get_sc(src)) == NULL || !sc->data[SC_BANDING] )
{
@@ -15532,7 +15542,7 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
case UNT_REVERBERATION:
if( unit->val1 <= 0 ){
clif->changetraplook(bl,UNT_USED_TRAPS);
- map_foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
+ iMap->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
group->limit = DIFF_TICK(tick,group->tick)+1000;
unit->limit = DIFF_TICK(tick,group->tick)+1000;
group->unit_id = UNT_USED_TRAPS;
@@ -15556,9 +15566,9 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
if( unit->range >= 0 && group->interval != -1 )
{
if( battle_config.skill_wall_check )
- map_foreachinshootrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick);
+ iMap->foreachinshootrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick);
else
- map_foreachinrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick);
+ iMap->foreachinrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick);
if(unit->range == -1) //Unit disabled, but it should not be deleted yet.
group->unit_id = UNT_USED_TRAPS;
@@ -15580,11 +15590,11 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
* Executes on all skill units every SKILLUNITTIMER_INTERVAL miliseconds.
*------------------------------------------*/
int skill_unit_timer(int tid, unsigned int tick, int id, intptr_t data) {
- map_freeblock_lock();
+ iMap->freeblock_lock();
skillunit_db->foreach(skillunit_db, skill->unit_timer_sub, tick);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
@@ -15700,7 +15710,7 @@ int skill_unit_move (struct block_list *bl, unsigned int tick, int flag) {
memset(skill_unit_temp, 0, sizeof(skill_unit_temp));
}
- map_foreachincell(skill->unit_move_sub,bl->m,bl->x,bl->y,BL_SKILL,bl,tick,flag);
+ iMap->foreachincell(skill->unit_move_sub,bl->m,bl->x,bl->y,BL_SKILL,bl,tick,flag);
if( flag&2 && flag&1 ) { //Onplace, check any skill units you have left.
int i;
@@ -15718,7 +15728,7 @@ int skill_unit_move (struct block_list *bl, unsigned int tick, int flag) {
int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 dx, int16 dy)
{
int i,j;
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
int *m_flag;
struct skill_unit *unit1;
struct skill_unit *unit2;
@@ -15766,14 +15776,14 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
if (!(m_flag[i]&0x2)) {
if (group->state.song_dance&0x1) //Cancel dissonance effect.
skill->dance_overlap(unit1, 0);
- map_foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,4);
+ iMap->foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,4);
}
//Move Cell using "smart" criteria (avoid useless moving around)
switch(m_flag[i])
{
case 0:
//Cell moves independently, safely move it.
- map_moveblock(&unit1->bl, unit1->bl.x+dx, unit1->bl.y+dy, tick);
+ iMap->moveblock(&unit1->bl, unit1->bl.x+dx, unit1->bl.y+dy, tick);
break;
case 1:
//Cell moves unto another cell, look for a replacement cell that won't collide
@@ -15784,7 +15794,7 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
continue;
//Move to where this cell would had moved.
unit2 = &group->unit[j];
- map_moveblock(&unit1->bl, unit2->bl.x+dx, unit2->bl.y+dy, tick);
+ iMap->moveblock(&unit1->bl, unit2->bl.x+dx, unit2->bl.y+dy, tick);
j++; //Skip this cell as we have used it.
break;
}
@@ -15797,7 +15807,7 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
if (group->state.song_dance&0x1) //Check for dissonance effect.
skill->dance_overlap(unit1, 1);
clif->skill_setunit(unit1);
- map_foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,1);
+ iMap->foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,1);
}
}
aFree(m_flag);
@@ -15819,7 +15829,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger,
for(i=0;i<MAX_SKILL_PRODUCE_DB;i++){
if(skill_produce_db[i].nameid == nameid ){
if((j=skill_produce_db[i].req_skill)>0 &&
- pc_checkskill(sd,j) < skill_produce_db[i].req_skill_lv)
+ iPc->checkskill(sd,j) < skill_produce_db[i].req_skill_lv)
continue; // must iterate again to check other skills that produce it. [malufett]
if( j > 0 && sd->menuskill_id > 0 && sd->menuskill_id != j )
continue; // special case
@@ -15830,7 +15840,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger,
if( i >= MAX_SKILL_PRODUCE_DB )
return 0;
- if( pc_checkadditem(sd, nameid, qty) == ADDITEM_OVERAMOUNT )
+ if( iPc->checkadditem(sd, nameid, qty) == ADDITEM_OVERAMOUNT )
{// cannot carry the produced stuff
return 0;
}
@@ -15853,7 +15863,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger,
if( (id=skill_produce_db[i].mat_id[j]) <= 0 )
continue;
if(skill_produce_db[i].mat_amount[j] <= 0) {
- if(pc_search_inventory(sd,id) < 0)
+ if(iPc->search_inventory(sd,id) < 0)
return 0;
}
else {
@@ -15905,22 +15915,22 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
int j;
if( slot[i]<=0 )
continue;
- j = pc_search_inventory(sd,slot[i]);
+ j = iPc->search_inventory(sd,slot[i]);
if(j < 0)
continue;
if(slot[i]==1000){ /* Star Crumb */
- pc_delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
+ iPc->delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
sc++;
}
if(slot[i]>=994 && slot[i]<=997 && ele==0){ /* Flame Heart . . . Great Nature */
static const int ele_table[4]={3,1,4,2};
- pc_delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
+ iPc->delitem(sd,j,1,1,0,LOG_TYPE_PRODUCE);
ele=ele_table[slot[i]-994];
}
}
if( skill_id == RK_RUNEMASTERY ) {
- int temp_qty, skill_lv = pc_checkskill(sd,skill_id);
+ int temp_qty, skill_lv = iPc->checkskill(sd,skill_id);
data = itemdb_search(nameid);
if( skill_lv == 10 ) temp_qty = 1 + rnd()%3;
@@ -15955,12 +15965,12 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
x=( skill_id == RK_RUNEMASTERY ? 1 : qty)*skill_produce_db[idx].mat_amount[i];
do{
int y=0;
- j = pc_search_inventory(sd,id);
+ j = iPc->search_inventory(sd,id);
if(j >= 0){
y = sd->status.inventory[j].amount;
if(y>x)y=x;
- pc_delitem(sd,j,y,0,0,LOG_TYPE_PRODUCE);
+ iPc->delitem(sd,j,y,0,0,LOG_TYPE_PRODUCE);
} else
ShowError("skill_produce_mix: material item error\n");
@@ -15976,7 +15986,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
case BS_STEEL:
case BS_ENCHANTEDSTONE:
// Ores & Metals Refining - skill bonuses are straight from kRO website [DracoRPG]
- i = pc_checkskill(sd,skill_id);
+ i = iPc->checkskill(sd,skill_id);
make_per = sd->status.job_level*20 + status->dex*10 + status->luk*10; //Base chance
switch(nameid){
case 998: // Iron
@@ -16007,8 +16017,8 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
case AM_TWILIGHT1:
case AM_TWILIGHT2:
case AM_TWILIGHT3:
- make_per = pc_checkskill(sd,AM_LEARNINGPOTION)*50
- + pc_checkskill(sd,AM_PHARMACY)*300 + sd->status.job_level*20
+ make_per = iPc->checkskill(sd,AM_LEARNINGPOTION)*50
+ + iPc->checkskill(sd,AM_PHARMACY)*300 + sd->status.job_level*20
+ (status->int_/2)*10 + status->dex*10+status->luk*10;
if(homun_alive(sd->hd)) {//Player got a homun
int skill;
@@ -16056,7 +16066,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
**/
case RK_RUNEMASTERY:
{
- int A = 100 * (51 + 2 * pc_checkskill(sd, skill_id));
+ int A = 100 * (51 + 2 * iPc->checkskill(sd, skill_id));
int B = 100 * status->dex / 30 + 10 * (status->luk + sd->status.job_level);
int C = 100 * cap_value(sd->itemid,0,100); //itemid depend on makerune()
int D = 0;
@@ -16088,8 +16098,8 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
* Guilotine Cross
**/
case GC_CREATENEWPOISON:
- make_per = 3000 + 500 * pc_checkskill(sd,GC_RESEARCHNEWPOISON);
- qty = 1+rnd()%pc_checkskill(sd,GC_RESEARCHNEWPOISON);
+ make_per = 3000 + 500 * iPc->checkskill(sd,GC_RESEARCHNEWPOISON);
+ qty = 1+rnd()%iPc->checkskill(sd,GC_RESEARCHNEWPOISON);
break;
case GN_CHANGEMATERIAL:
for(i=0; i<MAX_SKILL_PRODUCE_DB; i++)
@@ -16105,7 +16115,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
difficulty = (620 - 20 * skill_lv);// (620 - 20 * Skill Level)
make_per = status->int_ + status->dex/2 + status->luk + sd->status.job_level + (30+rnd()%120) + // (Caster?s INT) + (Caster?s DEX / 2) + (Caster?s LUK) + (Caster?s Job Level) + Random number between (30 ~ 150) +
- (sd->status.base_level-100) + pc_checkskill(sd, AM_LEARNINGPOTION) + pc_checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster?s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10)
+ (sd->status.base_level-100) + iPc->checkskill(sd, AM_LEARNINGPOTION) + iPc->checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster?s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10)
switch(nameid){// difficulty factor
case 12422: case 12425:
@@ -16207,13 +16217,13 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
}
} else { // Weapon Forging - skill bonuses are straight from kRO website, other things from a jRO calculator [DracoRPG]
make_per = 5000 + sd->status.job_level*20 + status->dex*10 + status->luk*10; // Base
- make_per += pc_checkskill(sd,skill_id)*500; // Smithing skills bonus: +5/+10/+15
- make_per += pc_checkskill(sd,BS_WEAPONRESEARCH)*100 +((wlv >= 3)? pc_checkskill(sd,BS_ORIDEOCON)*100:0); // Weaponry Research bonus: +1/+2/+3/+4/+5/+6/+7/+8/+9/+10, Oridecon Research bonus (custom): +1/+2/+3/+4/+5
+ make_per += iPc->checkskill(sd,skill_id)*500; // Smithing skills bonus: +5/+10/+15
+ make_per += iPc->checkskill(sd,BS_WEAPONRESEARCH)*100 +((wlv >= 3)? iPc->checkskill(sd,BS_ORIDEOCON)*100:0); // Weaponry Research bonus: +1/+2/+3/+4/+5/+6/+7/+8/+9/+10, Oridecon Research bonus (custom): +1/+2/+3/+4/+5
make_per -= (ele?2000:0) + sc*1500 + (wlv>1?wlv*1000:0); // Element Stone: -20%, Star Crumb: -15% each, Weapon level malus: -0/-20/-30
- if(pc_search_inventory(sd,989) > 0) make_per+= 1000; // Emperium Anvil: +10
- else if(pc_search_inventory(sd,988) > 0) make_per+= 500; // Golden Anvil: +5
- else if(pc_search_inventory(sd,987) > 0) make_per+= 300; // Oridecon Anvil: +3
- else if(pc_search_inventory(sd,986) > 0) make_per+= 0; // Anvil: +0?
+ if(iPc->search_inventory(sd,989) > 0) make_per+= 1000; // Emperium Anvil: +10
+ else if(iPc->search_inventory(sd,988) > 0) make_per+= 500; // Golden Anvil: +5
+ else if(iPc->search_inventory(sd,987) > 0) make_per+= 300; // Oridecon Anvil: +3
+ else if(iPc->search_inventory(sd,986) > 0) make_per+= 0; // Anvil: +0?
if(battle_config.wp_rate != 100)
make_per = make_per * battle_config.wp_rate / 100;
}
@@ -16283,7 +16293,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
clif->produce_effect(sd,0,nameid);
clif->misceffect(&sd->bl,3);
if(itemdb_wlv(nameid) >= 3 && ((ele? 1 : 0) + sc) >= 3) // Fame point system [DracoRPG]
- pc_addfame(sd,10); // Success to forge a lv3 weapon with 3 additional ingredients = +10 fame point
+ iPc->addfame(sd,10); // Success to forge a lv3 weapon with 3 additional ingredients = +10 fame point
} else {
int fame = 0;
tmp_item.amount = 0;
@@ -16323,7 +16333,7 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
}
if (fame)
- pc_addfame(sd,fame);
+ iPc->addfame(sd,fame);
//Visual effects and the like.
switch (skill_id) {
case AM_PHARMACY:
@@ -16362,9 +16372,9 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
for(j=0; j<5; j++){
if( rnd()%1000 < skill_changematerial_db[i].qty_rate[j] ){
tmp_item.amount = qty * skill_changematerial_db[i].qty[j];
- if((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
+ if((flag = iPc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif->additem(sd,0,0,flag);
- map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
k++;
}
@@ -16376,9 +16386,9 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
return 1;
}
} else if (tmp_item.amount) { //Success
- if((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
+ if((flag = iPc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif->additem(sd,0,0,flag);
- map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
if( skill_id == GN_MIX_COOKING || skill_id == GN_MAKEBOMB || skill_id == GN_S_PHARMACY )
clif->msg_skill(sd,skill_id,0x627);
@@ -16428,9 +16438,9 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
tmp_item.nameid = compensation[i];
tmp_item.amount = qty;
tmp_item.identify = 1;
- if( pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE) ) {
+ if( iPc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE) ) {
clif->additem(sd,0,0,flag);
- map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
clif->msg_skill(sd,skill_id,0x628);
}
@@ -16468,10 +16478,10 @@ int skill_arrow_create (struct map_session_data *sd, int nameid)
break;
}
- if(index < 0 || (j = pc_search_inventory(sd,nameid)) < 0)
+ if(index < 0 || (j = iPc->search_inventory(sd,nameid)) < 0)
return 1;
- pc_delitem(sd,j,1,0,0,LOG_TYPE_PRODUCE);
+ iPc->delitem(sd,j,1,0,0,LOG_TYPE_PRODUCE);
for(i=0;i<MAX_ARROW_RESOURCE;i++) {
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.identify = 1;
@@ -16485,9 +16495,9 @@ int skill_arrow_create (struct map_session_data *sd, int nameid)
}
if(tmp_item.nameid <= 0 || tmp_item.amount <= 0)
continue;
- if((flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
+ if((flag = iPc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE))) {
clif->additem(sd,0,0,flag);
- map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
@@ -16497,7 +16507,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) {
sc_type type;
int chance, i;
nullpo_ret(sd);
- if( nameid <= 0 || (i = pc_search_inventory(sd,nameid)) < 0 || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) {
+ if( nameid <= 0 || (i = iPc->search_inventory(sd,nameid)) < 0 || iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) ) {
clif->skill_fail(sd,GC_POISONINGWEAPON,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -16517,7 +16527,7 @@ int skill_poisoningweapon( struct map_session_data *sd, int nameid) {
}
chance = 2 + 2 * sd->menuskill_val; // 2 + 2 * skill_lv
- sc_start4(&sd->bl, SC_POISONINGWEAPON, 100, pc_checkskill(sd, GC_RESEARCHNEWPOISON), //in Aegis it store the level of GC_RESEARCHNEWPOISON in val1
+ sc_start4(&sd->bl, SC_POISONINGWEAPON, 100, iPc->checkskill(sd, GC_RESEARCHNEWPOISON), //in Aegis it store the level of GC_RESEARCHNEWPOISON in val1
type, chance, 0, skill->get_time(GC_POISONINGWEAPON, sd->menuskill_val));
return 0;
@@ -16553,14 +16563,14 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) {
nullpo_ret(sd);
skill_id = sd->menuskill_val;
- if( nameid <= 0 || !itemdb_is_element(nameid) || (i = pc_search_inventory(sd,nameid)) < 0 || !skill_id || pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) )
+ if( nameid <= 0 || !itemdb_is_element(nameid) || (i = iPc->search_inventory(sd,nameid)) < 0 || !skill_id || iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME) )
{
clif->skill_fail(sd,NC_MAGICDECOY,USESKILL_FAIL_LEVEL,0);
return 0;
}
// Spawn Position
- pc_delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
+ iPc->delitem(sd,i,1,0,0,LOG_TYPE_CONSUME);
x = sd->sc.comet_x;
y = sd->sc.comet_y;
sd->sc.comet_x = sd->sc.comet_y = 0;
@@ -16574,8 +16584,8 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) {
md->master_id = sd->bl.id;
md->special_state.ai = AI_FLORA;
if( md->deletetimer != INVALID_TIMER )
- delete_timer(md->deletetimer, mob_timer_delete);
- md->deletetimer = add_timer (gettick() + skill->get_time(NC_MAGICDECOY,skill_id), mob_timer_delete, md->bl.id, 0);
+ iTimer->delete_timer(md->deletetimer, mob_timer_delete);
+ md->deletetimer = iTimer->add_timer (iTimer->gettick() + skill->get_time(NC_MAGICDECOY,skill_id), mob_timer_delete, md->bl.id, 0);
mob_spawn(md);
md->status.matk_min = md->status.matk_max = 250 + (50 * skill_id);
}
@@ -16603,14 +16613,14 @@ int skill_spellbook (struct map_session_data *sd, int nameid) {
ARR_FIND(0,MAX_SKILL_SPELLBOOK_DB,i,skill_spellbook_db[i].nameid == nameid); // Search for information of this item
if( i == MAX_SKILL_SPELLBOOK_DB ) return 0;
- if( !pc_checkskill(sd, (skill_id = skill_spellbook_db[i].skill_id)) )
+ if( !iPc->checkskill(sd, (skill_id = skill_spellbook_db[i].skill_id)) )
{ // User don't know the skill
- sc_start(&sd->bl, SC_SLEEP, 100, 1, skill->get_time(WL_READING_SB, pc_checkskill(sd,WL_READING_SB)));
+ sc_start(&sd->bl, SC_SLEEP, 100, 1, skill->get_time(WL_READING_SB, iPc->checkskill(sd,WL_READING_SB)));
clif->skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_DIFFICULT_SLEEP, 0);
return 0;
}
- max_preserve = 4 * pc_checkskill(sd, WL_FREEZE_SP) + status_get_int(&sd->bl) / 10 + sd->status.base_level / 10;
+ max_preserve = 4 * iPc->checkskill(sd, WL_FREEZE_SP) + status_get_int(&sd->bl) / 10 + sd->status.base_level / 10;
point = skill_spellbook_db[i].point;
if( sc && sc->data[SC_READING_SB] ) {
@@ -16621,13 +16631,13 @@ int skill_spellbook (struct map_session_data *sd, int nameid) {
for(i = SC_MAXSPELLBOOK; i >= SC_SPELLBOOK1; i--){ // This is how official saves spellbook. [malufett]
if( !sc->data[i] ){
sc->data[SC_READING_SB]->val2 += point; // increase points
- sc_start4(&sd->bl, (sc_type)i, 100, skill_id, pc_checkskill(sd,skill_id), point, 0, INVALID_TIMER);
+ sc_start4(&sd->bl, (sc_type)i, 100, skill_id, iPc->checkskill(sd,skill_id), point, 0, INVALID_TIMER);
break;
}
}
}else{
sc_start2(&sd->bl, SC_READING_SB, 100, 0, point, INVALID_TIMER);
- sc_start4(&sd->bl, SC_MAXSPELLBOOK, 100, skill_id, pc_checkskill(sd,skill_id), point, 0, INVALID_TIMER);
+ sc_start4(&sd->bl, SC_MAXSPELLBOOK, 100, skill_id, iPc->checkskill(sd,skill_id), point, 0, INVALID_TIMER);
}
return 1;
@@ -16696,7 +16706,7 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv,
return 1;
}
- if( pc_delitem(sd,idx,del_amount,0,1,LOG_TYPE_CONSUME) ) {
+ if( iPc->delitem(sd,idx,del_amount,0,1,LOG_TYPE_CONSUME) ) {
clif->skill_fail(sd,SO_EL_ANALYSIS,USESKILL_FAIL_LEVEL,0);
return 1;
}
@@ -16713,9 +16723,9 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, uint16 skill_lv,
tmp_item.identify = 1;
if( tmp_item.amount ) {
- if( (flag = pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_CONSUME)) ) {
+ if( (flag = iPc->additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_CONSUME)) ) {
clif->additem(sd,0,0,flag);
- map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
+ iMap->addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}
}
@@ -16793,7 +16803,7 @@ int skill_destroy_trap( struct block_list *bl, va_list ap ) {
case UNT_CLUSTERBOMB:
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
- map_foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &su->bl,tick);
+ iMap->foreachinrange(skill->trap_splash,&su->bl, skill->get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &su->bl,tick);
break;
}
// Traps aren't recovered.
@@ -16805,7 +16815,7 @@ int skill_destroy_trap( struct block_list *bl, va_list ap ) {
*
*------------------------------------------*/
int skill_blockpc_end(int tid, unsigned int tick, int id, intptr_t data) {
- struct map_session_data *sd = map_id2sd(id);
+ struct map_session_data *sd = iMap->id2sd(id);
struct skill_cd * cd = NULL;
if (data <= 0 || data >= MAX_SKILL)
@@ -16878,12 +16888,12 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick,
cd->cursor++;
}
- sd->blockskill[idx] = 0x1|(0xFE&add_timer(gettick()+tick,skill->blockpc_end,sd->bl.id,idx));
+ sd->blockskill[idx] = 0x1|(0xFE&iTimer->add_timer(iTimer->gettick()+tick,skill->blockpc_end,sd->bl.id,idx));
return 0;
}
int skill_blockhomun_end(int tid, unsigned int tick, int id, intptr_t data) { //[orn]
- struct homun_data *hd = (TBL_HOM*) map_id2bl(id);
+ struct homun_data *hd = (TBL_HOM*) iMap->id2bl(id);
if (data <= 0 || data >= MAX_SKILL)
return 0;
if (hd) hd->blockskill[data] = 0;
@@ -16904,11 +16914,11 @@ int skill_blockhomun_start(struct homun_data *hd, uint16 skill_id, int tick) { /
return -1;
}
hd->blockskill[idx] = 1;
- return add_timer(gettick() + tick, skill->blockhomun_end, hd->bl.id, idx);
+ return iTimer->add_timer(iTimer->gettick() + tick, skill->blockhomun_end, hd->bl.id, idx);
}
int skill_blockmerc_end(int tid, unsigned int tick, int id, intptr_t data) {//[orn]
- struct mercenary_data *md = (TBL_MER*)map_id2bl(id);
+ struct mercenary_data *md = (TBL_MER*)iMap->id2bl(id);
if( data <= 0 || data >= MAX_SKILL )
return 0;
if( md ) md->blockskill[data] = 0;
@@ -16929,7 +16939,7 @@ int skill_blockmerc_start(struct mercenary_data *md, uint16 skill_id, int tick)
return -1;
}
md->blockskill[idx] = 1;
- return add_timer(gettick() + tick, skill->blockmerc_end, md->bl.id, idx);
+ return iTimer->add_timer(iTimer->gettick() + tick, skill->blockmerc_end, md->bl.id, idx);
}
/**
* Adds a new skill unit entry for this player to recast after map load
@@ -17796,27 +17806,27 @@ void skill_readdb(void) {
safestrncpy(skill_db[0].name, "UNKNOWN_SKILL", sizeof(skill_db[0].name));
safestrncpy(skill_db[0].desc, "Unknown Skill", sizeof(skill_db[0].desc));
- sv->readdb(db_path, DBPATH"skill_db.txt" , ',', 17, 17, MAX_SKILL_DB, skill->parse_row_skilldb);
- sv->readdb(db_path, DBPATH"skill_require_db.txt" , ',', 32, 32, MAX_SKILL_DB, skill->parse_row_requiredb);
+ sv->readdb(iMap->db_path, DBPATH"skill_db.txt" , ',', 17, 17, MAX_SKILL_DB, skill->parse_row_skilldb);
+ sv->readdb(iMap->db_path, DBPATH"skill_require_db.txt" , ',', 32, 32, MAX_SKILL_DB, skill->parse_row_requiredb);
#ifdef RENEWAL_CAST
- sv->readdb(db_path, "re/skill_cast_db.txt" , ',', 8, 8, MAX_SKILL_DB, skill->parse_row_castdb);
+ sv->readdb(iMap->db_path, "re/skill_cast_db.txt" , ',', 8, 8, MAX_SKILL_DB, skill->parse_row_castdb);
#else
- sv->readdb(db_path, "pre-re/skill_cast_db.txt" , ',', 7, 7, MAX_SKILL_DB, skill->parse_row_castdb);
+ sv->readdb(iMap->db_path, "pre-re/skill_cast_db.txt" , ',', 7, 7, MAX_SKILL_DB, skill->parse_row_castdb);
#endif
- sv->readdb(db_path, DBPATH"skill_castnodex_db.txt", ',', 2, 3, MAX_SKILL_DB, skill->parse_row_castnodexdb);
- sv->readdb(db_path, DBPATH"skill_unit_db.txt" , ',', 8, 8, MAX_SKILL_DB, skill->parse_row_unitdb);
+ sv->readdb(iMap->db_path, DBPATH"skill_castnodex_db.txt", ',', 2, 3, MAX_SKILL_DB, skill->parse_row_castnodexdb);
+ sv->readdb(iMap->db_path, DBPATH"skill_unit_db.txt" , ',', 8, 8, MAX_SKILL_DB, skill->parse_row_unitdb);
skill->init_unit_layout();
- sv->readdb(db_path, "produce_db.txt" , ',', 4, 4+2*MAX_PRODUCE_RESOURCE, MAX_SKILL_PRODUCE_DB, skill->parse_row_producedb);
- sv->readdb(db_path, "create_arrow_db.txt" , ',', 1+2, 1+2*MAX_ARROW_RESOURCE, MAX_SKILL_ARROW_DB, skill->parse_row_createarrowdb);
- sv->readdb(db_path, "abra_db.txt" , ',', 4, 4, MAX_SKILL_ABRA_DB, skill->parse_row_abradb);
+ sv->readdb(iMap->db_path, "produce_db.txt" , ',', 4, 4+2*MAX_PRODUCE_RESOURCE, MAX_SKILL_PRODUCE_DB, skill->parse_row_producedb);
+ sv->readdb(iMap->db_path, "create_arrow_db.txt" , ',', 1+2, 1+2*MAX_ARROW_RESOURCE, MAX_SKILL_ARROW_DB, skill->parse_row_createarrowdb);
+ sv->readdb(iMap->db_path, "abra_db.txt" , ',', 4, 4, MAX_SKILL_ABRA_DB, skill->parse_row_abradb);
//Warlock
- sv->readdb(db_path, "spellbook_db.txt" , ',', 3, 3, MAX_SKILL_SPELLBOOK_DB, skill->parse_row_spellbookdb);
+ sv->readdb(iMap->db_path, "spellbook_db.txt" , ',', 3, 3, MAX_SKILL_SPELLBOOK_DB, skill->parse_row_spellbookdb);
//Guillotine Cross
- sv->readdb(db_path, "magicmushroom_db.txt" , ',', 1, 1, MAX_SKILL_MAGICMUSHROOM_DB, skill->parse_row_magicmushroomdb);
- sv->readdb(db_path, "skill_reproduce_db.txt", ',', 1, 1, MAX_SKILL_DB, skill->parse_row_reproducedb);
- sv->readdb(db_path, "skill_improvise_db.txt" , ',', 2, 2, MAX_SKILL_IMPROVISE_DB, skill->parse_row_improvisedb);
- sv->readdb(db_path, "skill_changematerial_db.txt" , ',', 4, 4+2*5, MAX_SKILL_PRODUCE_DB, skill->parse_row_changematerialdb);
+ sv->readdb(iMap->db_path, "magicmushroom_db.txt" , ',', 1, 1, MAX_SKILL_MAGICMUSHROOM_DB, skill->parse_row_magicmushroomdb);
+ sv->readdb(iMap->db_path, "skill_reproduce_db.txt", ',', 1, 1, MAX_SKILL_DB, skill->parse_row_reproducedb);
+ sv->readdb(iMap->db_path, "skill_improvise_db.txt" , ',', 2, 2, MAX_SKILL_IMPROVISE_DB, skill->parse_row_improvisedb);
+ sv->readdb(iMap->db_path, "skill_changematerial_db.txt" , ',', 4, 4+2*5, MAX_SKILL_PRODUCE_DB, skill->parse_row_changematerialdb);
}
void skill_reload (void) {
@@ -17861,13 +17871,13 @@ int do_init_skill (void) {
skill_unit_ers = ers_new(sizeof(struct skill_unit_group),"skill.c::skill_unit_ers",ERS_OPT_NONE);
skill_timer_ers = ers_new(sizeof(struct skill_timerskill),"skill.c::skill_timer_ers",ERS_OPT_NONE);
- add_timer_func_list(skill->unit_timer,"skill_unit_timer");
- add_timer_func_list(skill->castend_id,"skill_castend_id");
- add_timer_func_list(skill->castend_pos,"skill_castend_pos");
- add_timer_func_list(skill->timerskill,"skill_timerskill");
- add_timer_func_list(skill->blockpc_end, "skill_blockpc_end");
+ iTimer->add_timer_func_list(skill->unit_timer,"skill_unit_timer");
+ iTimer->add_timer_func_list(skill->castend_id,"skill_castend_id");
+ iTimer->add_timer_func_list(skill->castend_pos,"skill_castend_pos");
+ iTimer->add_timer_func_list(skill->timerskill,"skill_timerskill");
+ iTimer->add_timer_func_list(skill->blockpc_end, "skill_blockpc_end");
- add_timer_interval(gettick()+SKILLUNITTIMER_INTERVAL,skill->unit_timer,0,0,SKILLUNITTIMER_INTERVAL);
+ iTimer->add_timer_interval(iTimer->gettick()+SKILLUNITTIMER_INTERVAL,skill->unit_timer,0,0,SKILLUNITTIMER_INTERVAL);
return 0;
}
diff --git a/src/map/skill.h b/src/map/skill.h
index 553dabd6d..c585bbb3a 100644
--- a/src/map/skill.h
+++ b/src/map/skill.h
@@ -81,14 +81,14 @@ enum e_skill_nk {
//Constants to identify a skill's inf2 value.
enum e_skill_inf2 {
INF2_QUEST_SKILL = 0x0001,
- INF2_NPC_SKILL = 0x0002, //NPC skills are those that players can't have in their skill tree.
+ INF2_NPC_SKILL = 0x0002, // NPC skills are those that players can't have in their skill tree.
INF2_WEDDING_SKILL = 0x0004,
INF2_SPIRIT_SKILL = 0x0008,
INF2_GUILD_SKILL = 0x0010,
INF2_SONG_DANCE = 0x0020,
INF2_ENSEMBLE_SKILL = 0x0040,
INF2_TRAP = 0x0080,
- INF2_TARGET_SELF = 0x0100, //Refers to ground placed skills that will target the caster as well (like Grandcross)
+ INF2_TARGET_SELF = 0x0100, // Refers to ground placed skills that will target the caster as well (like Grandcross)
INF2_NO_TARGET_SELF = 0x0200,
INF2_PARTY_ONLY = 0x0400,
INF2_GUILD_ONLY = 0x0800,
@@ -107,19 +107,19 @@ enum e_skill_display {
};
enum {
- UF_DEFNOTENEMY = 0x0001, // If 'defunit_not_enemy' is set, the target is changed to 'friend'
- UF_NOREITERATION = 0x0002, // Spell cannot be stacked
- UF_NOFOOTSET = 0x0004, // Spell cannot be cast near/on targets
- UF_NOOVERLAP = 0x0008, // Spell effects do not overlap
- UF_PATHCHECK = 0x0010, // Only cells with a shootable path will be placed
- UF_NOPC = 0x0020, // May not target players
- UF_NOMOB = 0x0040, // May not target mobs
- UF_SKILL = 0x0080, // May target skills
- UF_DANCE = 0x0100, // Dance
- UF_ENSEMBLE = 0x0200, // Duet
- UF_SONG = 0x0400, // Song
- UF_DUALMODE = 0x0800, // Spells should trigger both ontimer and onplace/onout/onleft effects.
- UF_RANGEDSINGLEUNIT = 0x2000 // hack for ranged layout, only display center
+ UF_DEFNOTENEMY = 0x0001, // If 'defunit_not_enemy' is set, the target is changed to 'friend'
+ UF_NOREITERATION = 0x0002, // Spell cannot be stacked
+ UF_NOFOOTSET = 0x0004, // Spell cannot be cast near/on targets
+ UF_NOOVERLAP = 0x0008, // Spell effects do not overlap
+ UF_PATHCHECK = 0x0010, // Only cells with a shootable path will be placed
+ UF_NOPC = 0x0020, // May not target players
+ UF_NOMOB = 0x0040, // May not target mobs
+ UF_SKILL = 0x0080, // May target skills
+ UF_DANCE = 0x0100, // Dance
+ UF_ENSEMBLE = 0x0200, // Duet
+ UF_SONG = 0x0400, // Song
+ UF_DUALMODE = 0x0800, // Spells should trigger both ontimer and onplace/onout/onleft effects.
+ UF_RANGEDSINGLEUNIT = 0x2000 // Hack for ranged layout, only display center
};
//Returns the cast type of the skill: ground cast, castend damage, castend no damage
diff --git a/src/map/status.c b/src/map/status.c
index b7e906910..09350fff0 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1109,7 +1109,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
}
if (target->type == BL_SKILL)
- return skill->unit_ondamaged((struct skill_unit *)target, src, hp, gettick());
+ return skill->unit_ondamaged((struct skill_unit *)target, src, hp, iTimer->gettick());
status = status_get_status_data(target);
if( status == &dummy_status )
@@ -1199,7 +1199,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
}
switch (target->type) {
- case BL_PC: pc_damage((TBL_PC*)target,src,hp,sp); break;
+ case BL_PC: iPc->damage((TBL_PC*)target,src,hp,sp); break;
case BL_MOB: mob_damage((TBL_MOB*)target, src, hp); break;
case BL_HOM: homun->damaged((TBL_HOM*)target); break;
case BL_MER: mercenary_heal((TBL_MER*)target,hp,sp); break;
@@ -1213,7 +1213,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
if( status->hp || (flag&8) )
{ //Still lives or has been dead before this damage.
if (walkdelay)
- unit_set_walkdelay(target, gettick(), walkdelay, 0);
+ unit_set_walkdelay(target, iTimer->gettick(), walkdelay, 0);
return hp+sp;
}
@@ -1224,7 +1224,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
//&2: Also remove object from map.
//&4: Also delete object from memory.
switch (target->type) {
- case BL_PC: flag = pc_dead((TBL_PC*)target,src); break;
+ case BL_PC: flag = iPc->dead((TBL_PC*)target,src); break;
case BL_MOB: flag = mob_dead((TBL_MOB*)target, src, flag&4?3:0); break;
case BL_HOM: flag = homun->dead((TBL_HOM*)target); break;
case BL_MER: flag = mercenary_dead((TBL_MER*)target); break;
@@ -1303,7 +1303,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s
unit_stop_walking(target,1);
unit_skillcastcancel(target,0);
clif->clearunit_area(target,CLR_DEAD);
- skill->unit_move(target,gettick(),4);
+ skill->unit_move(target,iTimer->gettick(),4);
skill->cleartimerskill(target);
}
@@ -1370,7 +1370,7 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag)
// send hp update to client
switch(bl->type) {
- case BL_PC: pc_heal((TBL_PC*)bl,hp,sp,flag&2?1:0); break;
+ case BL_PC: iPc->heal((TBL_PC*)bl,hp,sp,flag&2?1:0); break;
case BL_MOB: mob_heal((TBL_MOB*)bl,hp); break;
case BL_HOM: homun->healed((TBL_HOM*)bl); break;
case BL_MER: mercenary_heal((TBL_MER*)bl,hp,sp); break;
@@ -1474,7 +1474,7 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per
if (bl->prev) //Animation only if character is already on a map.
clif->resurrection(bl, 1);
switch (bl->type) {
- case BL_PC: pc_revive((TBL_PC*)bl, hp, sp); break;
+ case BL_PC: iPc->revive((TBL_PC*)bl, hp, sp); break;
case BL_MOB: mob_revive((TBL_MOB*)bl, hp); break;
case BL_HOM: homun->revive((TBL_HOM*)bl, hp, sp); break;
}
@@ -1547,7 +1547,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
break;
case AL_TELEPORT:
//Should fail when used on top of Land Protector [Skotlex]
- if (src && map_getcell(src->m, src->x, src->y, CELL_CHKLANDPROTECTOR)
+ if (src && iMap->getcell(src->m, src->x, src->y, CELL_CHKLANDPROTECTOR)
&& !(status->mode&MD_BOSS)
&& (src->type != BL_PC || ((TBL_PC*)src)->skillitem != skill_id))
return 0;
@@ -1578,7 +1578,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
if (sc->data[SC_WINKCHARM] && target && !flag) { //Prevents skill usage
if( unit_bl2ud(src) && (unit_bl2ud(src))->walktimer == INVALID_TIMER )
- unit_walktobl(src, map_id2bl(sc->data[SC_WINKCHARM]->val2), 3, 1);
+ unit_walktobl(src, iMap->id2bl(sc->data[SC_WINKCHARM]->val2), 3, 1);
clif->emotion(src, E_LV);
return 0;
}
@@ -1597,7 +1597,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
if (sc->data[SC_DANCING] && flag!=2) {
if( src->type == BL_PC && skill_id >= WA_SWING_DANCE && skill_id <= WM_UNLIMITED_HUMMING_VOICE )
{ // Lvl 5 Lesson or higher allow you use 3rd job skills while dancing.v
- if( pc_checkskill((TBL_PC*)src,WM_LESSON) < 5 )
+ if( iPc->checkskill((TBL_PC*)src,WM_LESSON) < 5 )
return 0;
} else if(sc->data[SC_LONGING]) { //Allow everything except dancing/re-dancing. [Skotlex]
if (skill_id == BD_ENCORE ||
@@ -1813,21 +1813,21 @@ int status_base_amotion_pc(struct map_session_data* sd, struct status_data* stat
}
amotion = ( sd->status.weapon < MAX_WEAPON_TYPE && mod < 0 )
- ? (aspd_base[pc_class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
- : ((aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype2] // dual-wield
- + aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype2]) * 6 / 10 + 10 * mod
- - aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype2]
- + aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype1]);
+ ? (aspd_base[iPc->class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
+ : ((aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype2] // dual-wield
+ + aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype2]) * 6 / 10 + 10 * mod
+ - aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype2]
+ + aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype1]);
if ( sd->status.shield )
- amotion += ( 2000 - aspd_base[pc_class2idx(sd->status.class_)][W_FIST] ) +
- ( aspd_base[pc_class2idx(sd->status.class_)][MAX_WEAPON_TYPE] - 2000 );
+ amotion += ( 2000 - aspd_base[iPc->class2idx(sd->status.class_)][W_FIST] ) +
+ ( aspd_base[iPc->class2idx(sd->status.class_)][MAX_WEAPON_TYPE] - 2000 );
#else
// base weapon delay
amotion = (sd->status.weapon < MAX_WEAPON_TYPE)
- ? (aspd_base[pc_class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
- : (aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype1] + aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype2])*7/10; // dual-wield
+ ? (aspd_base[iPc->class2idx(sd->status.class_)][sd->status.weapon]) // single weapon
+ : (aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype1] + aspd_base[iPc->class2idx(sd->status.class_)][sd->weapontype2])*7/10; // dual-wield
// percentual delay reduction from stats
amotion -= amotion * (4*status->agi + status->dex)/1000;
@@ -2008,7 +2008,7 @@ int status_calc_mob_(struct mob_data* md, bool first)
memcpy(status, &md->db->status, sizeof(struct status_data));
if (flag&(8|16))
- mbl = map_id2bl(md->master_id);
+ mbl = iMap->id2bl(md->master_id);
if (flag&8 && mbl) {
struct status_data *mstatus = status_get_base_status(mbl);
@@ -2222,12 +2222,12 @@ static void status_calc_sigma(void)
/// f(x) = 35 + x*(A + B*C/D) + sum(i=2..x){ i*C/D }
static unsigned int status_base_pc_maxhp(struct map_session_data* sd, struct status_data* status)
{
- uint64 val = pc_class2idx(sd->status.class_);
+ uint64 val = iPc->class2idx(sd->status.class_);
val = 35 + sd->status.base_level*(int64)hp_coefficient2[val]/100 + hp_sigma_val[val][sd->status.base_level];
if((sd->class_&MAPID_UPPERMASK) == MAPID_NINJA || (sd->class_&MAPID_UPPERMASK) == MAPID_GUNSLINGER)
val += 100; //Since their HP can't be approximated well enough without this.
- if((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc_famerank(sd->status.char_id, MAPID_TAEKWON))
+ if((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON))
val *= 3; //Triple max HP for top ranking Taekwons over level 90.
if((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.base_level >= 99)
val += 2000; //Supernovice lvl99 hp bonus.
@@ -2245,14 +2245,14 @@ static unsigned int status_base_pc_maxsp(struct map_session_data* sd, struct sta
{
uint64 val;
- val = 10 + sd->status.base_level*(int64)sp_coefficient[pc_class2idx(sd->status.class_)]/100;
+ val = 10 + sd->status.base_level*(int64)sp_coefficient[iPc->class2idx(sd->status.class_)]/100;
val += val * status->int_/100;
if (sd->class_&JOBL_UPPER)
val += val * 25/100;
else if (sd->class_&JOBL_BABY)
val -= val * 30/100;
- if ((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc_famerank(sd->status.char_id, MAPID_TAEKWON))
+ if ((sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && iPc->famerank(sd->status.char_id, MAPID_TAEKWON))
val *= 3; //Triple max SP for top ranking Taekwons over level 90.
return (unsigned int)val;
@@ -2279,9 +2279,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
b_max_weight = sd->max_weight;
b_cart_weight_max = sd->cart_weight_max;
- pc_calc_skilltree(sd); // SkillTree calculation
+ iPc->calc_skilltree(sd); // SkillTree calculation
- sd->max_weight = max_weight_base[pc_class2idx(sd->status.class_)]+sd->status.str*300;
+ sd->max_weight = max_weight_base[iPc->class2idx(sd->status.class_)]+sd->status.str*300;
if(first) {
//Load Hp/SP from char-received data.
@@ -2410,9 +2410,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
memset (&sd->bonus, 0,sizeof(sd->bonus));
// Autobonus
- pc_delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),true);
- pc_delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),true);
- pc_delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
+ iPc->delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),true);
+ iPc->delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),true);
+ iPc->delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),true);
// Parse equipment.
for(i=0;i<EQI_MAX-1;i++) {
@@ -2498,7 +2498,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
{ // Forged weapon
wd->star += (sd->status.inventory[index].card[1]>>8);
if(wd->star >= 15) wd->star = 40; // 3 Star Crumbs now give +40 dmg
- if(pc_famerank(MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) ,MAPID_BLACKSMITH))
+ if(iPc->famerank(MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) ,MAPID_BLACKSMITH))
wd->star += 10;
if (!wa->ele) //Do not overwrite element from previous bonuses.
@@ -2584,7 +2584,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
continue;
for(k = 0; k < map[sd->bl.m].zone->disabled_items_count; k++) {
- if( map[sd->bl.m].zone->disabled_items[k] == sd->inventory_data[index]->nameid ) {
+ if( map[sd->bl.m].zone->disabled_items[k] == data->nameid ) {
break;
}
}
@@ -2617,7 +2617,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
if( pd && pd->petDB && pd->petDB->equip_script && pd->pet.intimate >= battle_config.pet_equip_min_friendly )
run_script(pd->petDB->equip_script,0,sd->bl.id,0);
if( pd && pd->pet.intimate > 0 && (!battle_config.pet_equip_required || pd->pet.equip > 0) && pd->state.skillbonus == 1 && pd->bonus )
- pc_bonus(sd,pd->bonus->type, pd->bonus->val);
+ iPc->bonus(sd,pd->bonus->type, pd->bonus->val);
}
//param_bonus now holds card bonuses.
@@ -2649,7 +2649,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// ----- STATS CALCULATION -----
// Job bonuses
- index = pc_class2idx(sd->status.class_);
+ index = iPc->class2idx(sd->status.class_);
for(i=0;i<(int)sd->status.job_level && i<MAX_LEVEL;i++){
if(!job_bonus[index][i])
continue;
@@ -2674,13 +2674,13 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
}
// Absolute modifiers from passive skills
- if(pc_checkskill(sd,BS_HILTBINDING)>0)
+ if(iPc->checkskill(sd,BS_HILTBINDING)>0)
status->str++;
- if((skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0)
+ if((skill=iPc->checkskill(sd,SA_DRAGONOLOGY))>0)
status->int_ += (skill+1)/2; // +1 INT / 2 lv
- if((skill=pc_checkskill(sd,AC_OWL))>0)
+ if((skill=iPc->checkskill(sd,AC_OWL))>0)
status->dex += skill;
- if((skill = pc_checkskill(sd,RA_RESEARCHTRAP))>0)
+ if((skill = iPc->checkskill(sd,RA_RESEARCHTRAP))>0)
status->int_ += skill;
// Bonuses from cards and equipment as well as base stat, remember to avoid overflows.
@@ -2704,7 +2704,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
if (sd->status.weapon < MAX_WEAPON_TYPE && sd->weapon_atk[sd->status.weapon])
status->batk += sd->weapon_atk[sd->status.weapon];
// Absolute modifiers from passive skills
- if((skill=pc_checkskill(sd,BS_HILTBINDING))>0)
+ if((skill=iPc->checkskill(sd,BS_HILTBINDING))>0)
status->batk += 4;
// ----- HP MAX CALCULATION -----
@@ -2717,7 +2717,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
status->max_hp = (unsigned int)cap_value(i64, 0, INT_MAX);
// Absolute modifiers from passive skills
- if((skill=pc_checkskill(sd,CR_TRUST))>0)
+ if((skill=iPc->checkskill(sd,CR_TRUST))>0)
status->max_hp += skill*200;
// Apply relative modifiers from equipment
@@ -2742,15 +2742,15 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
status->max_sp = (unsigned int)cap_value(i64, 0, INT_MAX);
// Absolute modifiers from passive skills
- if((skill=pc_checkskill(sd,SL_KAINA))>0)
+ if((skill=iPc->checkskill(sd,SL_KAINA))>0)
status->max_sp += 30*skill;
- if((skill=pc_checkskill(sd,HP_MEDITATIO))>0)
+ if((skill=iPc->checkskill(sd,HP_MEDITATIO))>0)
status->max_sp += (int64)status->max_sp * skill/100;
- if((skill=pc_checkskill(sd,HW_SOULDRAIN))>0)
+ if((skill=iPc->checkskill(sd,HW_SOULDRAIN))>0)
status->max_sp += (int64)status->max_sp * 2*skill/100;
- if( (skill = pc_checkskill(sd,RA_RESEARCHTRAP)) > 0 )
+ if( (skill = iPc->checkskill(sd,RA_RESEARCHTRAP)) > 0 )
status->max_sp += 200 + 20 * skill;
- if( (skill = pc_checkskill(sd,WM_LESSON)) > 0 )
+ if( (skill = iPc->checkskill(sd,WM_LESSON)) > 0 )
status->max_sp += 30 * skill;
@@ -2834,9 +2834,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// ----- HIT CALCULATION -----
// Absolute modifiers from passive skills
- if((skill=pc_checkskill(sd,BS_WEAPONRESEARCH))>0)
+ if((skill=iPc->checkskill(sd,BS_WEAPONRESEARCH))>0)
status->hit += skill*2;
- if((skill=pc_checkskill(sd,AC_VULTURE))>0){
+ if((skill=iPc->checkskill(sd,AC_VULTURE))>0){
#ifndef RENEWAL
status->hit += skill;
#endif
@@ -2845,9 +2845,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
}
if(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE)
{
- if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0)
+ if((skill=iPc->checkskill(sd,GS_SINGLEACTION))>0)
status->hit += 2*skill;
- if((skill=pc_checkskill(sd,GS_SNAKEEYE))>0) {
+ if((skill=iPc->checkskill(sd,GS_SNAKEEYE))>0) {
status->hit += skill;
status->rhw.range += skill;
}
@@ -2856,9 +2856,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// ----- FLEE CALCULATION -----
// Absolute modifiers from passive skills
- if((skill=pc_checkskill(sd,TF_MISS))>0)
+ if((skill=iPc->checkskill(sd,TF_MISS))>0)
status->flee += skill*(sd->class_&JOBL_2 && (sd->class_&MAPID_BASEMASK) == MAPID_THIEF? 4 : 3);
- if((skill=pc_checkskill(sd,MO_DODGE))>0)
+ if((skill=iPc->checkskill(sd,MO_DODGE))>0)
status->flee += (skill*3)>>1;
// ----- EQUIPMENT-DEF CALCULATION -----
@@ -2905,29 +2905,29 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// Relative modifiers from passive skills
#ifndef RENEWAL_ASPD
- if((skill=pc_checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
+ if((skill=iPc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
status->aspd_rate -= 5*skill;
- if((skill = pc_checkskill(sd,SG_DEVIL)) > 0 && !pc_nextjobexp(sd))
+ if((skill = iPc->checkskill(sd,SG_DEVIL)) > 0 && !iPc->nextjobexp(sd))
status->aspd_rate -= 30*skill;
- if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0 &&
+ if((skill=iPc->checkskill(sd,GS_SINGLEACTION))>0 &&
(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
status->aspd_rate -= ((skill+1)/2) * 10;
if(pc_isriding(sd))
- status->aspd_rate += 500-100*pc_checkskill(sd,KN_CAVALIERMASTERY);
+ status->aspd_rate += 500-100*iPc->checkskill(sd,KN_CAVALIERMASTERY);
else if(pc_isridingdragon(sd))
- status->aspd_rate += 250-50*pc_checkskill(sd,RK_DRAGONTRAINING);
+ status->aspd_rate += 250-50*iPc->checkskill(sd,RK_DRAGONTRAINING);
#else // needs more info
- if((skill=pc_checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
+ if((skill=iPc->checkskill(sd,SA_ADVANCEDBOOK))>0 && sd->status.weapon == W_BOOK)
status->aspd_rate += 5*skill;
- if((skill = pc_checkskill(sd,SG_DEVIL)) > 0 && !pc_nextjobexp(sd))
+ if((skill = iPc->checkskill(sd,SG_DEVIL)) > 0 && !iPc->nextjobexp(sd))
status->aspd_rate += 30*skill;
- if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0 &&
+ if((skill=iPc->checkskill(sd,GS_SINGLEACTION))>0 &&
(sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE))
status->aspd_rate += ((skill+1)/2) * 10;
if(pc_isriding(sd))
- status->aspd_rate -= 500-100*pc_checkskill(sd,KN_CAVALIERMASTERY);
+ status->aspd_rate -= 500-100*iPc->checkskill(sd,KN_CAVALIERMASTERY);
else if(pc_isridingdragon(sd))
- status->aspd_rate -= 250-50*pc_checkskill(sd,RK_DRAGONTRAINING);
+ status->aspd_rate -= 250-50*iPc->checkskill(sd,RK_DRAGONTRAINING);
#endif
status->adelay = 2*status->amotion;
@@ -2942,26 +2942,26 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
// ----- MISC CALCULATIONS -----
// Weight
- if((skill=pc_checkskill(sd,MC_INCCARRY))>0)
+ if((skill=iPc->checkskill(sd,MC_INCCARRY))>0)
sd->max_weight += 2000*skill;
- if(pc_isriding(sd) && pc_checkskill(sd,KN_RIDING)>0)
+ if(pc_isriding(sd) && iPc->checkskill(sd,KN_RIDING)>0)
sd->max_weight += 10000;
else if(pc_isridingdragon(sd))
- sd->max_weight += 5000+2000*pc_checkskill(sd,RK_DRAGONTRAINING);
+ sd->max_weight += 5000+2000*iPc->checkskill(sd,RK_DRAGONTRAINING);
if(sc->data[SC_KNOWLEDGE])
sd->max_weight += sd->max_weight*sc->data[SC_KNOWLEDGE]->val1/10;
- if((skill=pc_checkskill(sd,ALL_INCCARRY))>0)
+ if((skill=iPc->checkskill(sd,ALL_INCCARRY))>0)
sd->max_weight += 2000*skill;
- sd->cart_weight_max = battle_config.max_cart_weight + (pc_checkskill(sd, GN_REMODELING_CART)*5000);
+ sd->cart_weight_max = battle_config.max_cart_weight + (iPc->checkskill(sd, GN_REMODELING_CART)*5000);
- if (pc_checkskill(sd,SM_MOVINGRECOVERY)>0)
+ if (iPc->checkskill(sd,SM_MOVINGRECOVERY)>0)
sd->regen.state.walk = 1;
else
sd->regen.state.walk = 0;
// Skill SP cost
- if((skill=pc_checkskill(sd,HP_MANARECHARGE))>0 )
+ if((skill=iPc->checkskill(sd,HP_MANARECHARGE))>0 )
sd->dsprate -= 4*skill;
if(sc->data[SC_SERVICE4U])
@@ -2983,17 +2983,17 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
sd->sprecov_rate = 0;
// Anti-element and anti-race
- if((skill=pc_checkskill(sd,CR_TRUST))>0)
+ if((skill=iPc->checkskill(sd,CR_TRUST))>0)
sd->subele[ELE_HOLY] += skill*5;
- if((skill=pc_checkskill(sd,BS_SKINTEMPER))>0) {
+ if((skill=iPc->checkskill(sd,BS_SKINTEMPER))>0) {
sd->subele[ELE_NEUTRAL] += skill;
sd->subele[ELE_FIRE] += skill*4;
}
- if((skill=pc_checkskill(sd,NC_RESEARCHFE))>0) {
+ if((skill=iPc->checkskill(sd,NC_RESEARCHFE))>0) {
sd->subele[ELE_EARTH] += skill*10;
sd->subele[ELE_FIRE] += skill*10;
}
- if((skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){
+ if((skill=iPc->checkskill(sd,SA_DRAGONOLOGY))>0 ){
skill = skill*4;
sd->right_weapon.addrace[RC_DRAGON]+=skill;
sd->left_weapon.addrace[RC_DRAGON]+=skill;
@@ -3077,7 +3077,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
clif->updatestatus(sd,SP_WEIGHT);
if(b_max_weight != sd->max_weight) {
clif->updatestatus(sd,SP_MAXWEIGHT);
- pc_updateweightstatus(sd);
+ iPc->updateweightstatus(sd);
}
if( b_cart_weight_max != sd->cart_weight_max ) {
clif->updatestatus(sd,SP_CARTINFO);
@@ -3324,7 +3324,7 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
if( sd )
{
struct regen_data_sub *sregen;
- if( (skill=pc_checkskill(sd,HP_MEDITATIO)) > 0 )
+ if( (skill=iPc->checkskill(sd,HP_MEDITATIO)) > 0 )
{
val = regen->sp*(100+3*skill)/100;
regen->sp = cap_value(val, 1, SHRT_MAX);
@@ -3333,16 +3333,16 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
sregen = regen->sregen;
val = 0;
- if( (skill=pc_checkskill(sd,SM_RECOVERY)) > 0 )
+ if( (skill=iPc->checkskill(sd,SM_RECOVERY)) > 0 )
val += skill*5 + skill*status->max_hp/500;
sregen->hp = cap_value(val, 0, SHRT_MAX);
val = 0;
- if( (skill=pc_checkskill(sd,MG_SRECOVERY)) > 0 )
+ if( (skill=iPc->checkskill(sd,MG_SRECOVERY)) > 0 )
val += skill*3 + skill*status->max_sp/500;
- if( (skill=pc_checkskill(sd,NJ_NINPOU)) > 0 )
+ if( (skill=iPc->checkskill(sd,NJ_NINPOU)) > 0 )
val += skill*3 + skill*status->max_sp/500;
- if( (skill=pc_checkskill(sd,WM_LESSON)) > 0 )
+ if( (skill=iPc->checkskill(sd,WM_LESSON)) > 0 )
val += 3 + 3 * skill;
sregen->sp = cap_value(val, 0, SHRT_MAX);
@@ -3351,21 +3351,21 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct
sregen = regen->ssregen;
val = 0;
- if( (skill=pc_checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
+ if( (skill=iPc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
val += skill*4 + skill*status->max_hp/500;
- if( (skill=pc_checkskill(sd,TK_HPTIME)) > 0 && sd->state.rest )
+ if( (skill=iPc->checkskill(sd,TK_HPTIME)) > 0 && sd->state.rest )
val += skill*30 + skill*status->max_hp/500;
sregen->hp = cap_value(val, 0, SHRT_MAX);
val = 0;
- if( (skill=pc_checkskill(sd,TK_SPTIME)) > 0 && sd->state.rest )
+ if( (skill=iPc->checkskill(sd,TK_SPTIME)) > 0 && sd->state.rest )
{
val += skill*3 + skill*status->max_sp/500;
- if ((skill=pc_checkskill(sd,SL_KAINA)) > 0) //Power up Enjoyable Rest
+ if ((skill=iPc->checkskill(sd,SL_KAINA)) > 0) //Power up Enjoyable Rest
val += (30+10*skill)*val/100;
}
- if( (skill=pc_checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
+ if( (skill=iPc->checkskill(sd,MO_SPIRITSRECOVERY)) > 0 )
val += skill*2 + skill*status->max_sp/500;
sregen->sp = cap_value(val, 0, SHRT_MAX);
}
@@ -5015,12 +5015,12 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
if (sd && sd->state.permanent_speed)
return (short)cap_value(speed,10,USHRT_MAX);
- if( sd && sd->ud.skilltimer != INVALID_TIMER && (pc_checkskill(sd,SA_FREECAST) > 0 || sd->ud.skill_id == LG_EXEEDBREAK) )
+ if( sd && sd->ud.skilltimer != INVALID_TIMER && (iPc->checkskill(sd,SA_FREECAST) > 0 || sd->ud.skill_id == LG_EXEEDBREAK) )
{
if( sd->ud.skill_id == LG_EXEEDBREAK )
speed_rate = 100 + 60 - (sd->ud.skill_lv * 10);
else
- speed_rate = 175 - 5 * pc_checkskill(sd,SA_FREECAST);
+ speed_rate = 175 - 5 * iPc->checkskill(sd,SA_FREECAST);
}
else
{
@@ -5036,9 +5036,9 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
if( pc_isriding(sd) || sd->sc.option&(OPTION_DRAGON) || sd->sc.data[SC_ALL_RIDING] )
val = 25;//Same bonus
else if( pc_isridingwug(sd) )
- val = 15 + 5 * pc_checkskill(sd, RA_WUGRIDER);
+ val = 15 + 5 * iPc->checkskill(sd, RA_WUGRIDER);
else if( pc_ismadogear(sd) ) {
- val = (- 10 * (5 - pc_checkskill(sd,NC_MADOLICENCE)));
+ val = (- 10 * (5 - iPc->checkskill(sd,NC_MADOLICENCE)));
if( sc->data[SC_ACCELERATION] )
val += 25;
}
@@ -5051,8 +5051,8 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
{
int val = 0;
- if( sd && sc->data[SC_HIDING] && pc_checkskill(sd,RG_TUNNELDRIVE) > 0 )
- val = 120 - 6 * pc_checkskill(sd,RG_TUNNELDRIVE);
+ if( sd && sc->data[SC_HIDING] && iPc->checkskill(sd,RG_TUNNELDRIVE) > 0 )
+ val = 120 - 6 * iPc->checkskill(sd,RG_TUNNELDRIVE);
else
if( sd && sc->data[SC_CHASEWALK] && sc->data[SC_CHASEWALK]->val3 < 0 )
val = sc->data[SC_CHASEWALK]->val3;
@@ -5063,7 +5063,7 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
val = max( val, 50 - 10 * sc->data[SC_LONGING]->val1 );
else
if( sd && sc->data[SC_DANCING] )
- val = max( val, 500 - (40 + 10 * (sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_BARDDANCER)) * pc_checkskill(sd,(sd->status.sex?BA_MUSICALLESSON:DC_DANCINGLESSON)) );
+ val = max( val, 500 - (40 + 10 * (sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_BARDDANCER)) * iPc->checkskill(sd,(sd->status.sex?BA_MUSICALLESSON:DC_DANCINGLESSON)) );
if( sc->data[SC_DECREASEAGI] )
val = max( val, 25 );
@@ -5129,8 +5129,8 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
val = max( val, 2 * sc->data[SC_WINDWALK]->val1 );
if( sc->data[SC_CARTBOOST] )
val = max( val, 20 );
- if( sd && (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN && pc_checkskill(sd,TF_MISS) > 0 )
- val = max( val, 1 * pc_checkskill(sd,TF_MISS) );
+ if( sd && (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN && iPc->checkskill(sd,TF_MISS) > 0 )
+ val = max( val, 1 * iPc->checkskill(sd,TF_MISS) );
if( sc->data[SC_CLOAKING] && (sc->data[SC_CLOAKING]->val4&1) == 1 )
val = max( val, sc->data[SC_CLOAKING]->val1 >= 10 ? 25 : 3 * sc->data[SC_CLOAKING]->val1 - 3 );
if (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST])
@@ -5168,7 +5168,7 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha
//GetSpeed()
{
if( sd && pc_iscarton(sd) )
- speed += speed * (50 - 5 * pc_checkskill(sd,MC_PUSHCART)) / 100;
+ speed += speed * (50 - 5 * iPc->checkskill(sd,MC_PUSHCART)) / 100;
if( sc->data[SC_PARALYSE] )
speed += speed * 50 / 100;
if( speed_rate != 100 )
@@ -5321,7 +5321,7 @@ static short status_calc_fix_aspd(struct block_list *bl, struct status_change *s
|| sc->data[SC_WILD_STORM_OPTION]))
aspd -= 50; // +5 ASPD
if( sc && sc->data[SC_FIGHTINGSPIRIT] && sc->data[SC_FIGHTINGSPIRIT]->val2 )
- aspd -= (bl->type==BL_PC?pc_checkskill((TBL_PC *)bl, RK_RUNEMASTERY):10) / 10 * 40;
+ aspd -= (bl->type==BL_PC?iPc->checkskill((TBL_PC *)bl, RK_RUNEMASTERY):10) / 10 * 40;
return cap_value(aspd, 0, 2000); // will be recap for proper bl anyway
}
@@ -5784,7 +5784,7 @@ int status_get_party_id(struct block_list *bl) {
struct mob_data *md=(TBL_MOB*)bl;
if( md->master_id > 0 ) {
struct map_session_data *msd;
- if (md->special_state.ai && (msd = map_id2sd(md->master_id)) != NULL)
+ if (md->special_state.ai && (msd = iMap->id2sd(md->master_id)) != NULL)
return msd->status.party_id;
return -md->master_id;
}
@@ -5822,7 +5822,7 @@ int status_get_guild_id(struct block_list *bl) {
struct mob_data *md = (struct mob_data *)bl;
if (md->guardian_data) //Guardian's guild [Skotlex]
return md->guardian_data->guild_id;
- if (md->special_state.ai && (msd = map_id2sd(md->master_id)) != NULL)
+ if (md->special_state.ai && (msd = iMap->id2sd(md->master_id)) != NULL)
return msd->status.guild_id; //Alchemist's mobs [Skotlex]
}
break;
@@ -5862,7 +5862,7 @@ int status_get_emblem_id(struct block_list *bl) {
struct mob_data *md = (struct mob_data *)bl;
if (md->guardian_data) //Guardian's guild [Skotlex]
return md->guardian_data->emblem_id;
- if (md->special_state.ai && (msd = map_id2sd(md->master_id)) != NULL)
+ if (md->special_state.ai && (msd = iMap->id2sd(md->master_id)) != NULL)
return msd->guild_emblem_id; //Alchemist's mobs [Skotlex]
}
break;
@@ -6079,14 +6079,15 @@ void status_set_viewdata(struct block_list *bl, int class_)
/// Returns the status_change data of bl or NULL if it doesn't exist.
struct status_change *status_get_sc(struct block_list *bl) {
- if( bl )
- switch (bl->type) {
- case BL_PC: return &((TBL_PC*)bl)->sc;
- case BL_MOB: return &((TBL_MOB*)bl)->sc;
- case BL_NPC: return &((TBL_NPC*)bl)->sc;
- case BL_HOM: return &((TBL_HOM*)bl)->sc;
- case BL_MER: return &((TBL_MER*)bl)->sc;
- case BL_ELEM: return &((TBL_ELEM*)bl)->sc;
+ if( bl ) {
+ switch (bl->type) {
+ case BL_PC: return &((TBL_PC*)bl)->sc;
+ case BL_MOB: return &((TBL_MOB*)bl)->sc;
+ case BL_NPC: return NULL;
+ case BL_HOM: return &((TBL_HOM*)bl)->sc;
+ case BL_MER: return &((TBL_MER*)bl)->sc;
+ case BL_ELEM: return &((TBL_ELEM*)bl)->sc;
+ }
}
return NULL;
}
@@ -6602,7 +6603,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_INCREASEAGI:
if(sd && pc_issit(sd)){
- pc_setstand(sd);
+ iPc->setstand(sd);
}
case SC_CONCENTRATE:
@@ -6621,7 +6622,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
//Due to the cloaking card, we have to check the wall versus to known
//skill level rather than the used one. [Skotlex]
//if (sd && val1 < 3 && skill_check_cloaking(bl,NULL))
- if( sd && pc_checkskill(sd, AS_CLOAKING) < 3 && !skill->check_cloaking(bl,NULL) )
+ if( sd && iPc->checkskill(sd, AS_CLOAKING) < 3 && !skill->check_cloaking(bl,NULL) )
return 0;
break;
case SC_MODECHANGE:
@@ -6656,7 +6657,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
i = sd->equip_index[EQI_HAND_R];
if (i>=0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_WEAPON) {
opt_flag|=2;
- pc_unequipitem(sd,i,3);
+ iPc->unequipitem(sd,i,3);
}
if (!opt_flag) return 0;
}
@@ -6672,7 +6673,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
i = sd->equip_index[EQI_HAND_L];
if ( i < 0 || !sd->inventory_data[i] || sd->inventory_data[i]->type != IT_ARMOR )
return 0;
- pc_unequipitem(sd,i,3);
+ iPc->unequipitem(sd,i,3);
}
if (tick == 1) return 1; //Minimal duration: Only strip without causing the SC
break;
@@ -6684,7 +6685,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
i = sd->equip_index[EQI_ARMOR];
if ( i < 0 || !sd->inventory_data[i] )
return 0;
- pc_unequipitem(sd,i,3);
+ iPc->unequipitem(sd,i,3);
}
if (tick == 1) return 1; //Minimal duration: Only strip without causing the SC
break;
@@ -6696,7 +6697,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
i = sd->equip_index[EQI_HEAD_TOP];
if ( i < 0 || !sd->inventory_data[i] )
return 0;
- pc_unequipitem(sd,i,3);
+ iPc->unequipitem(sd,i,3);
}
if (tick == 1) return 1; //Minimal duration: Only strip without causing the SC
break;
@@ -6757,7 +6758,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
return 0;
break;
case SC_CAMOUFLAGE:
- if( sd && pc_checkskill(sd, RA_CAMOUFLAGE) < 3 && !skill->check_camouflage(bl,NULL) )
+ if( sd && iPc->checkskill(sd, RA_CAMOUFLAGE) < 3 && !skill->check_camouflage(bl,NULL) )
return 0;
break;
case SC__STRIPACCESSORY:
@@ -6766,11 +6767,11 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if( !(sd->bonus.unstripable_equip&EQI_ACC_L) ) {
i = sd->equip_index[EQI_ACC_L];
if( i >= 0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_ARMOR )
- pc_unequipitem(sd,i,3); //L-Accessory
+ iPc->unequipitem(sd,i,3); //L-Accessory
} if( !(sd->bonus.unstripable_equip&EQI_ACC_R) ) {
i = sd->equip_index[EQI_ACC_R];
if( i >= 0 && sd->inventory_data[i] && sd->inventory_data[i]->type == IT_ARMOR )
- pc_unequipitem(sd,i,3); //R-Accessory
+ iPc->unequipitem(sd,i,3); //R-Accessory
}
if( i < 0 )
return 0;
@@ -7141,7 +7142,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
//Kaahi overwrites previous level regardless of existing level.
//Delete timer if it exists.
if (sce->val4 != INVALID_TIMER) {
- delete_timer(sce->val4,kaahi_heal_timer);
+ iTimer->delete_timer(sce->val4,kaahi_heal_timer);
sce->val4 = INVALID_TIMER;
}
break;
@@ -7190,7 +7191,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
int i;
for( i = 0; i < 5; i++ )
{
- if( sd->devotion[i] && (tsd = map_id2sd(sd->devotion[i])) )
+ if( sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])) )
status_change_start(&tsd->bl, type, 10000, val1, val2, val3, val4, tick, 1);
}
}
@@ -7222,7 +7223,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val3 = 50*(val1+1); //Damage increase (+50 +50*lv%)
#endif
if( sd )//[Ind] - iROwiki says each level increases its duration by 3 seconds
- tick += pc_checkskill(sd,GC_RESEARCHNEWPOISON)*3000;
+ tick += iPc->checkskill(sd,GC_RESEARCHNEWPOISON)*3000;
break;
case SC_POISONREACT:
val2=(val1+1)/2 + val1/10; // Number of counters [Skotlex]
@@ -7281,7 +7282,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
int i;
for( i = 0; i < 5; i++ )
{
- if( sd->devotion[i] && (tsd = map_id2sd(sd->devotion[i])) )
+ if( sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])) )
status_change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
}
}
@@ -7416,7 +7417,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
if (status->hp - diff < status->max_hp>>2)
diff = status->hp - (status->max_hp>>2);
if( val2 && bl->type == BL_MOB ) {
- struct block_list* src = map_id2bl(val2);
+ struct block_list* src = iMap->id2bl(val2);
if( src )
mob_log_damage((TBL_MOB*)bl,src,diff);
}
@@ -7456,7 +7457,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_BOSSMAPINFO:
if( sd != NULL )
{
- struct mob_data *boss_md = map_getmob_boss(bl->m); // Search for Boss on this Map
+ struct mob_data *boss_md = iMap->getmob_boss(bl->m); // Search for Boss on this Map
if( boss_md == NULL || boss_md->bl.prev == NULL )
{ // No MVP on this map - MVP is dead
clif->bossmapinfo(sd->fd, boss_md, 1);
@@ -7538,7 +7539,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
{
for( i = 0; i < 5; i++ )
{
- if( sd->devotion[i] && (tsd = map_id2sd(sd->devotion[i])) )
+ if( sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])) )
status_change_start(&tsd->bl, type, 10000, val1, val2, 0, 0, tick, 1);
}
}
@@ -7561,7 +7562,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
int i;
for (i = 0; i < 5; i++)
{ //See if there are devoted characters, and pass the status to them. [Skotlex]
- if (sd->devotion[i] && (tsd = map_id2sd(sd->devotion[i])))
+ if (sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])))
status_change_start(&tsd->bl,type,10000,val1,5+val1*5,val3,val4,tick,1);
}
}
@@ -7630,7 +7631,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
{
int stat,max_stat;
// fetch caster information
- struct block_list *pbl = map_id2bl(val1);
+ struct block_list *pbl = iMap->id2bl(val1);
struct status_change *psc = pbl?status_get_sc(pbl):NULL;
struct status_change_entry *psce = psc?psc->data[SC_MARIONETTE]:NULL;
// fetch target's stats
@@ -7679,7 +7680,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
struct block_list *d_bl;
struct status_change *d_sc;
- if( (d_bl = map_id2bl(val1)) && (d_sc = status_get_sc(d_bl)) && d_sc->count )
+ if( (d_bl = iMap->id2bl(val1)) && (d_sc = status_get_sc(d_bl)) && d_sc->count )
{ // Inherits Status From Source
const enum sc_type types[] = { SC_AUTOGUARD, SC_DEFENDER, SC_REFLECTSHIELD, SC_ENDURE };
enum sc_type type2;
@@ -7697,7 +7698,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_COMA: //Coma. Sends a char to 1HP. If val2, do not zap sp
if( val3 && bl->type == BL_MOB ) {
- struct block_list* src = map_id2bl(val3);
+ struct block_list* src = iMap->id2bl(val3);
if( src )
mob_log_damage((TBL_MOB*)bl,src,status->hp - 1);
}
@@ -7706,7 +7707,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
break;
case SC_CLOSECONFINE2:
{
- struct block_list *src = val2?map_id2bl(val2):NULL;
+ struct block_list *src = val2?iMap->id2bl(val2):NULL;
struct status_change *sc2 = src?status_get_sc(src):NULL;
struct status_change_entry *sce2 = sc2?sc2->data[SC_CLOSECONFINE]:NULL;
if (src && sc2) {
@@ -7714,8 +7715,8 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
sc_start4(src,SC_CLOSECONFINE,100,val1,1,0,0,tick+1000);
else { //Increase count of locked enemies and refresh time.
(sce2->val2)++;
- delete_timer(sce2->timer, status_change_timer);
- sce2->timer = add_timer(gettick()+tick+1000, status_change_timer, src->id, SC_CLOSECONFINE);
+ iTimer->delete_timer(sce2->timer, status_change_timer);
+ sce2->timer = iTimer->add_timer(iTimer->gettick()+tick+1000, status_change_timer, src->id, SC_CLOSECONFINE);
}
} else //Status failed.
return 0;
@@ -7749,8 +7750,8 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
struct unit_data *ud = unit_bl2ud(bl);
if (ud && !val3) {
tick += 300 * battle_config.combo_delay_rate/100;
- ud->attackabletime = gettick()+tick;
- unit_set_walkdelay(bl, gettick(), tick, 1);
+ ud->attackabletime = iTimer->gettick()+tick;
+ unit_set_walkdelay(bl, iTimer->gettick(), tick, 1);
}
val3 = 0;
val4 = tick;
@@ -7760,7 +7761,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val2 = 11-val1; //Chance to consume: 11-skill_lv%
break;
case SC_RUN:
- val4 = gettick(); //Store time at which you started running.
+ val4 = iTimer->gettick(); //Store time at which you started running.
tick = -1;
break;
case SC_KAAHI:
@@ -7793,14 +7794,14 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_OVERTHRUST:
//val2 holds if it was casted on self, or is bonus received from others
val3 = 5*val1; //Power increase
- if(sd && pc_checkskill(sd,BS_HILTBINDING)>0)
+ if(sd && iPc->checkskill(sd,BS_HILTBINDING)>0)
tick += tick / 10;
break;
case SC_ADRENALINE2:
case SC_ADRENALINE:
val3 = (val2) ? 300 : 200; // aspd increase
case SC_WEAPONPERFECTION:
- if(sd && pc_checkskill(sd,BS_HILTBINDING)>0)
+ if(sd && iPc->checkskill(sd,BS_HILTBINDING)>0)
tick += tick / 10;
break;
case SC_CONCENTRATION:
@@ -7888,7 +7889,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
int pos = (bl->x&0xFFFF)|(bl->y<<16), //Current Coordinates
map = sd->mapindex; //Current Map
//1. Place in Jail (val2 -> Jail Map, val3 -> x, val4 -> y
- pc_setpos(sd,(unsigned short)val2,val3,val4, CLR_TELEPORT);
+ iPc->setpos(sd,(unsigned short)val2,val3,val4, CLR_TELEPORT);
//2. Set restore point (val3 -> return map, val4 return coords
val3 = map;
val4 = pos;
@@ -8032,7 +8033,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
break;
case SC_STONEHARDSKIN:
if( sd )
- val1 = sd->status.job_level * pc_checkskill(sd, RK_RUNEMASTERY) / 4; //DEF/MDEF Increase
+ val1 = sd->status.job_level * iPc->checkskill(sd, RK_RUNEMASTERY) / 4; //DEF/MDEF Increase
break;
case SC_FIGHTINGSPIRIT:
val_flag |= 1|2;
@@ -8154,11 +8155,11 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
tick_time = 1000; // [GodLesZ] tick time
break;
case SC_WUGDASH:
- val4 = gettick(); //Store time at which you started running.
+ val4 = iTimer->gettick(); //Store time at which you started running.
tick = -1;
break;
case SC__SHADOWFORM: {
- struct map_session_data * s_sd = map_id2sd(val2);
+ struct map_session_data * s_sd = iMap->id2sd(val2);
if( s_sd )
s_sd->shadowform_id = bl->id;
val4 = tick / 1000;
@@ -8180,18 +8181,18 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC__ENERVATION:
val2 = 20 + 10 * val1; // ATK Reduction
val_flag |= 1|2;
- if( sd ) pc_delspiritball(sd,sd->spiritball,0);
+ if( sd ) iPc->delspiritball(sd,sd->spiritball,0);
break;
case SC__GROOMY:
val2 = 20 + 10 * val1; //ASPD. Need to confirm if Movement Speed reduction is the same. [Jobbie]
val3 = 20 * val1; //HIT
val_flag |= 1|2|4;
if( sd ) { // Removes Animals
- if( pc_isriding(sd) ) pc_setriding(sd, 0);
- if( pc_isridingdragon(sd) ) pc_setoption(sd, sd->sc.option&~OPTION_DRAGON);
- if( pc_iswug(sd) ) pc_setoption(sd, sd->sc.option&~OPTION_WUG);
- if( pc_isridingwug(sd) ) pc_setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
- if( pc_isfalcon(sd) ) pc_setoption(sd, sd->sc.option&~OPTION_FALCON);
+ if( pc_isriding(sd) ) iPc->setriding(sd, 0);
+ if( pc_isridingdragon(sd) ) iPc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
+ if( pc_iswug(sd) ) iPc->setoption(sd, sd->sc.option&~OPTION_WUG);
+ if( pc_isridingwug(sd) ) iPc->setoption(sd, sd->sc.option&~OPTION_WUGRIDER);
+ if( pc_isfalcon(sd) ) iPc->setoption(sd, sd->sc.option&~OPTION_FALCON);
if( sd->status.pet_id > 0 ) pet_menu(sd, 3);
if( homun_alive(sd->hd) ) homun->vaporize(sd,1);
if( sd->md ) merc_delete(sd->md,3);
@@ -8291,13 +8292,13 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val3 = 15 + 5 * val1; // ASPD reduction.
if( sd && rand()%100 < val1 ){ // (Skill Lv) %
val4 = 1; // reduce walk speed by half.
- if( pc_isriding(sd) ) pc_setriding(sd, 0);
- if( pc_isridingdragon(sd) ) pc_setoption(sd, sd->sc.option&~OPTION_DRAGON);
+ if( pc_isriding(sd) ) iPc->setriding(sd, 0);
+ if( pc_isridingdragon(sd) ) iPc->setoption(sd, sd->sc.option&~OPTION_DRAGON);
}
break;
case SC_GLOOMYDAY_SK:
// Random number between [15 ~ (Voice Lesson Skill Level x 5) + (Skill Level x 10)] %.
- val2 = 15 + rand()%( (sd?pc_checkskill(sd, WM_LESSON)*5:0) + val1*10 );
+ val2 = 15 + rand()%( (sd?iPc->checkskill(sd, WM_LESSON)*5:0) + val1*10 );
break;
case SC_SITDOWN_FORCE:
case SC_BANANA_BOMB_SITDOWN:
@@ -8354,7 +8355,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
val2 = ((status->int_ + status->luk) / 6) + 5; // Chance to evade magic damage.
val1 *= 15; // Defence added
if( sd )
- val1 += 10 * pc_checkskill(sd,CR_DEFENDER);
+ val1 += 10 * iPc->checkskill(sd,CR_DEFENDER);
val_flag |= 1|2;
break;
case SC_BANDING:
@@ -8400,7 +8401,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
{// take note there is no def increase as skill desc says. [malufett]
struct block_list * src;
val3 = status->agi * val1 / 60; // ASPD increase: [(Target AGI x Skill Level) / 60] %
- if( (src = map_id2bl(val2)) )
+ if( (src = iMap->id2bl(val2)) )
val4 = ( 200/status_get_int(src) ) * val1;// MDEF decrease: MDEF [(200 / Caster INT) x Skill Level]
}
break;
@@ -8408,7 +8409,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
{// take note there is no vit,aspd,speed increase as skill desc says. [malufett]
struct block_list * src;
val3 = val1 * 30 + 150; // Natural HP recovery increase: [(Skill Level x 30) + 50] %
- if( (src = map_id2bl(val2)) ) // the stat def is not shown in the status window and it is process differently
+ if( (src = iMap->id2bl(val2)) ) // the stat def is not shown in the status window and it is process differently
val4 = ( status_get_vit(src)/4 ) * val1; // STAT DEF increase: [(Caster VIT / 4) x Skill Level]
}
break;
@@ -8642,7 +8643,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
case SC_STONE:
case SC_DEEPSLEEP:
if (sd && pc_issit(sd)) //Avoid sprite sync problems.
- pc_setstand(sd);
+ iPc->setstand(sd);
case SC_TRICKDEAD:
status_change_end(bl, SC_DANCING, INVALID_TIMER);
// Cancel cast when get status [LuzZza]
@@ -8880,7 +8881,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
//Don't trust the previous sce assignment, in case the SC ended somewhere between there and here.
if((sce=sc->data[type])) {// reuse old sc
if( sce->timer != INVALID_TIMER )
- delete_timer(sce->timer, status_change_timer);
+ iTimer->delete_timer(sce->timer, status_change_timer);
} else {// new sc
++(sc->count);
sce = sc->data[type] = ers_alloc(sc_data_ers, struct status_change_entry);
@@ -8890,7 +8891,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
sce->val3 = val3;
sce->val4 = val4;
if (tick >= 0)
- sce->timer = add_timer(gettick() + tick, status_change_timer, bl->id, type);
+ sce->timer = iTimer->add_timer(iTimer->gettick() + tick, status_change_timer, bl->id, type);
else
sce->timer = INVALID_TIMER; //Infinite duration
@@ -8920,7 +8921,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
}
break;
case SC_BOSSMAPINFO:
- clif->bossmapinfo(sd->fd, map_id2boss(sce->val1), 0); // First Message
+ clif->bossmapinfo(sd->fd, iMap->id2boss(sce->val1), 0); // First Message
break;
case SC_MERC_HPUP:
status_percent_heal(bl, 100, 0); // Recover Full HP
@@ -8963,7 +8964,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val
clif->skillinfo(sd,TK_JUMPKICK, INF_SELF_SKILL);
break;
case MO_TRIPLEATTACK:
- if (sd && pc_checkskill(sd, SR_DRAGONCOMBO) > 0)
+ if (sd && iPc->checkskill(sd, SR_DRAGONCOMBO) > 0)
clif->skillinfo(sd,SR_DRAGONCOMBO, INF_SELF_SKILL);
break;
case SR_FALLENEMPIRE:
@@ -9079,7 +9080,7 @@ int status_change_clear(struct block_list* bl, int type) {
//If for some reason status_change_end decides to still keep the status when quitting. [Skotlex]
(sc->count)--;
if (sc->data[i]->timer != INVALID_TIMER)
- delete_timer(sc->data[i]->timer, status_change_timer);
+ iTimer->delete_timer(sc->data[i]->timer, status_change_timer);
ers_free(sc_data_ers, sc->data[i]);
sc->data[i] = NULL;
}
@@ -9127,7 +9128,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
//Do not end infinite endure.
return 0;
if (sce->timer != INVALID_TIMER) //Could be a SC with infinite duration
- delete_timer(sce->timer,status_change_timer);
+ iTimer->delete_timer(sce->timer,status_change_timer);
if (sc->opt1)
switch (type) {
//"Ugly workaround" [Skotlex]
@@ -9143,7 +9144,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
//since these SC are not affected by it, and it lets us know
//if we have already delayed this attack or not.
sce->val1 = 0;
- sce->timer = add_timer(gettick()+10, status_change_timer, bl->id, type);
+ sce->timer = iTimer->add_timer(iTimer->gettick()+10, status_change_timer, bl->id, type);
return 1;
}
}
@@ -9183,7 +9184,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
unit_stop_walking(bl,1);
}
if (begin_spurt && sce->val1 >= 7 &&
- DIFF_TICK(gettick(), sce->val4) <= 1000 &&
+ DIFF_TICK(iTimer->gettick(), sce->val4) <= 1000 &&
(!sd || (sd->weapontype1 == 0 && sd->weapontype2 == 0))
)
sc_start(bl,SC_SPURT,100,sce->val1,skill->get_time2(status_sc2skill(type), sce->val1));
@@ -9205,7 +9206,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
int i;
for( i = 0; i < 5; i++ )
{
- if( sd->devotion[i] && (tsd = map_id2sd(sd->devotion[i])) && tsd->sc.data[type] )
+ if( sd->devotion[i] && (tsd = iMap->id2sd(sd->devotion[i])) && tsd->sc.data[type] )
status_change_end(&tsd->bl, type, INVALID_TIMER);
}
}
@@ -9219,7 +9220,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_DEVOTION:
{
- struct block_list *d_bl = map_id2bl(sce->val1);
+ struct block_list *d_bl = iMap->id2bl(sce->val1);
if( d_bl )
{
if( d_bl->type == BL_PC )
@@ -9240,7 +9241,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
if(sce->val4)
{
int tid = sce->val4;
- struct block_list *tbl = map_id2bl(tid);
+ struct block_list *tbl = iMap->id2bl(tid);
struct status_change *tsc = status_get_sc(tbl);
sce->val4 = 0;
if(tbl && tsc && tsc->data[SC_BLADESTOP])
@@ -9274,7 +9275,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
sd->delunit_prevline = line;
}
- if(sce->val4 && sce->val4 != BCT_SELF && (dsd=map_id2sd(sce->val4)))
+ if(sce->val4 && sce->val4 != BCT_SELF && (dsd=iMap->id2sd(sce->val4)))
{// end status on partner as well
dsc = dsd->sc.data[SC_DANCING];
if(dsc) {
@@ -9321,14 +9322,14 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_SPLASHER:
{
- struct block_list *src=map_id2bl(sce->val3);
+ struct block_list *src=iMap->id2bl(sce->val3);
if(src && tid != INVALID_TIMER)
- skill->castend_damage_id(src, bl, sce->val2, sce->val1, gettick(), SD_LEVEL );
+ skill->castend_damage_id(src, bl, sce->val2, sce->val1, iTimer->gettick(), SD_LEVEL );
}
break;
case SC_CLOSECONFINE2:
{
- struct block_list *src = sce->val2?map_id2bl(sce->val2):NULL;
+ struct block_list *src = sce->val2?iMap->id2bl(sce->val2):NULL;
struct status_change *sc2 = src?status_get_sc(src):NULL;
if (src && sc2 && sc2->data[SC_CLOSECONFINE]) {
//If status was already ended, do nothing.
@@ -9343,8 +9344,8 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
int range = 1
+skill->get_range2(bl, status_sc2skill(type), sce->val1)
+skill->get_range2(bl, TF_BACKSLIDING, 1); //Since most people use this to escape the hold....
- map_foreachinarea(status_change_timer_sub,
- bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,BL_CHAR,bl,sce,type,gettick());
+ iMap->foreachinarea(status_change_timer_sub,
+ bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,BL_CHAR,bl,sce,type,iTimer->gettick());
}
break;
case SC_COMBO:
@@ -9359,7 +9360,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
clif->skillinfo(sd, TK_JUMPKICK, 0);
break;
case MO_TRIPLEATTACK:
- if (pc_checkskill(sd, SR_DRAGONCOMBO) > 0)
+ if (iPc->checkskill(sd, SR_DRAGONCOMBO) > 0)
clif->skillinfo(sd, SR_DRAGONCOMBO, 0);
break;
case SR_FALLENEMPIRE:
@@ -9374,7 +9375,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
if (sce->val1)
{ // check for partner and end their marionette status as well
enum sc_type type2 = (type == SC_MARIONETTE) ? SC_MARIONETTE2 : SC_MARIONETTE;
- struct block_list *pbl = map_id2bl(sce->val1);
+ struct block_list *pbl = iMap->id2bl(sce->val1);
struct status_change* sc2 = pbl?status_get_sc(pbl):NULL;
if (sc2 && sc2->data[type2])
@@ -9429,14 +9430,14 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
case SC_KAAHI:
//Delete timer if it exists.
if (sce->val4 != INVALID_TIMER)
- delete_timer(sce->val4,kaahi_heal_timer);
+ iTimer->delete_timer(sce->val4,kaahi_heal_timer);
break;
case SC_JAILED:
if(tid == INVALID_TIMER)
break;
//natural expiration.
if(sd && sd->mapindex == sce->val2)
- pc_setpos(sd,(unsigned short)sce->val3,sce->val4&0xFFFF, sce->val4>>16, CLR_TELEPORT);
+ iPc->setpos(sd,(unsigned short)sce->val3,sce->val4&0xFFFF, sce->val4>>16, CLR_TELEPORT);
break; //guess hes not in jail :P
case SC_CHANGE:
if (tid == INVALID_TIMER)
@@ -9450,15 +9451,15 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
// Note: vending/buying is closed by unit_remove_map, no
// need to do it here.
- map_quit(sd);
- // Because map_quit calls status_change_end with tid -1
+ iMap->quit(sd);
+ // Because iMap->quit calls status_change_end with tid -1
// from here it's not neccesary to continue
return 1;
break;
case SC_STOP:
if( sce->val2 )
{
- struct block_list* tbl = map_id2bl(sce->val2);
+ struct block_list* tbl = iMap->id2bl(sce->val2);
sce->val2 = 0;
if( tbl && (sc = status_get_sc(tbl)) && sc->data[SC_STOP] && sc->data[SC_STOP]->val2 == bl->id )
status_change_end(tbl, SC_STOP, INVALID_TIMER);
@@ -9475,10 +9476,10 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_WHITEIMPRISON:
{
- struct block_list* src = map_id2bl(sce->val2);
+ struct block_list* src = iMap->id2bl(sce->val2);
if( tid == -1 || !src)
break; // Terminated by Damage
- status_fix_damage(src,bl,400*sce->val1,clif->damage(bl,bl,gettick(),0,0,400*sce->val1,0,0,0));
+ status_fix_damage(src,bl,400*sce->val1,clif->damage(bl,bl,iTimer->gettick(),0,0,400*sce->val1,0,0,0));
}
break;
case SC_WUGDASH:
@@ -9495,7 +9496,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
status_change_end(bl, SC_BLIND, INVALID_TIMER);
break;
case SC__SHADOWFORM: {
- struct map_session_data *s_sd = map_id2sd(sce->val2);
+ struct map_session_data *s_sd = iMap->id2sd(sce->val2);
if( !s_sd )
break;
s_sd->shadowform_id = 0;
@@ -9503,7 +9504,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_SITDOWN_FORCE:
if( sd && pc_issit(sd) ) {
- pc_setstand(sd);
+ iPc->setstand(sd);
clif->standing(bl);
}
break;
@@ -9526,23 +9527,23 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_CURSEDCIRCLE_ATKER:
if( sce->val2 ) // used the default area size cause there is a chance the caster could knock back and can't clear the target.
- map_foreachinrange(status_change_timer_sub, bl, battle_config.area_size,BL_CHAR, bl, sce, SC_CURSEDCIRCLE_TARGET, gettick());
+ iMap->foreachinrange(status_change_timer_sub, bl, battle_config.area_size,BL_CHAR, bl, sce, SC_CURSEDCIRCLE_TARGET, iTimer->gettick());
break;
case SC_RAISINGDRAGON:
if( sd && sce->val2 && !pc_isdead(sd) ) {
int i;
i = min(sd->spiritball,5);
- pc_delspiritball(sd, sd->spiritball, 0);
+ iPc->delspiritball(sd, sd->spiritball, 0);
status_change_end(bl, SC_EXPLOSIONSPIRITS, INVALID_TIMER);
while( i > 0 ) {
- pc_addspiritball(sd, skill->get_time(MO_CALLSPIRITS, pc_checkskill(sd,MO_CALLSPIRITS)), 5);
+ iPc->addspiritball(sd, skill->get_time(MO_CALLSPIRITS, iPc->checkskill(sd,MO_CALLSPIRITS)), 5);
--i;
}
}
break;
case SC_CURSEDCIRCLE_TARGET:
{
- struct block_list *src = map_id2bl(sce->val2);
+ struct block_list *src = iMap->id2bl(sce->val2);
struct status_change *sc = status_get_sc(src);
if( sc && sc->data[SC_CURSEDCIRCLE_ATKER] && --(sc->data[SC_CURSEDCIRCLE_ATKER]->val2) == 0 ){
status_change_end(src, SC_CURSEDCIRCLE_ATKER, INVALID_TIMER);
@@ -9552,7 +9553,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
break;
case SC_BLOODSUCKER:
if( sce->val2 ){
- struct block_list *src = map_id2bl(sce->val2);
+ struct block_list *src = iMap->id2bl(sce->val2);
if(src){
struct status_change *sc = status_get_sc(src);
sc->bs_counter--;
@@ -9760,9 +9761,9 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
status_calc_bl(bl,calc_flag);
if(opt_flag&4) //Out of hiding, invoke on place.
- skill->unit_move(bl,gettick(),1);
+ skill->unit_move(bl,iTimer->gettick(),1);
- if(opt_flag&2 && sd && map_getcell(bl->m,bl->x,bl->y,CELL_CHKNPC))
+ if(opt_flag&2 && sd && iMap->getcell(bl->m,bl->x,bl->y,CELL_CHKNPC))
npc_touch_areanpc(sd,bl->m,bl->x,bl->y); //Trigger on-touch event.
ers_free(sc_data_ers, sce);
@@ -9777,7 +9778,7 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
struct status_data *status;
int hp;
- if(!((bl=map_id2bl(id))&&
+ if(!((bl=iMap->id2bl(id))&&
(sc=status_get_sc(bl)) &&
(sce = sc->data[SC_KAAHI])))
return 0;
@@ -9816,7 +9817,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
struct status_change *sc;
struct status_change_entry *sce;
- bl = map_id2bl(id);
+ bl = iMap->id2bl(id);
if(!bl)
{
ShowDebug("status_change_timer: Null pointer id: %d data: %d\n", id, data);
@@ -9842,7 +9843,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
// set the next timer of the sce (don't assume the status still exists)
#define sc_timer_next(t,f,i,d) \
if( (sce=sc->data[type]) ) \
- sce->timer = add_timer(t,f,i,d); \
+ sce->timer = iTimer->add_timer(t,f,i,d); \
else \
ShowError("status_change_timer: Unexpected NULL status change id: %d data: %d\n", id, data)
@@ -9891,9 +9892,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_RUWACH:
case SC_SIGHTBLASTER:
if(type == SC_SIGHTBLASTER)
- map_foreachinrange( status_change_timer_sub, bl, sce->val3, BL_CHAR|BL_SKILL, bl, sce, type, tick);
+ iMap->foreachinrange( status_change_timer_sub, bl, sce->val3, BL_CHAR|BL_SKILL, bl, sce, type, tick);
else
- map_foreachinrange( status_change_timer_sub, bl, sce->val3, BL_CHAR, bl, sce, type, tick);
+ iMap->foreachinrange( status_change_timer_sub, bl, sce->val3, BL_CHAR, bl, sce, type, tick);
if( --(sce->val2)>0 ){
sce->val4 += 250; // use for Shadow Form 2 seconds checking.
@@ -9935,16 +9936,16 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
if (--(sce->val3) > 0) {
if (!sc->data[SC_SLOWPOISON]) {
if( sce->val2 && bl->type == BL_MOB ) {
- struct block_list* src = map_id2bl(sce->val2);
+ struct block_list* src = iMap->id2bl(sce->val2);
if( src )
mob_log_damage((TBL_MOB*)bl,src,sce->val4);
}
- map_freeblock_lock();
+ iMap->freeblock_lock();
status_zap(bl, sce->val4, 0);
if (sc->data[type]) { // Check if the status still last ( can be dead since then ).
sc_timer_next(1000 + tick, status_change_timer, bl->id, data );
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
}
return 0;
}
@@ -9962,7 +9963,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
if(bl->m == sd->feel_map[0].m ||
bl->m == sd->feel_map[1].m ||
bl->m == sd->feel_map[2].m)
- { //Timeout will be handled by pc_setpos
+ { //Timeout will be handled by iPc->setpos
sce->timer = INVALID_TIMER;
return 0;
}
@@ -9971,20 +9972,20 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_BLEEDING:
if (--(sce->val4) >= 0) {
int hp = rnd()%600 + 200;
- struct block_list* src = map_id2bl(sce->val2);
+ struct block_list* src = iMap->id2bl(sce->val2);
if( src && bl && bl->type == BL_MOB ) {
mob_log_damage((TBL_MOB*)bl,src,sd||hp<status->hp?hp:status->hp-1);
}
- map_freeblock_lock();
+ iMap->freeblock_lock();
status_fix_damage(src, bl, sd||hp<status->hp?hp:status->hp-1, 1);
if( sc->data[type] ) {
if( status->hp == 1 ) {
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
break;
}
sc_timer_next(10000 + tick, status_change_timer, bl->id, data);
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
break;
@@ -10006,7 +10007,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_BOSSMAPINFO:
if( sd && --(sce->val4) >= 0 )
{
- struct mob_data *boss_md = map_id2boss(sce->val1);
+ struct mob_data *boss_md = iMap->id2boss(sce->val1);
if( boss_md && sd->bl.m == boss_md->bl.m )
{
clif->bossmapinfo(sd->fd, boss_md, 1); // Update X - Y on minimap
@@ -10113,7 +10114,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_MARIONETTE:
case SC_MARIONETTE2:
{
- struct block_list *pbl = map_id2bl(sce->val1);
+ struct block_list *pbl = iMap->id2bl(sce->val1);
if( pbl && check_distance_bl(bl, pbl, 7) )
{
sc_timer_next(1000 + tick, status_change_timer, bl->id, data);
@@ -10159,13 +10160,13 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_PYREXIA:
if( --(sce->val4) >= 0 ) {
- map_freeblock_lock();
+ iMap->freeblock_lock();
clif->damage(bl,bl,tick,status_get_amotion(bl),status_get_dmotion(bl)+500,100,0,0,0);
status_fix_damage(NULL,bl,100,0);
if( sc->data[type] ) {
sc_timer_next(3000+tick,status_change_timer,bl->id,data);
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
break;
@@ -10175,12 +10176,12 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
int damage = status->max_hp/100; // {Target VIT x (New Poison Research Skill Level - 3)} + (Target HP/100)
damage += status->vit * (sce->val1 - 3);
unit_skillcastcancel(bl,2);
- map_freeblock_lock();
+ iMap->freeblock_lock();
status_damage(bl, bl, damage, 0, clif->damage(bl,bl,tick,status_get_amotion(bl),status_get_dmotion(bl)+500,damage,1,0,0), 1);
if( sc->data[type] ) {
sc_timer_next(1000 + tick, status_change_timer, bl->id, data );
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
break;
@@ -10193,10 +10194,10 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
damage = status->hp - 1; // Cannot Kill
if( damage > 0 ) { // 3% Damage each 4 seconds
- map_freeblock_lock();
+ iMap->freeblock_lock();
status_zap(bl,damage,0);
flag = !sc->data[type]; // Killed? Should not
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
}
if( !flag ) { // Random Skill Cast
@@ -10233,13 +10234,13 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_TOXIN:
if( --(sce->val4) >= 0 )
{ //Damage is every 10 seconds including 3%sp drain.
- map_freeblock_lock();
+ iMap->freeblock_lock();
clif->damage(bl,bl,tick,status_get_amotion(bl),1,1,0,0,0);
status_damage(NULL, bl, 1, status->max_sp * 3 / 100, 0, 0); //cancel dmg only if cancelable
if( sc->data[type] ) {
sc_timer_next(10000 + tick, status_change_timer, bl->id, data );
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
break;
@@ -10284,17 +10285,17 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_BURNING:
if( --(sce->val4) >= 0 )
{
- struct block_list *src = map_id2bl(sce->val3);
+ struct block_list *src = iMap->id2bl(sce->val3);
int damage = 1000 + 3 * status_get_max_hp(bl) / 100; // Deals fixed (1000 + 3%*MaxHP)
- map_freeblock_lock();
+ iMap->freeblock_lock();
clif->damage(bl,bl,tick,0,0,damage,1,9,0); //damage is like endure effect with no walk delay
status_damage(src, bl, damage, 0, 0, 1);
if( sc->data[type]){ // Target still lives. [LimitLine]
sc_timer_next(2000 + tick, status_change_timer, bl->id, data);
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
break;
@@ -10393,18 +10394,18 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
break;
case SC_BLOODSUCKER:
if( --(sce->val4) >= 0 ) {
- struct block_list *src = map_id2bl(sce->val2);
+ struct block_list *src = iMap->id2bl(sce->val2);
int damage;
if( !src || (src && (status_isdead(src) || src->m != bl->m || distance_bl(src, bl) >= 12)) )
break;
- map_freeblock_lock();
+ iMap->freeblock_lock();
damage = 200 + 100 * sce->val1 + status_get_int(src);
status_damage(src, bl, damage, 0, clif->damage(bl,bl,tick,status->amotion,status->dmotion+200,damage,1,0,0), 1);
unit_skillcastcancel(bl,1);
if ( sc->data[type] ) {
sc_timer_next(1000 + tick, status_change_timer, bl->id, data);
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
status_heal(src, damage*(5 + 5 * sce->val1)/100, 0, 0); // 5 + 5% per level
return 0;
}
@@ -10481,7 +10482,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
case SC_BANDING:
if( status_charge(bl, 0, 7 - sce->val1) )
{
- if( sd ) pc_banding(sd, sce->val1);
+ if( sd ) iPc->banding(sd, sce->val1);
sc_timer_next(5000 + tick, status_change_timer, bl->id, data);
return 0;
}
@@ -10506,12 +10507,12 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
{
int damage = status->max_hp / 100; // Suggestion 1% each second
if( damage >= status->hp ) damage = status->hp - 1; // Do not kill, just keep you with 1 hp minimum
- map_freeblock_lock();
+ iMap->freeblock_lock();
status_fix_damage(NULL,bl,damage,clif->damage(bl,bl,tick,0,0,damage,0,0,0));
if( sc->data[type] ) {
sc_timer_next(1000 + tick, status_change_timer, bl->id, data);
}
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
}
break;
@@ -10526,7 +10527,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data)
}
else
{
- struct block_list *src = map_id2bl(sce->val2);
+ struct block_list *src = iMap->id2bl(sce->val2);
struct status_change *ssc;
if( !src || (ssc = status_get_sc(src)) == NULL || !ssc->data[SC_MAGNETICFIELD] )
break; // Source no more under Magnetic Field
@@ -10845,7 +10846,7 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) {
if( !sc || !sc->count )
return 0;
- tick = gettick();
+ tick = iTimer->gettick();
for( i = SC_COMMON_MIN; i < SC_MAX; i++ ) {
if( !sc->data[i] || i == SC_COMMON_MAX )
@@ -10878,7 +10879,7 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) {
case SC_DEATHHURT:
case SC_PARALYSE:
if( sc->data[i]->timer != INVALID_TIMER ) {
- timer = get_timer(sc->data[i]->timer);
+ timer = iTimer->get_timer(sc->data[i]->timer);
if (timer == NULL || timer->func != status_change_timer || DIFF_TICK(timer->tick,tick) < 0)
continue;
data.tick = DIFF_TICK(timer->tick,tick);
@@ -10960,9 +10961,9 @@ static int status_natural_heal(struct block_list* bl, va_list args)
if (sd) {
if (sd->hp_loss.value || sd->sp_loss.value)
- pc_bleeding(sd, natural_heal_diff_tick);
+ iPc->bleeding(sd, natural_heal_diff_tick);
if (sd->hp_regen.value || sd->sp_regen.value)
- pc_regen(sd, natural_heal_diff_tick);
+ iPc->regen(sd, natural_heal_diff_tick);
}
if(flag&(RGN_SHP|RGN_SSP) && regen->ssregen &&
@@ -11097,7 +11098,7 @@ static int status_natural_heal(struct block_list* bl, va_list args)
if (sd && sd->state.doridori) {
val*=2;
sd->state.doridori = 0;
- if ((rate = pc_checkskill(sd,TK_SPTIME)))
+ if ((rate = iPc->checkskill(sd,TK_SPTIME)))
sc_start(bl,status_skill2sc(TK_SPTIME),
100,rate,skill->get_time(TK_SPTIME, rate));
if (
@@ -11105,8 +11106,8 @@ static int status_natural_heal(struct block_list* bl, va_list args)
rnd()%10000 < battle_config.sg_angel_skill_ratio
) { //Angel of the Sun/Moon/Star
clif->feel_hate_reset(sd);
- pc_resethate(sd);
- pc_resetfeel(sd);
+ iPc->resethate(sd);
+ iPc->resetfeel(sd);
}
}
sregen->tick.sp -= battle_config.natural_heal_skill_interval;
@@ -11121,7 +11122,7 @@ static int status_natural_heal(struct block_list* bl, va_list args)
static int status_natural_heal_timer(int tid, unsigned int tick, int id, intptr_t data)
{
natural_heal_diff_tick = DIFF_TICK(tick,natural_heal_prev_tick);
- map_foreachregen(status_natural_heal);
+ iMap->map_foreachregen(status_natural_heal);
natural_heal_prev_tick = tick;
return 0;
}
@@ -11160,7 +11161,7 @@ static bool status_readdb_job1(char* fields[], int columns, int current)
ShowWarning("status_readdb_job1: Invalid job class %d specified.\n", class_);
return false;
}
- idx = pc_class2idx(class_);
+ idx = iPc->class2idx(class_);
max_weight_base[idx] = atoi(fields[1]);
hp_coefficient[idx] = atoi(fields[2]);
@@ -11188,7 +11189,7 @@ static bool status_readdb_job2(char* fields[], int columns, int current)
ShowWarning("status_readdb_job2: Invalid job class %d specified.\n", class_);
return false;
}
- idx = pc_class2idx(class_);
+ idx = iPc->class2idx(class_);
for(i = 1; i < columns; i++)
{
@@ -11286,13 +11287,13 @@ int status_readdb(void)
#ifdef RENEWAL_ASPD
- sv->readdb(db_path, "re/job_db1.txt", ',', 6+MAX_WEAPON_TYPE, 6+MAX_WEAPON_TYPE, -1, &status_readdb_job1);
+ sv->readdb(iMap->db_path, "re/job_db1.txt", ',', 6+MAX_WEAPON_TYPE, 6+MAX_WEAPON_TYPE, -1, &status_readdb_job1);
#else
- sv->readdb(db_path, "pre-re/job_db1.txt", ',', 5+MAX_WEAPON_TYPE, 5+MAX_WEAPON_TYPE, -1, &status_readdb_job1);
+ sv->readdb(iMap->db_path, "pre-re/job_db1.txt", ',', 5+MAX_WEAPON_TYPE, 5+MAX_WEAPON_TYPE, -1, &status_readdb_job1);
#endif
- sv->readdb(db_path, "job_db2.txt", ',', 1, 1+MAX_LEVEL, -1, &status_readdb_job2);
- sv->readdb(db_path, "size_fix.txt", ',', MAX_WEAPON_TYPE, MAX_WEAPON_TYPE, ARRAYLENGTH(atkmods), &status_readdb_sizefix);
- sv->readdb(db_path, DBPATH"refine_db.txt", ',', 4+MAX_REFINE, 4+MAX_REFINE, ARRAYLENGTH(refine_info), &status_readdb_refine);
+ sv->readdb(iMap->db_path, "job_db2.txt", ',', 1, 1+MAX_LEVEL, -1, &status_readdb_job2);
+ sv->readdb(iMap->db_path, "size_fix.txt", ',', MAX_WEAPON_TYPE, MAX_WEAPON_TYPE, ARRAYLENGTH(atkmods), &status_readdb_sizefix);
+ sv->readdb(iMap->db_path, DBPATH"refine_db.txt", ',', 4+MAX_REFINE, 4+MAX_REFINE, ARRAYLENGTH(refine_info), &status_readdb_refine);
return 0;
}
@@ -11302,16 +11303,16 @@ int status_readdb(void)
*------------------------------------------*/
int do_init_status(void)
{
- add_timer_func_list(status_change_timer,"status_change_timer");
- add_timer_func_list(kaahi_heal_timer,"kaahi_heal_timer");
- add_timer_func_list(status_natural_heal_timer,"status_natural_heal_timer");
+ iTimer->add_timer_func_list(status_change_timer,"status_change_timer");
+ iTimer->add_timer_func_list(kaahi_heal_timer,"kaahi_heal_timer");
+ iTimer->add_timer_func_list(status_natural_heal_timer,"status_natural_heal_timer");
initChangeTables();
initDummyData();
status_readdb();
status_calc_sigma();
- natural_heal_prev_tick = gettick();
+ natural_heal_prev_tick = iTimer->gettick();
sc_data_ers = ers_new(sizeof(struct status_change_entry),"status.c::sc_data_ers",ERS_OPT_NONE);
- add_timer_interval(natural_heal_prev_tick + NATURAL_HEAL_INTERVAL, status_natural_heal_timer, 0, 0, NATURAL_HEAL_INTERVAL);
+ iTimer->add_timer_interval(natural_heal_prev_tick + NATURAL_HEAL_INTERVAL, status_natural_heal_timer, 0, 0, NATURAL_HEAL_INTERVAL);
return 0;
}
void do_final_status(void)
diff --git a/src/map/storage.c b/src/map/storage.c
index 01da53907..188534b61 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -73,7 +73,7 @@ void do_final_storage(void) // by [MC Cameri]
*/
static int storage_reconnect_sub(DBKey key, DBData *data, va_list ap)
{
- struct guild_storage *stor = DB->data2ptr(data);
+ struct guild_storage *stor = iDB->data2ptr(data);
if (stor->dirty && stor->storage_status == 0) //Save closed storages.
storage_guild_storagesave(0, stor->guild_id,0);
@@ -98,7 +98,7 @@ int storage_storageopen(struct map_session_data *sd)
if(sd->state.storage_flag)
return 1; //Already open?
- if( !pc_can_give_items(sd) )
+ if( !iPc->can_give_items(sd) )
{ //check is this GM level is allowed to put items to storage
clif->message(sd->fd, msg_txt(246));
return 1;
@@ -148,7 +148,7 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
return 1;
}
- if( !itemdb_canstore(item_data, pc_get_group_level(sd)) )
+ if( !itemdb_canstore(item_data, iPc->get_group_level(sd)) )
{ //Check if item is storable. [Skotlex]
clif->message (sd->fd, msg_txt(264));
return 1;
@@ -227,7 +227,7 @@ int storage_storageadd(struct map_session_data* sd, int index, int amount)
return 0;
if( storage_additem(sd,&sd->status.inventory[index],amount) == 0 )
- pc_delitem(sd,index,amount,0,4,LOG_TYPE_STORAGE);
+ iPc->delitem(sd,index,amount,0,4,LOG_TYPE_STORAGE);
return 1;
}
@@ -252,7 +252,7 @@ int storage_storageget(struct map_session_data* sd, int index, int amount)
if( amount < 1 || amount > sd->status.storage.items[index].amount )
return 0;
- if( (flag = pc_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE)) == 0 )
+ if( (flag = iPc->additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE)) == 0 )
storage_delitem(sd,index,amount);
else
clif->additem(sd,0,0,flag);
@@ -284,7 +284,7 @@ int storage_storageaddfromcart(struct map_session_data* sd, int index, int amoun
return 0;
if( storage_additem(sd,&sd->status.cart[index],amount) == 0 )
- pc_cart_delitem(sd,index,amount,0,LOG_TYPE_STORAGE);
+ iPc->cart_delitem(sd,index,amount,0,LOG_TYPE_STORAGE);
return 1;
}
@@ -309,7 +309,7 @@ int storage_storagegettocart(struct map_session_data* sd, int index, int amount)
if( amount < 1 || amount > sd->status.storage.items[index].amount )
return 0;
- if( pc_cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE) == 0 )
+ if( iPc->cart_additem(sd,&sd->status.storage.items[index],amount,LOG_TYPE_STORAGE) == 0 )
storage_delitem(sd,index,amount);
return 1;
@@ -325,7 +325,7 @@ void storage_storageclose(struct map_session_data* sd)
clif->storageclose(sd);
- if( save_settings&4 )
+ if( iMap->save_settings&4 )
chrif_save(sd,0); //Invokes the storage saving as well.
sd->state.storage_flag = 0;
@@ -338,7 +338,7 @@ void storage_storage_quit(struct map_session_data* sd, int flag)
{
nullpo_retv(sd);
- if (save_settings&4)
+ if (iMap->save_settings&4)
chrif_save(sd, flag); //Invokes the storage saving as well.
sd->state.storage_flag = 0;
@@ -352,7 +352,7 @@ static DBData create_guildstorage(DBKey key, va_list args)
struct guild_storage *gs = NULL;
gs = (struct guild_storage *) aCalloc(sizeof(struct guild_storage), 1);
gs->guild_id=key.i;
- return DB->ptr2data(gs);
+ return iDB->ptr2data(gs);
}
struct guild_storage *guild2storage(int guild_id)
@@ -394,7 +394,7 @@ int storage_guild_storageopen(struct map_session_data* sd)
if(sd->state.storage_flag)
return 1; //Can't open both storages at a time.
- if( !pc_can_give_items(sd) ) { //check is this GM level can open guild storage and store items [Lupus]
+ if( !iPc->can_give_items(sd) ) { //check is this GM level can open guild storage and store items [Lupus]
clif->message(sd->fd, msg_txt(246));
return 1;
}
@@ -442,7 +442,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
return 1;
}
- if( !itemdb_canguildstore(item_data, pc_get_group_level(sd)) || item_data->expire_time )
+ if( !itemdb_canguildstore(item_data, iPc->get_group_level(sd)) || item_data->expire_time )
{ //Check if item is storable. [Skotlex]
clif->message (sd->fd, msg_txt(264));
return 1;
@@ -532,7 +532,7 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount)
}
if(guild_storage_additem(sd,stor,&sd->status.inventory[index],amount)==0)
- pc_delitem(sd,index,amount,0,4,LOG_TYPE_GSTORAGE);
+ iPc->delitem(sd,index,amount,0,4,LOG_TYPE_GSTORAGE);
return 1;
}
@@ -569,7 +569,7 @@ int storage_guild_storageget(struct map_session_data* sd, int index, int amount)
return 0;
}
- if((flag = pc_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)) == 0)
+ if((flag = iPc->additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)) == 0)
guild_storage_delitem(sd,stor,index,amount);
else //inform fail
clif->additem(sd,0,0,flag);
@@ -605,7 +605,7 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int
return 0;
if(guild_storage_additem(sd,stor,&sd->status.cart[index],amount)==0)
- pc_cart_delitem(sd,index,amount,0,LOG_TYPE_GSTORAGE);
+ iPc->cart_delitem(sd,index,amount,0,LOG_TYPE_GSTORAGE);
return 1;
}
@@ -636,7 +636,7 @@ int storage_guild_storagegettocart(struct map_session_data* sd, int index, int a
if(amount < 1 || amount > stor->items[index].amount)
return 0;
- if(pc_cart_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)==0)
+ if(iPc->cart_additem(sd,&stor->items[index],amount,LOG_TYPE_GSTORAGE)==0)
guild_storage_delitem(sd,stor,index,amount);
return 1;
@@ -694,7 +694,7 @@ int storage_guild_storageclose(struct map_session_data* sd)
clif->storageclose(sd);
if (stor->storage_status)
{
- if (save_settings&4)
+ if (iMap->save_settings&4)
chrif_save(sd, 0); //This one also saves the storage. [Skotlex]
else
storage_guild_storagesave(sd->status.account_id, sd->status.guild_id,0);
@@ -717,13 +717,13 @@ int storage_guild_storage_quit(struct map_session_data* sd, int flag)
sd->state.storage_flag = 0;
stor->storage_status = 0;
clif->storageclose(sd);
- if (save_settings&4)
+ if (iMap->save_settings&4)
chrif_save(sd,0);
return 0;
}
if(stor->storage_status) {
- if (save_settings&4)
+ if (iMap->save_settings&4)
chrif_save(sd,0);
else
storage_guild_storagesave(sd->status.account_id,sd->status.guild_id,1);
diff --git a/src/map/trade.c b/src/map/trade.c
index 1417426e9..4f4cc7394 100644
--- a/src/map/trade.c
+++ b/src/map/trade.c
@@ -55,7 +55,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
}
if ( sd->trade_partner != 0 ) { // If a character tries to trade to another one then cancel the previous one
- struct map_session_data *previous_sd = map_id2sd(sd->trade_partner);
+ struct map_session_data *previous_sd = iMap->id2sd(sd->trade_partner);
if( previous_sd ){
previous_sd->trade_partner = 0;
clif->tradecancelled(previous_sd);
@@ -69,7 +69,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
return;
}
- if (!pc_can_give_items(sd) || !pc_can_give_items(target_sd)) //check if both GMs are allowed to trade
+ if (!iPc->can_give_items(sd) || !iPc->can_give_items(target_sd)) //check if both GMs are allowed to trade
{
clif->message(sd->fd, msg_txt(246));
clif->tradestart(sd, 2); // GM is not allowed to trade
@@ -77,7 +77,7 @@ void trade_traderequest(struct map_session_data *sd, struct map_session_data *ta
}
// Players can not request trade from far away, unless they are allowed to use @trade.
- if (!pc_can_use_command(sd, "@trade") &&
+ if (!iPc->can_use_command(sd, "@trade") &&
(sd->bl.m != target_sd->bl.m || !check_distance_bl(&sd->bl, &target_sd->bl, TRADE_DISTANCE))) {
clif->tradestart(sd, 0); // too far
return ;
@@ -107,7 +107,7 @@ void trade_tradeack(struct map_session_data *sd, int type)
if (sd->state.trading || !sd->trade_partner)
return; //Already trading or no partner set.
- if ((tsd = map_id2sd(sd->trade_partner)) == NULL) {
+ if ((tsd = iMap->id2sd(sd->trade_partner)) == NULL) {
clif->tradestart(sd, 1); // character does not exist
sd->trade_partner=0;
return;
@@ -135,7 +135,7 @@ void trade_tradeack(struct map_session_data *sd, int type)
// Players can not request trade from far away, unless they are allowed to use @trade.
// Check here as well since the original character could had warped.
- if (!pc_can_use_command(sd, "@trade") &&
+ if (!iPc->can_use_command(sd, "@trade") &&
(sd->bl.m != tsd->bl.m || !check_distance_bl(&sd->bl, &tsd->bl, TRADE_DISTANCE))) {
clif->tradestart(sd, 0); // too far
sd->trade_partner=0;
@@ -201,9 +201,9 @@ int impossible_trade_check(struct map_session_data *sd)
if (inventory[index].amount < sd->deal.item[i].amount)
{ // if more than the player have -> hack
sprintf(message_to_gm, msg_txt(538), sd->status.name, sd->status.account_id); // Hack on trade: character '%s' (account: %d) try to trade more items that he has.
- intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
+ intif_wis_message_to_gm(iMap->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
sprintf(message_to_gm, msg_txt(539), inventory[index].amount, inventory[index].nameid, sd->deal.item[i].amount); // This player has %d of a kind of item (id: %d), and try to trade %d of them.
- intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
+ intif_wis_message_to_gm(iMap->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
// if we block people
if (battle_config.ban_hack_trade < 0) {
chrif_char_ask_name(-1, sd->status.name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block
@@ -220,7 +220,7 @@ int impossible_trade_check(struct map_session_data *sd)
// message about the ban
strcpy(message_to_gm, msg_txt(508)); // This player hasn't been banned (Ban option is disabled).
- intif_wis_message_to_gm(wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
+ intif_wis_message_to_gm(iMap->wisp_server_name, PC_PERM_RECEIVE_HACK_INFO, message_to_gm);
return 1;
}
inventory[index].amount -= sd->deal.item[i].amount; // remove item from inventory
@@ -329,7 +329,7 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount)
if( !sd->state.trading || sd->state.deal_locked > 0 )
return; //Can't add stuff.
- if( (target_sd = map_id2sd(sd->trade_partner)) == NULL )
+ if( (target_sd = iMap->id2sd(sd->trade_partner)) == NULL )
{
trade_tradecancel(sd);
return;
@@ -350,10 +350,10 @@ void trade_tradeadditem(struct map_session_data *sd, short index, short amount)
return;
item = &sd->status.inventory[index];
- src_lv = pc_get_group_level(sd);
- dst_lv = pc_get_group_level(target_sd);
+ src_lv = iPc->get_group_level(sd);
+ dst_lv = iPc->get_group_level(target_sd);
if( !itemdb_cantrade(item, src_lv, dst_lv) && //Can't trade
- (pc_get_partner(sd) != target_sd || !itemdb_canpartnertrade(item, src_lv, dst_lv)) ) //Can't partner-trade
+ (iPc->get_partner(sd) != target_sd || !itemdb_canpartnertrade(item, src_lv, dst_lv)) ) //Can't partner-trade
{
clif->message (sd->fd, msg_txt(260));
clif->tradeitemok(sd, index+2, 1);
@@ -413,7 +413,7 @@ void trade_tradeaddzeny(struct map_session_data* sd, int amount)
if( !sd->state.trading || sd->state.deal_locked > 0 )
return; //Can't add stuff.
- if( (target_sd = map_id2sd(sd->trade_partner)) == NULL )
+ if( (target_sd = iMap->id2sd(sd->trade_partner)) == NULL )
{
trade_tradecancel(sd);
return;
@@ -439,7 +439,7 @@ void trade_tradeok(struct map_session_data *sd)
if(sd->state.deal_locked || !sd->state.trading)
return;
- if ((target_sd = map_id2sd(sd->trade_partner)) == NULL) {
+ if ((target_sd = iMap->id2sd(sd->trade_partner)) == NULL) {
trade_tradecancel(sd);
return;
}
@@ -457,7 +457,7 @@ void trade_tradecancel(struct map_session_data *sd)
struct map_session_data *target_sd;
int trade_i;
- target_sd = map_id2sd(sd->trade_partner);
+ target_sd = iMap->id2sd(sd->trade_partner);
if(!sd->state.trading)
{ // Not trade acepted
@@ -520,7 +520,7 @@ void trade_tradecommit(struct map_session_data *sd)
if (!sd->state.trading || !sd->state.deal_locked) //Locked should be 1 (pressed ok) before you can press trade.
return;
- if ((tsd = map_id2sd(sd->trade_partner)) == NULL) {
+ if ((tsd = iMap->id2sd(sd->trade_partner)) == NULL) {
trade_tradecancel(sd);
return;
}
@@ -555,9 +555,9 @@ void trade_tradecommit(struct map_session_data *sd)
{
n = sd->deal.item[trade_i].index;
- flag = pc_additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount,LOG_TYPE_TRADE);
+ flag = iPc->additem(tsd, &sd->status.inventory[n], sd->deal.item[trade_i].amount,LOG_TYPE_TRADE);
if (flag == 0)
- pc_delitem(sd, n, sd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE);
+ iPc->delitem(sd, n, sd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE);
else
clif->additem(sd, n, sd->deal.item[trade_i].amount, 0);
sd->deal.item[trade_i].index = 0;
@@ -567,9 +567,9 @@ void trade_tradecommit(struct map_session_data *sd)
{
n = tsd->deal.item[trade_i].index;
- flag = pc_additem(sd, &tsd->status.inventory[n], tsd->deal.item[trade_i].amount,LOG_TYPE_TRADE);
+ flag = iPc->additem(sd, &tsd->status.inventory[n], tsd->deal.item[trade_i].amount,LOG_TYPE_TRADE);
if (flag == 0)
- pc_delitem(tsd, n, tsd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE);
+ iPc->delitem(tsd, n, tsd->deal.item[trade_i].amount, 1, 6, LOG_TYPE_TRADE);
else
clif->additem(tsd, n, tsd->deal.item[trade_i].amount, 0);
tsd->deal.item[trade_i].index = 0;
@@ -578,14 +578,14 @@ void trade_tradecommit(struct map_session_data *sd)
}
if( sd->deal.zeny ) {
- pc_payzeny(sd ,sd->deal.zeny, LOG_TYPE_TRADE, tsd);
- pc_getzeny(tsd,sd->deal.zeny,LOG_TYPE_TRADE, sd);
+ iPc->payzeny(sd ,sd->deal.zeny, LOG_TYPE_TRADE, tsd);
+ iPc->getzeny(tsd,sd->deal.zeny,LOG_TYPE_TRADE, sd);
sd->deal.zeny = 0;
}
if ( tsd->deal.zeny) {
- pc_payzeny(tsd,tsd->deal.zeny,LOG_TYPE_TRADE, sd);
- pc_getzeny(sd ,tsd->deal.zeny,LOG_TYPE_TRADE, tsd);
+ iPc->payzeny(tsd,tsd->deal.zeny,LOG_TYPE_TRADE, sd);
+ iPc->getzeny(sd ,tsd->deal.zeny,LOG_TYPE_TRADE, tsd);
tsd->deal.zeny = 0;
}
@@ -601,7 +601,7 @@ void trade_tradecommit(struct map_session_data *sd)
clif->tradecompleted(tsd, 0);
// save both player to avoid crash: they always have no advantage/disadvantage between the 2 players
- if (save_settings&1)
+ if (iMap->save_settings&1)
{
chrif_save(sd,0);
chrif_save(tsd,0);
diff --git a/src/map/unit.c b/src/map/unit.c
index cbc695c4a..a09776298 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -50,7 +50,7 @@ struct unit_data* unit_bl2ud(struct block_list *bl)
if( bl->type == BL_PC) return &((struct map_session_data*)bl)->ud;
if( bl->type == BL_MOB) return &((struct mob_data*)bl)->ud;
if( bl->type == BL_PET) return &((struct pet_data*)bl)->ud;
- if( bl->type == BL_NPC) return &((struct npc_data*)bl)->ud;
+ if( bl->type == BL_NPC) return ((struct npc_data*)bl)->ud;
if( bl->type == BL_HOM) return &((struct homun_data*)bl)->ud;
if( bl->type == BL_MER) return &((struct mercenary_data*)bl)->ud;
if( bl->type == BL_ELEM) return &((struct elemental_data*)bl)->ud;
@@ -108,7 +108,7 @@ int unit_walktoxy_sub(struct block_list *bl)
else
i = status_get_speed(bl);
if( i > 0)
- ud->walktimer = add_timer(gettick()+i,unit_walktoxy_timer,bl->id,i);
+ ud->walktimer = iTimer->add_timer(iTimer->gettick()+i,unit_walktoxy_timer,bl->id,i);
return 1;
}
@@ -123,7 +123,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
struct unit_data *ud;
struct mercenary_data *mrd;
- bl = map_id2bl(id);
+ bl = iMap->id2bl(id);
if(bl == NULL)
return 0;
sd = BL_CAST(BL_PC, bl);
@@ -154,29 +154,29 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
dx = dirx[(int)dir];
dy = diry[(int)dir];
- if(map_getcell(bl->m,x+dx,y+dy,CELL_CHKNOPASS))
+ if(iMap->getcell(bl->m,x+dx,y+dy,CELL_CHKNOPASS))
return unit_walktoxy_sub(bl);
//Refresh view for all those we lose sight
- map_foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, sd?BL_ALL:BL_PC, bl);
+ iMap->foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, sd?BL_ALL:BL_PC, bl);
x += dx;
y += dy;
- map_moveblock(bl, x, y, tick);
+ iMap->moveblock(bl, x, y, tick);
ud->walk_count++; //walked cell counter, to be used for walk-triggered skills. [Skotlex]
status_change_end(bl, SC_ROLLINGCUTTER, INVALID_TIMER); //If you move, you lose your counters. [malufett]
if (bl->x != x || bl->y != y || ud->walktimer != INVALID_TIMER)
- return 0; //map_moveblock has altered the object beyond what we expected (moved/warped it)
+ return 0; //iMap->moveblock has altered the object beyond what we expected (moved/warped it)
ud->walktimer = -2; // arbitrary non-INVALID_TIMER value to make the clif code send walking packets
- map_foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
+ iMap->foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
ud->walktimer = INVALID_TIMER;
if(sd) {
if( sd->touching_id )
npc_touchnext_areanpc(sd,false);
- if(map_getcell(bl->m,x,y,CELL_CHKNPC)) {
+ if(iMap->getcell(bl->m,x,y,CELL_CHKNPC)) {
npc_touch_areanpc(sd,bl->m,x,y);
if (bl->prev == NULL) //Script could have warped char, abort remaining of the function.
return 0;
@@ -188,9 +188,9 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
// mercenary should be warped after being 3 seconds too far from the master [greenbox]
if (sd->md->masterteleport_timer == 0)
{
- sd->md->masterteleport_timer = gettick();
+ sd->md->masterteleport_timer = iTimer->gettick();
}
- else if (DIFF_TICK(gettick(), sd->md->masterteleport_timer) > 3000)
+ else if (DIFF_TICK(iTimer->gettick(), sd->md->masterteleport_timer) > 3000)
{
sd->md->masterteleport_timer = 0;
unit_warp( &sd->md->bl, sd->bl.m, sd->bl.x, sd->bl.y, CLR_TELEPORT );
@@ -202,7 +202,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
sd->md->masterteleport_timer = 0;
}
} else if (md) {
- if( map_getcell(bl->m,x,y,CELL_CHKNPC) ) {
+ if( iMap->getcell(bl->m,x,y,CELL_CHKNPC) ) {
if( npc_touch_areanpc2(md) ) return 0; // Warped
} else
md->areanpc_id = 0;
@@ -229,9 +229,9 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
// mercenary should be warped after being 3 seconds too far from the master [greenbox]
if (mrd->masterteleport_timer == 0)
{
- mrd->masterteleport_timer = gettick();
+ mrd->masterteleport_timer = iTimer->gettick();
}
- else if (DIFF_TICK(gettick(), mrd->masterteleport_timer) > 3000)
+ else if (DIFF_TICK(iTimer->gettick(), mrd->masterteleport_timer) > 3000)
{
mrd->masterteleport_timer = 0;
unit_warp( bl, mrd->master->bl.id, mrd->master->bl.x, mrd->master->bl.y, CLR_TELEPORT );
@@ -258,7 +258,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
i = status_get_speed(bl);
if(i > 0) {
- ud->walktimer = add_timer(tick+i,unit_walktoxy_timer,id,i);
+ ud->walktimer = iTimer->add_timer(tick+i,unit_walktoxy_timer,id,i);
if( md && DIFF_TICK(tick,md->dmgtick) < 3000 )//not required not damaged recently
clif->move(ud);
} else if(ud->state.running) {
@@ -268,7 +268,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
}
else if (ud->target_to) {
//Update target trajectory.
- struct block_list *tbl = map_id2bl(ud->target_to);
+ struct block_list *tbl = iMap->id2bl(ud->target_to);
if (!tbl || !status_check_visibility(bl, tbl)) { //Cancel chase.
ud->to_x = bl->x;
ud->to_y = bl->y;
@@ -300,7 +300,7 @@ static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data
static int unit_delay_walktoxy_timer(int tid, unsigned int tick, int id, intptr_t data)
{
- struct block_list *bl = map_id2bl(id);
+ struct block_list *bl = iMap->id2bl(id);
if (!bl || bl->prev == NULL)
return 0;
@@ -333,10 +333,10 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
if( (battle_config.max_walk_path < wpd.path_len) && (bl->type != BL_NPC) )
return 0;
- if (flag&4 && DIFF_TICK(ud->canmove_tick, gettick()) > 0 &&
- DIFF_TICK(ud->canmove_tick, gettick()) < 2000)
+ if (flag&4 && DIFF_TICK(ud->canmove_tick, iTimer->gettick()) > 0 &&
+ DIFF_TICK(ud->canmove_tick, iTimer->gettick()) < 2000)
{ // Delay walking command. [Skotlex]
- add_timer(ud->canmove_tick+1, unit_delay_walktoxy_timer, bl->id, (x<<16)|(y&0xFFFF));
+ iTimer->add_timer(ud->canmove_tick+1, unit_delay_walktoxy_timer, bl->id, (x<<16)|(y&0xFFFF));
return 1;
}
@@ -350,7 +350,7 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
sc = status_get_sc(bl);
if (sc && sc->data[SC_CONFUSION]) //Randomize the target position
- map_random_dir(bl, &ud->to_x, &ud->to_y);
+ iMap->random_dir(bl, &ud->to_x, &ud->to_y);
if(ud->walktimer != INVALID_TIMER) {
// When you come to the center of the grid because the change of destination while you're walking right now
@@ -360,7 +360,7 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
}
if(ud->attacktimer != INVALID_TIMER) {
- delete_timer( ud->attacktimer, unit_attack_timer );
+ iTimer->delete_timer( ud->attacktimer, unit_attack_timer );
ud->attacktimer = INVALID_TIMER;
}
@@ -378,13 +378,13 @@ static inline void set_mobstate(struct block_list* bl, int flag)
static int unit_walktobl_sub(int tid, unsigned int tick, int id, intptr_t data)
{
- struct block_list *bl = map_id2bl(id);
+ struct block_list *bl = iMap->id2bl(id);
struct unit_data *ud = bl?unit_bl2ud(bl):NULL;
if (ud && ud->walktimer == INVALID_TIMER && ud->target == data)
{
if (DIFF_TICK(ud->canmove_tick, tick) > 0) //Keep waiting?
- add_timer(ud->canmove_tick+1, unit_walktobl_sub, id, data);
+ iTimer->add_timer(ud->canmove_tick+1, unit_walktobl_sub, id, data);
else if (unit_can_move(bl))
{
if (unit_walktoxy_sub(bl))
@@ -425,7 +425,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
sc = status_get_sc(bl);
if (sc && sc->data[SC_CONFUSION]) //Randomize the target position
- map_random_dir(bl, &ud->to_x, &ud->to_y);
+ iMap->random_dir(bl, &ud->to_x, &ud->to_y);
if(ud->walktimer != INVALID_TIMER) {
ud->state.change_walk_target = 1;
@@ -433,9 +433,9 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
return 1;
}
- if(DIFF_TICK(ud->canmove_tick, gettick()) > 0)
+ if(DIFF_TICK(ud->canmove_tick, iTimer->gettick()) > 0)
{ //Can't move, wait a bit before invoking the movement.
- add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target);
+ iTimer->add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target);
return 1;
}
@@ -443,7 +443,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
return 0;
if(ud->attacktimer != INVALID_TIMER) {
- delete_timer( ud->attacktimer, unit_attack_timer );
+ iTimer->delete_timer( ud->attacktimer, unit_attack_timer );
ud->attacktimer = INVALID_TIMER;
}
@@ -478,11 +478,11 @@ int unit_run(struct block_list *bl)
to_y = bl->y;
for(i=0;i<AREA_SIZE;i++)
{
- if(!map_getcell(bl->m,to_x+dir_x,to_y+dir_y,CELL_CHKPASS))
+ if(!iMap->getcell(bl->m,to_x+dir_x,to_y+dir_y,CELL_CHKPASS))
break;
//if sprinting and there's a PC/Mob/NPC, block the path [Kevin]
- if(sc->data[SC_RUN] && map_count_oncell(bl->m, to_x+dir_x, to_y+dir_y, BL_PC|BL_MOB|BL_NPC))
+ if(sc->data[SC_RUN] && iMap->count_oncell(bl->m, to_x+dir_x, to_y+dir_y, BL_PC|BL_MOB|BL_NPC))
break;
to_x += dir_x;
@@ -550,10 +550,10 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) {
to_y = bl->y;
for(i=0;i<AREA_SIZE;i++)
{
- if(!map_getcell(bl->m,to_x+dir_x,to_y+dir_y,CELL_CHKPASS))
+ if(!iMap->getcell(bl->m,to_x+dir_x,to_y+dir_y,CELL_CHKPASS))
break;
- if(sc->data[SC_WUGDASH] && map_count_oncell(bl->m, to_x+dir_x, to_y+dir_y, BL_PC|BL_MOB|BL_NPC))
+ if(sc->data[SC_WUGDASH] && iMap->count_oncell(bl->m, to_x+dir_x, to_y+dir_y, BL_PC|BL_MOB|BL_NPC))
break;
to_x += dir_x;
@@ -567,7 +567,7 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) {
if( sd ){
clif->fixpos(bl);
- skill->castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, gettick(), SD_LEVEL);
+ skill->castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, iTimer->gettick(), SD_LEVEL);
}
return 0;
}
@@ -584,7 +584,7 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) {
if( sd ){
clif->fixpos(bl);
- skill->castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, gettick(), SD_LEVEL);
+ skill->castend_damage_id(bl, &sd->bl, RA_WUGDASH, lv, iTimer->gettick(), SD_LEVEL);
}
return 0;
}
@@ -594,8 +594,8 @@ int unit_wugdash(struct block_list *bl, struct map_session_data *sd) {
//Makes bl attempt to run dist cells away from target. Uses hard-paths.
int unit_escape(struct block_list *bl, struct block_list *target, short dist)
{
- uint8 dir = map_calc_dir(target, bl->x, bl->y);
- while( dist > 0 && map_getcell(bl->m, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], CELL_CHKNOREACH) )
+ uint8 dir = iMap->calc_dir(target, bl->x, bl->y);
+ while( dist > 0 && iMap->getcell(bl->m, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], CELL_CHKNOREACH) )
dist--;
return ( dist > 0 && unit_walktoxy(bl, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], 0) );
}
@@ -617,30 +617,30 @@ int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool
unit_stop_walking(bl,1);
unit_stop_attack(bl);
- if( checkpath && (map_getcell(bl->m,dst_x,dst_y,CELL_CHKNOPASS) || !path_search(NULL,bl->m,bl->x,bl->y,dst_x,dst_y,easy,CELL_CHKNOREACH)) )
+ if( checkpath && (iMap->getcell(bl->m,dst_x,dst_y,CELL_CHKNOPASS) || !path_search(NULL,bl->m,bl->x,bl->y,dst_x,dst_y,easy,CELL_CHKNOREACH)) )
return 0; // unreachable
ud->to_x = dst_x;
ud->to_y = dst_y;
- dir = map_calc_dir(bl, dst_x, dst_y);
+ dir = iMap->calc_dir(bl, dst_x, dst_y);
ud->dir = dir;
dx = dst_x - bl->x;
dy = dst_y - bl->y;
- map_foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, sd?BL_ALL:BL_PC, bl);
+ iMap->foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, sd?BL_ALL:BL_PC, bl);
- map_moveblock(bl, dst_x, dst_y, gettick());
+ iMap->moveblock(bl, dst_x, dst_y, iTimer->gettick());
ud->walktimer = -2; // arbitrary non-INVALID_TIMER value to make the clif code send walking packets
- map_foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
+ iMap->foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl);
ud->walktimer = INVALID_TIMER;
if(sd) {
if( sd->touching_id )
npc_touchnext_areanpc(sd,false);
- if(map_getcell(bl->m,bl->x,bl->y,CELL_CHKNPC)) {
+ if(iMap->getcell(bl->m,bl->x,bl->y,CELL_CHKNPC)) {
npc_touch_areanpc(sd,bl->m,bl->x,bl->y);
if (bl->prev == NULL) //Script could have warped char, abort remaining of the function.
return 0;
@@ -678,10 +678,12 @@ int unit_setdir(struct block_list *bl,unsigned char dir)
return 0;
}
-uint8 unit_getdir(struct block_list *bl)
-{
+uint8 unit_getdir(struct block_list *bl) {
struct unit_data *ud;
- nullpo_ret(bl );
+ nullpo_ret(bl);
+
+ if( bl->type == BL_NPC )
+ return ((TBL_NPC*)bl)->dir;
ud = unit_bl2ud(bl);
if (!ud) return 0;
return ud->dir;
@@ -719,15 +721,15 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
dy = ny-bl->y;
if(dx || dy) {
- map_foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
+ iMap->foreachinmovearea(clif->outsight, bl, AREA_SIZE, dx, dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
if(su) {
skill->unit_move_unit_group(su->group, bl->m, dx, dy);
} else {
- map_moveblock(bl, nx, ny, gettick());
+ iMap->moveblock(bl, nx, ny, iTimer->gettick());
}
- map_foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
+ iMap->foreachinmovearea(clif->insight, bl, AREA_SIZE, -dx, -dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
if(!(flag&1)) {
clif->blown(bl);
@@ -737,7 +739,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
if(sd->touching_id) {
npc_touchnext_areanpc(sd, false);
}
- if(map_getcell(bl->m, bl->x, bl->y, CELL_CHKNPC)) {
+ if(iMap->getcell(bl->m, bl->x, bl->y, CELL_CHKNPC)) {
npc_touch_areanpc(sd, bl->m, bl->x, bl->y);
} else {
sd->areanpc_id = 0;
@@ -752,7 +754,7 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
}
//Warps a unit/ud to a given map/position.
-//In the case of players, pc_setpos is used.
+//In the case of players, iPc->setpos is used.
//it respects the no warp flags, so it is safe to call this without doing nowarpto/nowarp checks.
int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
{
@@ -785,16 +787,16 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
if (x<0 || y<0)
{ //Random map position.
- if (!map_search_freecell(NULL, m, &x, &y, -1, -1, 1)) {
+ if (!iMap->search_freecell(NULL, m, &x, &y, -1, -1, 1)) {
ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map[m].name, x, y);
return 2;
}
- } else if (map_getcell(m,x,y,CELL_CHKNOREACH))
+ } else if (iMap->getcell(m,x,y,CELL_CHKNOREACH))
{ //Invalid target cell
ShowWarning("unit_warp: Specified non-walkable target cell: %d (%s) at [%d,%d]\n", m, map[m].name, x,y);
- if (!map_search_freecell(NULL, m, &x, &y, 4, 4, 1))
+ if (!iMap->search_freecell(NULL, m, &x, &y, 4, 4, 1))
{ //Can't find a nearby cell
ShowWarning("unit_warp failed. Unit Id:%d/Type:%d, target position map %d (%s) at [%d,%d]\n", bl->id, bl->type, m, map[m].name, x, y);
return 2;
@@ -802,7 +804,7 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
}
if (bl->type == BL_PC) //Use pc_setpos
- return pc_setpos((TBL_PC*)bl, map_id2index(m), x, y, type);
+ return iPc->setpos((TBL_PC*)bl, map_id2index(m), x, y, type);
if (!unit_remove_map(bl, type))
return 3;
@@ -815,9 +817,9 @@ int unit_warp(struct block_list *bl,short m,short x,short y,clr_type type)
bl->y=ud->to_y=y;
bl->m=m;
- map_addblock(bl);
+ iMap->addblock(bl);
clif->spawn(bl);
- skill->unit_move(bl,gettick(),1);
+ skill->unit_move(bl,iTimer->gettick(),1);
return 0;
}
@@ -841,13 +843,13 @@ int unit_stop_walking(struct block_list *bl,int type)
if(!ud || ud->walktimer == INVALID_TIMER)
return 0;
//NOTE: We are using timer data after deleting it because we know the
- //delete_timer function does not messes with it. If the function's
+ //iTimer->delete_timer function does not messes with it. If the function's
//behaviour changes in the future, this code could break!
- td = get_timer(ud->walktimer);
- delete_timer(ud->walktimer, unit_walktoxy_timer);
+ td = iTimer->get_timer(ud->walktimer);
+ iTimer->delete_timer(ud->walktimer, unit_walktoxy_timer);
ud->walktimer = INVALID_TIMER;
ud->state.change_walk_target = 0;
- tick = gettick();
+ tick = iTimer->gettick();
if( (type&0x02 && !ud->walkpath.path_pos) //Force moving at least one cell.
|| (type&0x04 && td && DIFF_TICK(td->tick, tick) <= td->data/2) //Enough time has passed to cover half-cell
) {
@@ -863,7 +865,7 @@ int unit_stop_walking(struct block_list *bl,int type)
ud->to_x = bl->x;
ud->to_y = bl->y;
if(bl->type == BL_PET && type&~0xff)
- ud->canmove_tick = gettick() + (type>>8);
+ ud->canmove_tick = iTimer->gettick() + (type>>8);
//Readded, the check in unit_set_walkdelay means dmg during running won't fall through to this place in code [Kevin]
if (ud->state.running) {
@@ -906,10 +908,10 @@ int unit_can_move(struct block_list *bl) {
if (!ud)
return 0;
- if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK && (!sd || !pc_checkskill(sd, SA_FREECAST) || skill->get_inf2(ud->skill_id)&INF2_GUILD_SKILL))
+ if (ud->skilltimer != INVALID_TIMER && ud->skill_id != LG_EXEEDBREAK && (!sd || !iPc->checkskill(sd, SA_FREECAST) || skill->get_inf2(ud->skill_id)&INF2_GUILD_SKILL))
return 0; // prevent moving while casting
- if (DIFF_TICK(ud->canmove_tick, gettick()) > 0)
+ if (DIFF_TICK(ud->canmove_tick, iTimer->gettick()) > 0)
return 0;
if (sd && (
@@ -966,7 +968,7 @@ int unit_can_move(struct block_list *bl) {
if (sc->opt1 > 0 && sc->opt1 != OPT1_STONEWAIT && sc->opt1 != OPT1_BURNING && !(sc->opt1 == OPT1_CRYSTALIZE && bl->type == BL_MOB))
return 0;
- if ((sc->option & OPTION_HIDE) && (!sd || pc_checkskill(sd, RG_TUNNELDRIVE) <= 0))
+ if ((sc->option & OPTION_HIDE) && (!sd || iPc->checkskill(sd, RG_TUNNELDRIVE) <= 0))
return 0;
}
@@ -981,7 +983,7 @@ int unit_resume_running(int tid, unsigned int tick, int id, intptr_t data)
{
struct unit_data *ud = (struct unit_data *)data;
- TBL_PC * sd = map_id2sd(id);
+ TBL_PC * sd = iMap->id2sd(id);
if(sd && pc_isridingwug(sd))
clif->skill_nodamage(ud->bl,ud->bl,RA_WUGDASH,ud->skill_lv,
@@ -1031,13 +1033,13 @@ int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int
//Resume running after can move again [Kevin]
if(ud->state.running)
{
- add_timer(ud->canmove_tick, unit_resume_running, bl->id, (intptr_t)ud);
+ iTimer->add_timer(ud->canmove_tick, unit_resume_running, bl->id, (intptr_t)ud);
}
else
{
unit_stop_walking(bl,2|4);
if(ud->target)
- add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target);
+ iTimer->add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target);
}
}
}
@@ -1051,7 +1053,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
struct status_change *sc;
struct map_session_data *sd = NULL;
struct block_list * target = NULL;
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
int temp = 0, range;
nullpo_ret(src);
@@ -1093,7 +1095,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
switch(skill_id) { //Check for skills that auto-select target
case MO_CHAINCOMBO:
if (sc && sc->data[SC_BLADESTOP]){
- if ((target=map_id2bl(sc->data[SC_BLADESTOP]->val4)) == NULL)
+ if ((target=iMap->id2bl(sc->data[SC_BLADESTOP]->val4)) == NULL)
return 0;
}
break;
@@ -1101,7 +1103,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
case WE_FEMALE:
if (!sd->status.partner_id)
return 0;
- target = (struct block_list*)map_charid2sd(sd->status.partner_id);
+ target = (struct block_list*)iMap->charid2sd(sd->status.partner_id);
if (!target) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -1124,7 +1126,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
}
if( !target ) // choose default target
- target = map_id2bl(target_id);
+ target = iMap->id2bl(target_id);
if( !target || src->m != target->m || !src->prev || !target->prev )
return 0;
@@ -1160,7 +1162,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
break;
case BD_ENCORE:
//Prevent using the dance skill if you no longer have the skill in your tree.
- if(!sd->skill_id_dance || pc_checkskill(sd,sd->skill_id_dance)<=0){
+ if(!sd->skill_id_dance || iPc->checkskill(sd,sd->skill_id_dance)<=0){
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -1275,7 +1277,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
}
break;
case GD_EMERGENCYCALL: //Emergency Call double cast when the user has learned Leap [Daegaladh]
- if( sd && pc_checkskill(sd,TK_HIGHJUMP) )
+ if( sd && iPc->checkskill(sd,TK_HIGHJUMP) )
casttime *= 2;
break;
case RA_WUGDASH:
@@ -1383,8 +1385,8 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
if( casttime > 0 ) {
- ud->skilltimer = add_timer( tick+casttime, skill->castend_id, src->id, 0 );
- if( sd && (pc_checkskill(sd,SA_FREECAST) > 0 || skill_id == LG_EXEEDBREAK) )
+ ud->skilltimer = iTimer->add_timer( tick+casttime, skill->castend_id, src->id, 0 );
+ if( sd && (iPc->checkskill(sd,SA_FREECAST) > 0 || skill_id == LG_EXEEDBREAK) )
status_calc_bl(&sd->bl, SCB_SPEED);
} else
skill->castend_id(ud->skilltimer,tick,src->id,0);
@@ -1407,7 +1409,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
struct unit_data *ud = NULL;
struct status_change *sc;
struct block_list bl;
- unsigned int tick = gettick();
+ unsigned int tick = iTimer->gettick();
int range;
nullpo_ret(src);
@@ -1434,7 +1436,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
* "WHY IS IT HEREE": pneuma cannot be cancelled past this point, the client displays the animation even,
* if we cancel it from nodamage_id, so it has to be here for it to not display the animation.
**/
- if( skill_id == AL_PNEUMA && map_getcell(src->m, skill_x, skill_y, CELL_CHKLANDPROTECTOR) ) {
+ if( skill_id == AL_PNEUMA && iMap->getcell(src->m, skill_x, skill_y, CELL_CHKLANDPROTECTOR) ) {
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
}
@@ -1443,7 +1445,7 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
if (!status_check_skilluse(src, NULL, skill_id, 0))
return 0;
- if( map_getcell(src->m, skill_x, skill_y, CELL_CHKWALL) )
+ if( iMap->getcell(src->m, skill_x, skill_y, CELL_CHKWALL) )
{// can't cast ground targeted spells on wall cells
if (sd) clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
return 0;
@@ -1514,8 +1516,8 @@ int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, ui
// in official this is triggered even if no cast time.
clif->skillcasting(src, src->id, 0, skill_x, skill_y, skill_id, skill->get_ele(skill_id, skill_lv), casttime);
if( casttime > 0 ) {
- ud->skilltimer = add_timer( tick+casttime, skill->castend_pos, src->id, 0 );
- if( (sd && pc_checkskill(sd,SA_FREECAST) > 0) || skill_id == LG_EXEEDBREAK)
+ ud->skilltimer = iTimer->add_timer( tick+casttime, skill->castend_pos, src->id, 0 );
+ if( (sd && iPc->checkskill(sd,SA_FREECAST) > 0) || skill_id == LG_EXEEDBREAK)
status_calc_bl(&sd->bl, SCB_SPEED);
} else {
ud->skilltimer = INVALID_TIMER;
@@ -1535,9 +1537,9 @@ int unit_set_target(struct unit_data* ud, int target_id)
nullpo_ret(ud);
if( ud->target != target_id ) {
- if( ud->target && (target = map_id2bl(ud->target)) && (ux = unit_bl2ud(target)) && ux->target_count > 0 )
+ if( ud->target && (target = iMap->id2bl(ud->target)) && (ux = unit_bl2ud(target)) && ux->target_count > 0 )
ux->target_count --;
- if( target_id && (target = map_id2bl(target_id)) && (ux = unit_bl2ud(target)) )
+ if( target_id && (target = iMap->id2bl(target_id)) && (ux = unit_bl2ud(target)) )
ux->target_count ++;
}
@@ -1553,7 +1555,7 @@ int unit_stop_attack(struct block_list *bl)
if(!ud || ud->attacktimer == INVALID_TIMER)
return 0;
- delete_timer( ud->attacktimer, unit_attack_timer );
+ iTimer->delete_timer( ud->attacktimer, unit_attack_timer );
ud->attacktimer = INVALID_TIMER;
unit_set_target(ud, 0);
return 0;
@@ -1569,7 +1571,7 @@ int unit_unattackable(struct block_list *bl)
}
if(bl->type == BL_MOB)
- mob_unlocktarget((struct mob_data*)bl, gettick()) ;
+ mob_unlocktarget((struct mob_data*)bl, iTimer->gettick()) ;
else if(bl->type == BL_PET)
pet_unlocktarget((struct pet_data*)bl);
return 0;
@@ -1586,7 +1588,7 @@ int unit_attack(struct block_list *src,int target_id,int continuous)
nullpo_ret(ud = unit_bl2ud(src));
- target = map_id2bl(target_id);
+ target = iMap->id2bl(target_id);
if( target==NULL || status_isdead(target) ) {
unit_unattackable(src);
return 1;
@@ -1621,11 +1623,11 @@ int unit_attack(struct block_list *src,int target_id,int continuous)
if(src->type == BL_MOB)
((TBL_MOB*)src)->state.skillstate = ((TBL_MOB*)src)->state.aggressive?MSS_ANGRY:MSS_BERSERK;
- if(DIFF_TICK(ud->attackabletime, gettick()) > 0)
+ if(DIFF_TICK(ud->attackabletime, iTimer->gettick()) > 0)
//Do attack next time it is possible. [Skotlex]
- ud->attacktimer=add_timer(ud->attackabletime,unit_attack_timer,src->id,0);
+ ud->attacktimer=iTimer->add_timer(ud->attackabletime,unit_attack_timer,src->id,0);
else //Attack NOW.
- unit_attack_timer(INVALID_TIMER, gettick(), src->id, 0);
+ unit_attack_timer(INVALID_TIMER, iTimer->gettick(), src->id, 0);
return 0;
}
@@ -1642,13 +1644,13 @@ int unit_cancel_combo(struct block_list *bl)
ud = unit_bl2ud(bl);
nullpo_ret(ud);
- ud->attackabletime = gettick() + status_get_amotion(bl);
+ ud->attackabletime = iTimer->gettick() + status_get_amotion(bl);
if (ud->attacktimer == INVALID_TIMER)
return 1; //Nothing more to do.
- delete_timer(ud->attacktimer, unit_attack_timer);
- ud->attacktimer=add_timer(ud->attackabletime,unit_attack_timer,bl->id,0);
+ iTimer->delete_timer(ud->attacktimer, unit_attack_timer);
+ ud->attacktimer=iTimer->add_timer(ud->attackabletime,unit_attack_timer,bl->id,0);
return 1;
}
/*==========================================
@@ -1689,9 +1691,9 @@ bool unit_can_reach_bl(struct block_list *bl,struct block_list *tbl, int range,
dx=(dx>0)?1:((dx<0)?-1:0);
dy=(dy>0)?1:((dy<0)?-1:0);
- if (map_getcell(tbl->m,tbl->x-dx,tbl->y-dy,CELL_CHKNOPASS))
+ if (iMap->getcell(tbl->m,tbl->x-dx,tbl->y-dy,CELL_CHKNOPASS))
{ //Look for a suitable cell to place in.
- for(i=0;i<9 && map_getcell(tbl->m,tbl->x-dirx[i],tbl->y-diry[i],CELL_CHKNOPASS);i++);
+ for(i=0;i<9 && iMap->getcell(tbl->m,tbl->x-dirx[i],tbl->y-diry[i],CELL_CHKNOPASS);i++);
if (i==9) return false; //No valid cells.
dx = dirx[i];
dy = diry[i];
@@ -1782,7 +1784,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
sd = BL_CAST(BL_PC, src);
md = BL_CAST(BL_MOB, src);
ud->attacktimer = INVALID_TIMER;
- target=map_id2bl(ud->target);
+ target=iMap->id2bl(ud->target);
if( src == NULL || src->prev == NULL || target==NULL || target->prev == NULL )
return 0;
@@ -1802,10 +1804,10 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
return 0;
}
- if( ud->skilltimer != INVALID_TIMER && !(sd && pc_checkskill(sd,SA_FREECAST) > 0) )
+ if( ud->skilltimer != INVALID_TIMER && !(sd && iPc->checkskill(sd,SA_FREECAST) > 0) )
return 0; // can't attack while casting
- if( !battle_config.sdelay_attack_enable && DIFF_TICK(ud->canact_tick,tick) > 0 && !(sd && pc_checkskill(sd,SA_FREECAST) > 0) )
+ if( !battle_config.sdelay_attack_enable && DIFF_TICK(ud->canact_tick,tick) > 0 && !(sd && iPc->checkskill(sd,SA_FREECAST) > 0) )
{ // attacking when under cast delay has restrictions:
if( tid == INVALID_TIMER )
{ //requested attack.
@@ -1817,7 +1819,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
{
if( DIFF_TICK(ud->canact_tick, ud->attackabletime) > 0 )
ud->attackabletime = ud->canact_tick;
- ud->attacktimer=add_timer(ud->attackabletime,unit_attack_timer,src->id,0);
+ ud->attacktimer=iTimer->add_timer(ud->attackabletime,unit_attack_timer,src->id,0);
}
return 1;
}
@@ -1849,7 +1851,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
if( DIFF_TICK(ud->attackabletime,tick) <= 0 )
{
if (battle_config.attack_direction_change && (src->type&battle_config.attack_direction_change)) {
- ud->dir = map_calc_dir(src, target->x,target->y );
+ ud->dir = iMap->calc_dir(src, target->x,target->y );
}
if(ud->walktimer != INVALID_TIMER)
unit_stop_walking(src,1);
@@ -1859,18 +1861,18 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
if (sstatus->mode&MD_ASSIST && DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME)
{ // Link monsters nearby [Skotlex]
md->last_linktime = tick;
- map_foreachinrange(mob_linksearch, src, md->db->range2, BL_MOB, md->class_, target, tick);
+ iMap->foreachinrange(mob_linksearch, src, md->db->range2, BL_MOB, md->class_, target, tick);
}
}
if(src->type == BL_PET && pet_attackskill((TBL_PET*)src, target->id))
return 1;
- map_freeblock_lock();
+ iMap->freeblock_lock();
ud->attacktarget_lv = battle->weapon_attack(src,target,tick,0);
if(sd && sd->status.pet_id > 0 && sd->pd && battle_config.pet_attack_support)
pet_target_check(sd,target,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
/**
* Applied when you're unable to attack (e.g. out of ammo)
* We should stop here otherwise timer keeps on and this happens endlessly
@@ -1885,7 +1887,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
}
if(ud->state.attack_continue)
- ud->attacktimer = add_timer(ud->attackabletime,unit_attack_timer,src->id,0);
+ ud->attacktimer = iTimer->add_timer(ud->attackabletime,unit_attack_timer,src->id,0);
return 1;
}
@@ -1893,7 +1895,7 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t
static int unit_attack_timer(int tid, unsigned int tick, int id, intptr_t data)
{
struct block_list *bl;
- bl = map_id2bl(id);
+ bl = iMap->id2bl(id);
if(bl && unit_attack_timer_sub(bl, tid, tick) == 0)
unit_unattackable(bl);
return 0;
@@ -1908,7 +1910,7 @@ int unit_skillcastcancel(struct block_list *bl,int type)
{
struct map_session_data *sd = NULL;
struct unit_data *ud = unit_bl2ud( bl);
- unsigned int tick=gettick();
+ unsigned int tick=iTimer->gettick();
int ret=0, skill_id;
nullpo_ret(bl);
@@ -1935,15 +1937,15 @@ int unit_skillcastcancel(struct block_list *bl,int type)
skill_id = ud->skill_id;
if (skill->get_inf(skill_id) & INF_GROUND_SKILL)
- ret = delete_timer( ud->skilltimer, skill->castend_pos );
+ ret = iTimer->delete_timer( ud->skilltimer, skill->castend_pos );
else
- ret = delete_timer( ud->skilltimer, skill->castend_id );
+ ret = iTimer->delete_timer( ud->skilltimer, skill->castend_id );
if( ret < 0 )
ShowError("delete timer error : skill_id : %d\n",ret);
ud->skilltimer = INVALID_TIMER;
- if( sd && pc_checkskill(sd,SA_FREECAST) > 0 )
+ if( sd && iPc->checkskill(sd,SA_FREECAST) > 0 )
status_calc_bl(&sd->bl, SCB_SPEED);
if( sd ) {
@@ -1961,8 +1963,7 @@ int unit_skillcastcancel(struct block_list *bl,int type)
}
// unit_data initialization process
-void unit_dataset(struct block_list *bl)
-{
+void unit_dataset(struct block_list *bl) {
struct unit_data *ud;
nullpo_retv(ud = unit_bl2ud(bl));
@@ -1973,7 +1974,7 @@ void unit_dataset(struct block_list *bl)
ud->attacktimer = INVALID_TIMER;
ud->attackabletime =
ud->canact_tick =
- ud->canmove_tick = gettick();
+ ud->canmove_tick = iTimer->gettick();
}
/*==========================================
@@ -2036,7 +2037,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
if(bl->prev == NULL)
return 0; //Already removed?
- map_freeblock_lock();
+ iMap->freeblock_lock();
unit_set_target(ud, 0);
@@ -2048,7 +2049,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
unit_skillcastcancel(bl,0);
// Do not reset can-act delay. [Skotlex]
- ud->attackabletime = ud->canmove_tick /*= ud->canact_tick*/ = gettick();
+ ud->attackabletime = ud->canmove_tick /*= ud->canact_tick*/ = iTimer->gettick();
if(sc && sc->count ) { //map-change/warp dispells.
status_change_end(bl, SC_BLADESTOP, INVALID_TIMER);
status_change_end(bl, SC_BASILICA, INVALID_TIMER);
@@ -2084,7 +2085,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
}
if (bl->type&(BL_CHAR|BL_PET)) {
- skill->unit_move(bl,gettick(),4);
+ skill->unit_move(bl,iTimer->gettick(),4);
skill->cleartimerskill(bl);
}
@@ -2093,7 +2094,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
struct map_session_data *sd = (struct map_session_data*)bl;
if(sd->shadowform_id){
- struct block_list *d_bl = map_id2bl(sd->shadowform_id);
+ struct block_list *d_bl = iMap->id2bl(sd->shadowform_id);
if( d_bl )
status_change_end(d_bl,SC__SHADOWFORM,INVALID_TIMER);
}
@@ -2110,7 +2111,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
storage_guild_storage_quit(sd,0);
sd->state.storage_flag = 0; //Force close it when being warped.
if(sd->party_invite>0)
- party_reply_invite(sd,sd->party_invite,0);
+ iParty->reply_invite(sd,sd->party_invite,0);
if(sd->guild_invite>0)
guild->reply_invite(sd,sd->guild_invite,0);
if(sd->guild_alliance>0)
@@ -2121,8 +2122,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
npc_touchnext_areanpc(sd,true);
// Check if warping and not changing the map.
- if ( sd->state.warping && !sd->state.changemap )
- {
+ if ( sd->state.warping && !sd->state.changemap ) {
status_change_end(bl, SC_CLOAKING, INVALID_TIMER);
status_change_end(bl, SC_CLOAKINGEXCEED, INVALID_TIMER);
}
@@ -2131,7 +2131,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
sd->adopt_invite = 0;
if(sd->pvp_timer != INVALID_TIMER) {
- delete_timer(sd->pvp_timer,pc_calc_pvprank_timer);
+ iTimer->delete_timer(sd->pvp_timer,iPc->calc_pvprank_timer);
sd->pvp_timer = INVALID_TIMER;
sd->pvp_rank = 0;
}
@@ -2139,10 +2139,10 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
duel_leave(sd->duel_group, sd);
if(pc_issit(sd)) {
- pc_setstand(sd);
+ iPc->setstand(sd);
skill->sit(sd,0);
}
- party_send_dot_remove(sd);//minimap dot fix [Kevin]
+ iParty->send_dot_remove(sd);//minimap dot fix [Kevin]
guild->send_dot_remove(sd);
bg_send_dot_remove(sd);
@@ -2163,18 +2163,15 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
sd->state.active, sd->state.connect_new, sd->state.rewarp, sd->state.changemap, sd->state.debug_remove_map,
map[bl->m].name, map[bl->m].users,
sd->debug_file, sd->debug_line, sd->debug_func, file, line, func);
- }
- else
- if (--map[bl->m].users == 0 && battle_config.dynamic_mobs) //[Skotlex]
- map_removemobs(bl->m);
+ } else if (--map[bl->m].users == 0 && battle_config.dynamic_mobs) //[Skotlex]
+ iMap->removemobs(bl->m);
if( !(sd->sc.option&OPTION_INVISIBLE) )
{// decrement the number of active pvp players on the map
--map[bl->m].users_pvp;
}
- if( map[bl->m].instance_id )
- {
- instance[map[bl->m].instance_id].users--;
- instance_check_idle(map[bl->m].instance_id);
+ if( map[bl->m].instance_id >= 0 ) {
+ instances[map[bl->m].instance_id].users--;
+ instance->check_idle(map[bl->m].instance_id);
}
sd->state.debug_remove_map = 1; // temporary state to track double remove_map's [FlavioJS]
sd->debug_file = file;
@@ -2199,9 +2196,9 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
if( pd->pet.intimate <= 0 && !(pd->msd && !pd->msd->state.active) )
{ //If logging out, this is deleted on unit_free
clif->clearunit_area(bl,clrtype);
- map_delblock(bl);
+ iMap->delblock(bl);
unit_free(bl,CLR_OUTSIGHT);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
@@ -2214,9 +2211,9 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
{ //If logging out, this is deleted on unit_free
clif->emotion(bl, E_SOB);
clif->clearunit_area(bl,clrtype);
- map_delblock(bl);
+ iMap->delblock(bl);
unit_free(bl,CLR_OUTSIGHT);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
break;
@@ -2227,9 +2224,9 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
if( mercenary_get_lifetime(md) <= 0 && !(md->master && !md->master->state.active) )
{
clif->clearunit_area(bl,clrtype);
- map_delblock(bl);
+ iMap->delblock(bl);
unit_free(bl,CLR_OUTSIGHT);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
break;
@@ -2240,9 +2237,9 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
if( elemental_get_lifetime(ed) <= 0 && !(ed->master && !ed->master->state.active) )
{
clif->clearunit_area(bl,clrtype);
- map_delblock(bl);
+ iMap->delblock(bl);
unit_free(bl,0);
- map_freeblock_unlock();
+ iMap->freeblock_unlock();
return 0;
}
break;
@@ -2254,8 +2251,8 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
**/
if( bl->type != BL_MOB || !status_isdead(bl) )
clif->clearunit_area(bl,clrtype);
- map_delblock(bl);
- map_freeblock_unlock();
+ iMap->delblock(bl);
+ iMap->freeblock_unlock();
return 1;
}
@@ -2293,7 +2290,7 @@ int unit_free(struct block_list *bl, clr_type clrtype)
struct unit_data *ud = unit_bl2ud( bl );
nullpo_ret(ud);
- map_freeblock_lock();
+ iMap->freeblock_lock();
if( bl->prev ) //Players are supposed to logout with a "warp" effect.
unit_remove_map(bl, clrtype);
@@ -2304,28 +2301,28 @@ int unit_free(struct block_list *bl, clr_type clrtype)
int i;
if( status_isdead(bl) )
- pc_setrestartvalue(sd,2);
+ iPc->setrestartvalue(sd,2);
- pc_delinvincibletimer(sd);
- pc_delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),false);
- pc_delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),false);
- pc_delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),false);
+ iPc->delinvincibletimer(sd);
+ iPc->delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),false);
+ iPc->delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),false);
+ iPc->delautobonus(sd,sd->autobonus3,ARRAYLENGTH(sd->autobonus3),false);
if( sd->followtimer != INVALID_TIMER )
- pc_stop_following(sd);
+ iPc->stop_following(sd);
if( sd->duel_invite > 0 )
duel_reject(sd->duel_invite, sd);
// Notify friends that this char logged out. [Skotlex]
- map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 0);
- party_send_logout(sd);
+ iMap->map_foreachpc(clif->friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 0);
+ iParty->send_logout(sd);
guild->send_memberinfoshort(sd,0);
- pc_cleareventtimer(sd);
- pc_inventory_rental_clear(sd);
- pc_delspiritball(sd,sd->spiritball,1);
+ iPc->cleareventtimer(sd);
+ iPc->inventory_rental_clear(sd);
+ iPc->delspiritball(sd,sd->spiritball,1);
for(i = 1; i < 5; i++)
- pc_del_talisman(sd, sd->talisman[i], i);
+ iPc->del_talisman(sd, sd->talisman[i], i);
if( sd->reg ) { //Double logout already freed pointer fix... [Skotlex]
aFree(sd->reg);
@@ -2356,9 +2353,19 @@ int unit_free(struct block_list *bl, clr_type clrtype)
ers_free(pc_sc_display_ers, sd->sc_display[i]);
}
sd->sc_display_count = 0;
+ }
+ if( sd->sc_display != NULL ) {
aFree(sd->sc_display);
sd->sc_display = NULL;
}
+ if( sd->instance != NULL ) {
+ aFree(sd->instance);
+ sd->instance = NULL;
+ }
+ if( sd->queues != NULL ) {
+ aFree(sd->queues);
+ sd->queues = NULL;
+ }
break;
}
case BL_PET:
@@ -2375,9 +2382,9 @@ int unit_free(struct block_list *bl, clr_type clrtype)
{
if (pd->s_skill->timer != INVALID_TIMER) {
if (pd->s_skill->id)
- delete_timer(pd->s_skill->timer, pet_skill_support_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_skill_support_timer);
else
- delete_timer(pd->s_skill->timer, pet_heal_timer);
+ iTimer->delete_timer(pd->s_skill->timer, pet_heal_timer);
}
aFree(pd->s_skill);
pd->s_skill = NULL;
@@ -2385,14 +2392,14 @@ int unit_free(struct block_list *bl, clr_type clrtype)
if( pd->recovery )
{
if(pd->recovery->timer != INVALID_TIMER)
- delete_timer(pd->recovery->timer, pet_recovery_timer);
+ iTimer->delete_timer(pd->recovery->timer, pet_recovery_timer);
aFree(pd->recovery);
pd->recovery = NULL;
}
if( pd->bonus )
{
if (pd->bonus->timer != INVALID_TIMER)
- delete_timer(pd->bonus->timer, pet_skill_bonus_timer);
+ iTimer->delete_timer(pd->bonus->timer, pet_skill_bonus_timer);
aFree(pd->bonus);
pd->bonus = NULL;
}
@@ -2420,12 +2427,12 @@ int unit_free(struct block_list *bl, clr_type clrtype)
struct mob_data *md = (struct mob_data*)bl;
if( md->spawn_timer != INVALID_TIMER )
{
- delete_timer(md->spawn_timer,mob_delayspawn);
+ iTimer->delete_timer(md->spawn_timer,mob_delayspawn);
md->spawn_timer = INVALID_TIMER;
}
if( md->deletetimer != INVALID_TIMER )
{
- delete_timer(md->deletetimer,mob_timer_delete);
+ iTimer->delete_timer(md->deletetimer,mob_timer_delete);
md->deletetimer = INVALID_TIMER;
}
if( md->lootitem )
@@ -2527,19 +2534,19 @@ int unit_free(struct block_list *bl, clr_type clrtype)
skill->clear_unitgroup(bl);
status_change_clear(bl,1);
- map_deliddb(bl);
+ iMap->deliddb(bl);
if( bl->type != BL_PC ) //Players are handled by map_quit
- map_freeblock(bl);
- map_freeblock_unlock();
+ iMap->freeblock(bl);
+ iMap->freeblock_unlock();
return 0;
}
int do_init_unit(void)
{
- add_timer_func_list(unit_attack_timer, "unit_attack_timer");
- add_timer_func_list(unit_walktoxy_timer,"unit_walktoxy_timer");
- add_timer_func_list(unit_walktobl_sub, "unit_walktobl_sub");
- add_timer_func_list(unit_delay_walktoxy_timer,"unit_delay_walktoxy_timer");
+ iTimer->add_timer_func_list(unit_attack_timer, "unit_attack_timer");
+ iTimer->add_timer_func_list(unit_walktoxy_timer,"unit_walktoxy_timer");
+ iTimer->add_timer_func_list(unit_walktobl_sub, "unit_walktobl_sub");
+ iTimer->add_timer_func_list(unit_delay_walktoxy_timer,"unit_delay_walktoxy_timer");
return 0;
}
diff --git a/src/map/vending.c b/src/map/vending.c
index 1576b684e..5b0bfdaa5 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -46,12 +46,12 @@ void vending_vendinglistreq(struct map_session_data* sd, unsigned int id) {
struct map_session_data* vsd;
nullpo_retv(sd);
- if( (vsd = map_id2sd(id)) == NULL )
+ if( (vsd = iMap->id2sd(id)) == NULL )
return;
if( !vsd->state.vending )
return; // not vending
- if (!pc_can_give_items(sd) || !pc_can_give_items(vsd)) { //check if both GMs are allowed to trade
+ if (!iPc->can_give_items(sd) || !iPc->can_give_items(vsd)) { //check if both GMs are allowed to trade
// GM is not allowed to trade
clif->message(sd->fd, msg_txt(246));
return;
@@ -69,7 +69,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
int i, j, cursor, w, new_ = 0, blank, vend_list[MAX_VENDING];
double z;
struct s_vending vend[MAX_VENDING]; // against duplicate packets
- struct map_session_data* vsd = map_id2sd(aid);
+ struct map_session_data* vsd = iMap->id2sd(aid);
nullpo_retv(sd);
if( vsd == NULL || !vsd->state.vending || vsd->bl.id == sd->bl.id )
@@ -88,7 +88,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
if( count < 1 || count > MAX_VENDING || count > vsd->vend_num )
return; // invalid amount of purchased items
- blank = pc_inventoryblank(sd); //number of free cells in the buyer's inventory
+ blank = iPc->inventoryblank(sd); //number of free cells in the buyer's inventory
// duplicate item in vending to check hacker with multiple packets
memcpy(&vend, &vsd->vending, sizeof(vsd->vending)); // copy vending list
@@ -144,7 +144,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
vend[j].amount -= amount;
- switch( pc_checkadditem(sd, vsd->status.cart[idx].nameid, amount) ) {
+ switch( iPc->checkadditem(sd, vsd->status.cart[idx].nameid, amount) ) {
case ADDITEM_EXIST:
break; //We'd add this item to the existing one (in buyers inventory)
case ADDITEM_NEW:
@@ -157,10 +157,10 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
}
}
- pc_payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd);
+ iPc->payzeny(sd, (int)z, LOG_TYPE_VENDING, vsd);
if( battle_config.vending_tax )
z -= z * (battle_config.vending_tax/10000.);
- pc_getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd);
+ iPc->getzeny(vsd, (int)z, LOG_TYPE_VENDING, sd);
for( i = 0; i < count; i++ ) {
short amount = *(uint16*)(data + 4*i + 0);
@@ -168,9 +168,9 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
idx -= 2;
// vending item
- pc_additem(sd, &vsd->status.cart[idx], amount, LOG_TYPE_VENDING);
+ iPc->additem(sd, &vsd->status.cart[idx], amount, LOG_TYPE_VENDING);
vsd->vending[vend_list[i]].amount -= amount;
- pc_cart_delitem(vsd, idx, amount, 0, LOG_TYPE_VENDING);
+ iPc->cart_delitem(vsd, idx, amount, 0, LOG_TYPE_VENDING);
clif->vendingreport(vsd, idx, amount);
//print buyer's name
@@ -197,7 +197,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
vsd->vend_num = cursor;
//Always save BOTH: buyer and customer
- if( save_settings&2 ) {
+ if( iMap->save_settings&2 ) {
chrif_save(sd,0);
chrif_save(vsd,0);
}
@@ -209,7 +209,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
if( i == vsd->vend_num ) {
//Close Vending (this was automatically done by the client, we have to do it manually for autovenders) [Skotlex]
vending->close(vsd);
- map_quit(vsd); //They have no reason to stay around anymore, do they?
+ iMap->quit(vsd); //They have no reason to stay around anymore, do they?
}
}
}
@@ -226,7 +226,7 @@ void vending_openvending(struct map_session_data* sd, const char* message, const
if ( pc_isdead(sd) || !sd->state.prevend || pc_istrading(sd))
return; // can't open vendings lying dead || didn't use via the skill (wpe/hack) || can't have 2 shops at once
- vending_skill_lvl = pc_checkskill(sd, MC_VENDING);
+ vending_skill_lvl = iPc->checkskill(sd, MC_VENDING);
// skill level and cart check
if( !vending_skill_lvl || !pc_iscarton(sd) ) {
clif->skill_fail(sd, MC_VENDING, USESKILL_FAIL_LEVEL, 0);
@@ -250,12 +250,12 @@ void vending_openvending(struct map_session_data* sd, const char* message, const
index -= 2; // offset adjustment (client says that the first cart position is 2)
if( index < 0 || index >= MAX_CART // invalid position
- || pc_cartitem_amount(sd, index, amount) < 0 // invalid item or insufficient quantity
+ || iPc->cartitem_amount(sd, index, amount) < 0 // invalid item or insufficient quantity
//NOTE: official server does not do any of the following checks!
|| !sd->status.cart[index].identify // unidentified item
|| sd->status.cart[index].attribute == 1 // broken item
|| sd->status.cart[index].expire_time // It should not be in the cart but just in case
- || !itemdb_cantrade(&sd->status.cart[index], pc_get_group_level(sd), pc_get_group_level(sd)) ) // untradeable item
+ || !itemdb_cantrade(&sd->status.cart[index], iPc->get_group_level(sd), iPc->get_group_level(sd)) ) // untradeable item
continue;
sd->vending[i].index = index;